Created
March 9, 2012 14:55
-
-
Save ericbmerritt/2006851 to your computer and use it in GitHub Desktop.
elisp for opening emacs in emacs
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
;;; | |
;;; Eshell stuff | |
;;; | |
(when (fboundp 'eshell) | |
;; This and rmb are my two vices. rmb is defined as an eshell alias. | |
(defalias 'eshell/lo #'eshell/exit) | |
(defalias 'eshell/logout #'save-buffers-kill-emacs) | |
;; I'm obsessive/compulsive with clear. | |
(defun eshell/clear () | |
"\"Clear the screen,\" as it were." | |
(recenter 0)) | |
(defun eshell/emacs (&rest args) | |
"Open a file in emacs. Some habits die hard." | |
(if (null args) | |
;; If I just ran "emacs", I probably expect to be launching | |
;; Emacs, which is rather silly since I'm already in Emacs. | |
;; So just pretend to do what I ask. | |
(bury-buffer) | |
;; We have to expand the file names or else naming a directory in an | |
;; argument causes later arguments to be looked for in that directory, | |
;; not the starting directory | |
(mapc #'find-file | |
(mapcar #'expand-file-name | |
(eshell-flatten-list (reverse args)))))) | |
(defalias 'eshell/emacsclient #'eshell/emacs)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment