diff options
| author | Colin Walters | 2002-02-23 21:34:11 +0000 |
|---|---|---|
| committer | Colin Walters | 2002-02-23 21:34:11 +0000 |
| commit | d9c62d8f6cbb433f2db6bba97d5b56cf5e6a1d1f (patch) | |
| tree | 519a2978b806aa56dd54f8356d07fafe61f1f1bc /lisp/shell.el | |
| parent | 2c1bb3d3385aaee8c4cc205e4b4128be792af620 (diff) | |
| download | emacs-d9c62d8f6cbb433f2db6bba97d5b56cf5e6a1d1f.tar.gz emacs-d9c62d8f6cbb433f2db6bba97d5b56cf5e6a1d1f.zip | |
(shell-pcomplete, shell-pcomplete-reverse): New functions.
(toplevel): Bind them.
(shell-mode): Don't set `comint-dynamic-complete-functions'; it is
not necessary now that we use pcomplete.
Diffstat (limited to 'lisp/shell.el')
| -rw-r--r-- | lisp/shell.el | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index 0a4119f0f8d..f273540996b 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -310,7 +310,8 @@ Thus, this does not include the shell's current directory.") | |||
| 310 | (setq shell-mode-map (nconc (make-sparse-keymap) comint-mode-map)) | 310 | (setq shell-mode-map (nconc (make-sparse-keymap) comint-mode-map)) |
| 311 | (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command) | 311 | (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command) |
| 312 | (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command) | 312 | (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command) |
| 313 | (define-key shell-mode-map "\t" 'comint-dynamic-complete) | 313 | (define-key shell-mode-map "\t" 'shell-pcomplete) |
| 314 | (define-key shell-mode-map "\M-\t" 'shell-pcomplete-reverse) | ||
| 314 | (define-key shell-mode-map "\M-?" | 315 | (define-key shell-mode-map "\M-?" |
| 315 | 'comint-dynamic-list-filename-completions) | 316 | 'comint-dynamic-list-filename-completions) |
| 316 | (define-key shell-mode-map [menu-bar completion] | 317 | (define-key shell-mode-map [menu-bar completion] |
| @@ -396,7 +397,6 @@ buffer." | |||
| 396 | (setq comint-delimiter-argument-list shell-delimiter-argument-list) | 397 | (setq comint-delimiter-argument-list shell-delimiter-argument-list) |
| 397 | (setq comint-file-name-chars shell-file-name-chars) | 398 | (setq comint-file-name-chars shell-file-name-chars) |
| 398 | (setq comint-file-name-quote-list shell-file-name-quote-list) | 399 | (setq comint-file-name-quote-list shell-file-name-quote-list) |
| 399 | (setq comint-dynamic-complete-functions shell-dynamic-complete-functions) | ||
| 400 | (make-local-variable 'paragraph-start) | 400 | (make-local-variable 'paragraph-start) |
| 401 | (setq paragraph-start comint-prompt-regexp) | 401 | (setq paragraph-start comint-prompt-regexp) |
| 402 | (make-local-variable 'font-lock-defaults) | 402 | (make-local-variable 'font-lock-defaults) |
| @@ -857,6 +857,29 @@ See `shell-command-regexp'." | |||
| 857 | (progn (goto-char (match-beginning 1)) | 857 | (progn (goto-char (match-beginning 1)) |
| 858 | (skip-chars-forward ";&|"))))) | 858 | (skip-chars-forward ";&|"))))) |
| 859 | 859 | ||
| 860 | (defun shell-pcomplete () | ||
| 861 | "Cycle forwards through completions at point, using `pcomplete'. | ||
| 862 | This function merely invokes `pcomplete', after ensuring this buffer | ||
| 863 | is set up for it." | ||
| 864 | (interactive) | ||
| 865 | (unless (prog1 shell-pcomplete-setup-p | ||
| 866 | (setq shell-pcomplete-setup-p t)) | ||
| 867 | (pcomplete-comint-setup 'shell-dynamic-complete-functions)) | ||
| 868 | ;; Convince pcomplete we are calling it directly | ||
| 869 | (setq this-command 'pcomplete) | ||
| 870 | (call-interactively #'pcomplete)) | ||
| 871 | |||
| 872 | (defun shell-pcomplete-reverse () | ||
| 873 | "Cycle backwards through completions at point, using `pcomplete'. | ||
| 874 | This function merely invokes `pcomplete-reverse', after ensuring this | ||
| 875 | buffer is set up for it." | ||
| 876 | (interactive) | ||
| 877 | (unless (prog1 shell-pcomplete-setup-p | ||
| 878 | (setq shell-pcomplete-setup-p t)) | ||
| 879 | (pcomplete-comint-setup 'shell-dynamic-complete-functions)) | ||
| 880 | ;; Convince pcomplete we are calling it directly | ||
| 881 | (setq this-command 'pcomplete-reverse) | ||
| 882 | (call-interactively #'pcomplete-reverse)) | ||
| 860 | 883 | ||
| 861 | (defun shell-dynamic-complete-command () | 884 | (defun shell-dynamic-complete-command () |
| 862 | "Dynamically complete the command at point. | 885 | "Dynamically complete the command at point. |