emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 628102f: * lisp/eshell/em-dirs.el (eshell-expand-mu


From: Stefan Monnier
Subject: [Emacs-diffs] master 628102f: * lisp/eshell/em-dirs.el (eshell-expand-multiple-dots): Avoid defadvice.
Date: Fri, 14 Sep 2018 11:14:06 -0400 (EDT)

branch: master
commit 628102f6f42d2ea82c4eda81ee35bdec1da32a9b
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/eshell/em-dirs.el (eshell-expand-multiple-dots): Avoid defadvice.
---
 lisp/eshell/em-dirs.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 5180a07..b7d13ee 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -314,16 +314,18 @@ Thus, this does not include the current directory.")
       path)))
 
 (defun eshell-expand-multiple-dots (path)
+  ;; FIXME: This advice recommendation is rather odd: it's somewhat
+  ;; dangerous and it claims not to work with minibuffer-completion, which
+  ;; makes it much less interesting.
   "Convert `...' to `../..', `....' to `../../..', etc..
 
 With the following piece of advice, you can make this functionality
 available in most of Emacs, with the exception of filename completion
 in the minibuffer:
 
-  (defadvice expand-file-name
-    (before translate-multiple-dots
-           (filename &optional directory) activate)
-    (setq filename (eshell-expand-multiple-dots filename)))"
+    (advice-add 'expand-file-name :around #'my-expand-multiple-dots)
+    (defun my-expand-multiple-dots (orig-fun filename &rest args)
+      (apply orig-fun (eshell-expand-multiple-dots filename) args))"
   (while (string-match "\\(?:^\\|/\\)\\.\\.\\(\\.+\\)\\(?:$\\|/\\)" path)
     (let* ((extra-dots (match-string 1 path))
           (len (length extra-dots))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]