diff options
| author | Chong Yidong | 2012-01-05 22:51:05 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-01-05 22:51:05 +0800 |
| commit | 7baca3bcbe2be3cbf2108eda589cf5c6147e2566 (patch) | |
| tree | 33f2537e5ffdb2b88d0084b524abfc2781fa960f /lisp | |
| parent | cf3304e1c58f818b7c5636c08742aa19ecaf869a (diff) | |
| download | emacs-7baca3bcbe2be3cbf2108eda589cf5c6147e2566.tar.gz emacs-7baca3bcbe2be3cbf2108eda589cf5c6147e2566.zip | |
Proper fix for shell-completion-execonly.
* shell.el (shell-dynamic-complete-functions): Revert last change.
(shell-command-completion-function): New function.
(shell-completion-vars): Use it to implement
shell-completion-execonly.
Fixes: debbugs:10417
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/shell.el | 17 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 58e81f6a87e..d2ee593c389 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2012-01-05 Chong Yidong <cyd@gnu.org> | 1 | 2012-01-05 Chong Yidong <cyd@gnu.org> |
| 2 | 2 | ||
| 3 | * shell.el (shell-dynamic-complete-functions): Revert last change. | ||
| 4 | (shell-command-completion-function): New function. | ||
| 5 | (shell-completion-vars): Use it to implement | ||
| 6 | shell-completion-execonly (Bug#10417). | ||
| 7 | |||
| 3 | * custom.el (enable-theme): Don't set custom-safe-themes. | 8 | * custom.el (enable-theme): Don't set custom-safe-themes. |
| 4 | 9 | ||
| 5 | * cus-theme.el (custom-theme-merge-theme): Ignore | 10 | * cus-theme.el (custom-theme-merge-theme): Ignore |
diff --git a/lisp/shell.el b/lisp/shell.el index 77df0a99aa3..e7a8953ecbe 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -187,11 +187,9 @@ This is a fine thing to set in your `.emacs' file.") | |||
| 187 | shell-environment-variable-completion | 187 | shell-environment-variable-completion |
| 188 | shell-command-completion | 188 | shell-command-completion |
| 189 | shell-c-a-p-replace-by-expanded-directory | 189 | shell-c-a-p-replace-by-expanded-directory |
| 190 | pcomplete-completions-at-point | ||
| 190 | shell-filename-completion | 191 | shell-filename-completion |
| 191 | comint-filename-completion | 192 | comint-filename-completion) |
| 192 | ;; This goes last, so that `comint-filename-completion' can handle | ||
| 193 | ;; `shell-completion-execonly' (Bug#10417). | ||
| 194 | pcomplete-completions-at-point) | ||
| 195 | "List of functions called to perform completion. | 193 | "List of functions called to perform completion. |
| 196 | This variable is used to initialize `comint-dynamic-complete-functions' in the | 194 | This variable is used to initialize `comint-dynamic-complete-functions' in the |
| 197 | shell buffer. | 195 | shell buffer. |
| @@ -407,6 +405,15 @@ Thus, this does not include the shell's current directory.") | |||
| 407 | (push (mapconcat #'identity (nreverse arg) "") args))) | 405 | (push (mapconcat #'identity (nreverse arg) "") args))) |
| 408 | (cons (nreverse args) (nreverse begins))))) | 406 | (cons (nreverse args) (nreverse begins))))) |
| 409 | 407 | ||
| 408 | (defun shell-command-completion-function () | ||
| 409 | "Completion function for shell command names. | ||
| 410 | This is the value of `pcomplete-command-completion-function' for | ||
| 411 | Shell buffers. It implements `shell-completion-execonly' for | ||
| 412 | `pcomplete' completion." | ||
| 413 | (pcomplete-here (pcomplete-entries nil | ||
| 414 | (if shell-completion-execonly | ||
| 415 | 'file-executable-p)))) | ||
| 416 | |||
| 410 | (defun shell-completion-vars () | 417 | (defun shell-completion-vars () |
| 411 | "Setup completion vars for `shell-mode' and `read-shell-command'." | 418 | "Setup completion vars for `shell-mode' and `read-shell-command'." |
| 412 | (set (make-local-variable 'comint-completion-fignore) | 419 | (set (make-local-variable 'comint-completion-fignore) |
| @@ -428,6 +435,8 @@ Thus, this does not include the shell's current directory.") | |||
| 428 | comint-completion-addsuffix) | 435 | comint-completion-addsuffix) |
| 429 | ((not (consp comint-completion-addsuffix)) " ") | 436 | ((not (consp comint-completion-addsuffix)) " ") |
| 430 | (t (cdr comint-completion-addsuffix)))) | 437 | (t (cdr comint-completion-addsuffix)))) |
| 438 | (set (make-local-variable 'pcomplete-command-completion-function) | ||
| 439 | #'shell-command-completion-function) | ||
| 431 | ;; Don't use pcomplete's defaulting mechanism, rely on | 440 | ;; Don't use pcomplete's defaulting mechanism, rely on |
| 432 | ;; shell-dynamic-complete-functions instead. | 441 | ;; shell-dynamic-complete-functions instead. |
| 433 | (set (make-local-variable 'pcomplete-default-completion-function) #'ignore) | 442 | (set (make-local-variable 'pcomplete-default-completion-function) #'ignore) |