diff options
| author | Stefan Kangas | 2023-02-02 06:30:28 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2023-02-02 06:30:28 +0100 |
| commit | 0571a3cc87f7c449796bb3eef38af4b2719b0bdf (patch) | |
| tree | 18b41402977f6200ca563b348e98ca3a82d04203 /lisp/eshell | |
| parent | c831f55b234725a99f908656f996f3e6addc8825 (diff) | |
| parent | 9715715ac163fc0b3ce6e170eb9c74b5f4ad8267 (diff) | |
| download | emacs-0571a3cc87f7c449796bb3eef38af4b2719b0bdf.tar.gz emacs-0571a3cc87f7c449796bb3eef38af4b2719b0bdf.zip | |
Merge from origin/emacs-29
9715715ac16 (eshell--complete-commands-list): Fix regression in fix t...
ea1bb263153 * doc/emacs/basic.texi (Repeating): Mention describe-repe...
f91bf9df892 Unbreak the MS-Windows build
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/em-cmpl.el | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index acbf206a3c6..2439f1ed804 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el | |||
| @@ -402,31 +402,6 @@ to writing a completion function." | |||
| 402 | args) | 402 | args) |
| 403 | posns))) | 403 | posns))) |
| 404 | 404 | ||
| 405 | (defun eshell--pcomplete-executables () | ||
| 406 | "Complete amongst a list of directories and executables. | ||
| 407 | |||
| 408 | Wrapper for `pcomplete-executables' or `pcomplete-dirs-or-entries', | ||
| 409 | depending on the value of `eshell-force-execution'. | ||
| 410 | |||
| 411 | Adds path prefix to candidates independent of `action' value." | ||
| 412 | ;; `pcomplete-entries' returns filenames without path on `action' to | ||
| 413 | ;; use current string directory as done in `completion-file-name-table' | ||
| 414 | ;; when `action' is nil to construct executable candidates. | ||
| 415 | (let ((table (if eshell-force-execution | ||
| 416 | (pcomplete-dirs-or-entries nil #'file-readable-p) | ||
| 417 | (pcomplete-executables)))) | ||
| 418 | (lambda (string pred action) | ||
| 419 | (let ((cands (funcall table string pred action))) | ||
| 420 | (if (eq action t) | ||
| 421 | (let ((specdir (file-name-directory string))) | ||
| 422 | (mapcar | ||
| 423 | (lambda (cand) | ||
| 424 | (if (stringp cand) | ||
| 425 | (file-name-concat specdir cand) | ||
| 426 | cand)) | ||
| 427 | cands)) | ||
| 428 | cands))))) | ||
| 429 | |||
| 430 | (defun eshell--complete-commands-list () | 405 | (defun eshell--complete-commands-list () |
| 431 | "Generate list of applicable, visible commands." | 406 | "Generate list of applicable, visible commands." |
| 432 | ;; Building the commands list can take quite a while, especially over Tramp | 407 | ;; Building the commands list can take quite a while, especially over Tramp |
| @@ -437,11 +412,19 @@ Adds path prefix to candidates independent of `action' value." | |||
| 437 | ;; we complete. Adjust `pcomplete-stub' accordingly! | 412 | ;; we complete. Adjust `pcomplete-stub' accordingly! |
| 438 | (if (and (> (length pcomplete-stub) 0) | 413 | (if (and (> (length pcomplete-stub) 0) |
| 439 | (eq (aref pcomplete-stub 0) eshell-explicit-command-char)) | 414 | (eq (aref pcomplete-stub 0) eshell-explicit-command-char)) |
| 440 | (setq pcomplete-stub (substring pcomplete-stub 1))))) | 415 | (setq pcomplete-stub (substring pcomplete-stub 1)))) |
| 441 | (completion-table-dynamic | 416 | (filename (pcomplete-arg))) |
| 442 | (lambda (filename) | 417 | ;; Do not use `completion-table-dynamic' when completing a command file |
| 443 | (if (file-name-directory filename) | 418 | ;; name since it doesn't know about boundaries and would end up doing silly |
| 444 | (eshell--pcomplete-executables) | 419 | ;; things like adding a SPC char when completing to "/usr/sbin/". |
| 420 | ;; | ||
| 421 | ;; If you work on this function, be careful not to reintroduce bug#48995. | ||
| 422 | (if (file-name-directory filename) | ||
| 423 | (if eshell-force-execution | ||
| 424 | (pcomplete-dirs-or-entries nil #'file-readable-p) | ||
| 425 | (pcomplete-executables)) | ||
| 426 | (completion-table-dynamic | ||
| 427 | (lambda (filename) | ||
| 445 | (let* ((paths (eshell-get-path)) | 428 | (let* ((paths (eshell-get-path)) |
| 446 | (cwd (file-name-as-directory | 429 | (cwd (file-name-as-directory |
| 447 | (expand-file-name default-directory))) | 430 | (expand-file-name default-directory))) |