Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

elisp for opening emacs in emacs

View gist:2006851
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
;;;
;;; 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
Something went wrong with that request. Please try again.