From 2d8b292475b392c2d8ff347bc6867427bbad156f Mon Sep 17 00:00:00 2001 Message-Id: <2d8b292475b392c2d8ff347bc6867427bbad156f.1718338653.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 21 Oct 2010 14:52:06 +0100 Subject: [PATCH] el/dot-emacs.el: Twiddle `eshell' settings. Organization: Straylight/Edgeware From: Mark Wooding * Abbreviate the prompt, if possible. * Turn the aliases into real functions. Seems slightly prettier. --- el/dot-emacs.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 525d2d4..c51803b 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -2135,13 +2135,21 @@ (defun mdw-eshell-prompt () (save-match-data (replace-regexp-in-string "\\..*$" "" (system-name))) " " - (eshell/pwd) + (let* ((pwd (eshell/pwd)) (npwd (length pwd)) + (home (expand-file-name "~")) (nhome (length home))) + (if (and (>= npwd nhome) + (or (= nhome npwd) + (= (elt pwd nhome) ?/) + (string= (substring pwd 0 nhome) home))) + (concat "~" (substring pwd (length home))) + pwd)) right))) (setq eshell-prompt-function 'mdw-eshell-prompt) (setq eshell-prompt-regexp "^\\[[^]>]+\\(\\]\\|>>?\\)") -(defalias 'eshell/e 'find-file) -(defalias 'eshell/w3m 'w3m-goto-url) +(defun eshell/e (file) (find-file file) nil) +(defun eshell/ee (file) (find-file-other-window file) nil) +(defun eshell/w3m (url) (w3m-goto-url url) nil) (mdw-define-face eshell-prompt (t :weight bold)) (mdw-define-face eshell-ls-archive (t :weight bold :foreground "red")) -- [mdw]