Created
April 20, 2013 15:50
-
-
Save zakame/5426423 to your computer and use it in GitHub Desktop.
Fragment from my .emacs to get perlbrew working under it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; If perlbrew is used, get PERLBREW_PATH to be used in exec-path and PATH | |
;; Adapted from https://gist.github.com/960214 | |
(require 'cl) | |
(let ((perlbrew-init "~/.perlbrew/init")) | |
(if (file-readable-p perlbrew-init) | |
(dolist (line (with-temp-buffer | |
(insert-file-contents perlbrew-init) | |
(split-string (buffer-string) "\n" t))) | |
(with-temp-buffer | |
(insert line) | |
(goto-char (point-min)) | |
(search-forward "export " nil t) | |
(when (= (point) 8) | |
(let* ((idx (search-forward "=")) | |
(val (buffer-substring idx (progn (end-of-line) (point)))) | |
(key (buffer-substring 8 (decf idx)))) | |
(if (string-match "PERLBREW_PATH" key) | |
(dolist (perlbin (parse-colon-path val)) | |
(setq perlbin (substring perlbin 0 -1)) ; remove trailing / | |
(setenv "PATH" (concat perlbin ":" (getenv "PATH"))) | |
(add-to-list 'exec-path perlbin))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment