Created
August 12, 2010 02:59
-
-
Save miyamuko/520222 to your computer and use it in GitHub Desktop.
find-file で環境変数込みのパスを開けるようにする #xyzzy
This file contains hidden or 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
| ;; find-file で環境変数込みのパスを開けるようにする | |
| ;; (find-file "%SystemRoot%/system32/drivers/etc/hosts") | |
| (defun find-file-expand-env-hook (filename) | |
| (when (and filename | |
| (not (file-exist-p filename))) | |
| (let ((replaced nil)) | |
| (while (string-matchp "%\\([a-z]+\\)%" filename) | |
| (setf filename (substitute-string filename (match-string 0) | |
| (map-backslash-to-slash (si:getenv (match-string 1)))) | |
| replaced t)) | |
| (when replaced | |
| (ed::find-file-internal filename))))) | |
| (add-hook '*before-find-file-hook* 'find-file-expand-env-hook) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment