227 (keymapp (symbol-value ob)) |
227 (keymapp (symbol-value ob)) |
228 (functionp (lookup-key (symbol-value ob) key))) |
228 (functionp (lookup-key (symbol-value ob) key))) |
229 (push ob result))) |
229 (push ob result))) |
230 obarray) |
230 obarray) |
231 (remove-if-not 'identity result) )) |
231 (remove-if-not 'identity result) )) |
|
232 |
|
233 |
|
234 (defun my-path-append-to-beginning (pathenv path) |
|
235 "Append PATH to the beginning of PATHENV, pruning existing entries." |
|
236 (let* ( (pathenv (concat ":" pathenv ":")) |
|
237 (beg (cl-search (concat ":" path ":") pathenv)) |
|
238 lh rh ) |
|
239 (when beg |
|
240 (setq lh (substring pathenv 0 beg)) |
|
241 (setq rh (substring pathenv (1+ (cl-search ":" pathenv :start2 (1+ beg))) nil)) |
|
242 (setq pathenv (concat lh ":" rh))) |
|
243 ;; pathenv keeps ":" as a prefix (OK for the next concat) and suffix (need one to strip). |
|
244 (setq pathenv (substring pathenv 0 (1- (length pathenv)))) |
|
245 (concat path pathenv))) |
|
246 |
|
247 ;; (my-path-append-to-beginning "a:b:c" "a") |
|
248 ;; (my-path-append-to-beginning "a:b:c" "b") |
|
249 ;; (my-path-append-to-beginning "a:b:c" "c") |
|
250 ;; (my-path-append-to-beginning "a:b:c" "d") |
232 |
251 |
233 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
252 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
234 (message "lisp, elisp") |
253 (message "lisp, elisp") |
235 |
254 |
236 (cl-eval-when (compile) (require 'chistory)) |
255 (cl-eval-when (compile) (require 'chistory)) |
553 (message "Cygwin, MSYS") |
572 (message "Cygwin, MSYS") |
554 |
573 |
555 (when (and (eq system-type 'cygwin) (fboundp #'cygwin-winpath-activate)) |
574 (when (and (eq system-type 'cygwin) (fboundp #'cygwin-winpath-activate)) |
556 (cygwin-winpath-activate)) |
575 (cygwin-winpath-activate)) |
557 |
576 |
558 ;; Add some standard places to PATH as Emacs is not started from login shell |
577 ;; Add some standard places to PATH if they are not set by login script. |
559 ;; on Windows... |
578 ;; Rearrange the order of paths so system's are first, user's are last. |
560 (when (eq system-type 'cygwin) |
579 ;; For Cygwin this helps with Cygwin's paths to be situated before |
561 (mapc (lambda (path) |
580 ;; "C:/Windows" (Emacs is not started from a login shell on Windows!). |
562 (unless (cl-search (concat ":" path ":") (concat ":" (getenv "PATH") ":")) |
581 (unless (eq system-type 'windows-nt) |
563 (setenv "PATH" (concat (getenv "PATH") ":" path)))) |
582 (setenv "PATH" |
564 (list (expand-file-name "~/.local/bin") "/usr/local/bin"))) |
583 (cl-reduce #'my-path-append-to-beginning |
|
584 (list (getenv "PATH") |
|
585 (expand-file-name "~/usr/bin") (expand-file-name "~/.local/bin") |
|
586 "/usr/local/bin" "/usr/bin" "/bin" |
|
587 "/usr/sbin" "/sbin"))) |
565 |
588 |
566 (defun follow-cygwin-symlink () |
589 (defun follow-cygwin-symlink () |
567 "Follow new-style (and also UCS-16) Cygwin symlinks." |
590 "Follow new-style (and also UCS-16) Cygwin symlinks." |
568 (save-excursion |
591 (save-excursion |
569 (goto-char 0) |
592 (goto-char 0) |