comparison lisp/shell.el @ 43491:8d50d4fa8c4b

(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.
author Colin Walters <walters@gnu.org>
date Sat, 23 Feb 2002 21:34:11 +0000
parents ca6dfcb53a03
children c61a65062ae1
comparison
equal deleted inserted replaced
43490:a08f4763cba4 43491:8d50d4fa8c4b
308 (defvar shell-mode-map nil) 308 (defvar shell-mode-map nil)
309 (cond ((not shell-mode-map) 309 (cond ((not shell-mode-map)
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]
317 (copy-keymap (lookup-key comint-mode-map [menu-bar completion]))) 318 (copy-keymap (lookup-key comint-mode-map [menu-bar completion])))
318 (define-key-after (lookup-key shell-mode-map [menu-bar completion]) 319 (define-key-after (lookup-key shell-mode-map [menu-bar completion])
394 (setq comint-prompt-regexp shell-prompt-pattern) 395 (setq comint-prompt-regexp shell-prompt-pattern)
395 (setq comint-completion-fignore shell-completion-fignore) 396 (setq comint-completion-fignore shell-completion-fignore)
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)
403 (setq font-lock-defaults '(shell-font-lock-keywords t)) 403 (setq font-lock-defaults '(shell-font-lock-keywords t))
404 (make-local-variable 'shell-dirstack) 404 (make-local-variable 'shell-dirstack)
855 (if (re-search-backward 855 (if (re-search-backward
856 (format "[;&|]+[\t ]*\\(%s\\)" shell-command-regexp) limit 'move arg) 856 (format "[;&|]+[\t ]*\\(%s\\)" shell-command-regexp) limit 'move arg)
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.
863 This function is similar to `comint-dynamic-complete-filename', except that it 886 This function is similar to `comint-dynamic-complete-filename', except that it
864 searches `exec-path' (minus the trailing emacs library path) for completion 887 searches `exec-path' (minus the trailing emacs library path) for completion