diff options
| author | Stefan Monnier | 2018-09-14 11:14:02 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2018-09-14 11:14:02 -0400 |
| commit | 628102f6f42d2ea82c4eda81ee35bdec1da32a9b (patch) | |
| tree | e3e44821f2cdc11920fc363e6103639fbc25fd3b | |
| parent | 441e23b5eb13929db9341f93ee71b761135943e3 (diff) | |
| download | emacs-628102f6f42d2ea82c4eda81ee35bdec1da32a9b.tar.gz emacs-628102f6f42d2ea82c4eda81ee35bdec1da32a9b.zip | |
* lisp/eshell/em-dirs.el (eshell-expand-multiple-dots): Avoid defadvice.
| -rw-r--r-- | lisp/eshell/em-dirs.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 5180a0700db..b7d13ee27b7 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.") | |||
| 314 | path))) | 314 | path))) |
| 315 | 315 | ||
| 316 | (defun eshell-expand-multiple-dots (path) | 316 | (defun eshell-expand-multiple-dots (path) |
| 317 | ;; FIXME: This advice recommendation is rather odd: it's somewhat | ||
| 318 | ;; dangerous and it claims not to work with minibuffer-completion, which | ||
| 319 | ;; makes it much less interesting. | ||
| 317 | "Convert `...' to `../..', `....' to `../../..', etc.. | 320 | "Convert `...' to `../..', `....' to `../../..', etc.. |
| 318 | 321 | ||
| 319 | With the following piece of advice, you can make this functionality | 322 | With the following piece of advice, you can make this functionality |
| 320 | available in most of Emacs, with the exception of filename completion | 323 | available in most of Emacs, with the exception of filename completion |
| 321 | in the minibuffer: | 324 | in the minibuffer: |
| 322 | 325 | ||
| 323 | (defadvice expand-file-name | 326 | (advice-add 'expand-file-name :around #'my-expand-multiple-dots) |
| 324 | (before translate-multiple-dots | 327 | (defun my-expand-multiple-dots (orig-fun filename &rest args) |
| 325 | (filename &optional directory) activate) | 328 | (apply orig-fun (eshell-expand-multiple-dots filename) args))" |
| 326 | (setq filename (eshell-expand-multiple-dots filename)))" | ||
| 327 | (while (string-match "\\(?:^\\|/\\)\\.\\.\\(\\.+\\)\\(?:$\\|/\\)" path) | 329 | (while (string-match "\\(?:^\\|/\\)\\.\\.\\(\\.+\\)\\(?:$\\|/\\)" path) |
| 328 | (let* ((extra-dots (match-string 1 path)) | 330 | (let* ((extra-dots (match-string 1 path)) |
| 329 | (len (length extra-dots)) | 331 | (len (length extra-dots)) |