[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using pcomplete for comint.el/shell.el
From: |
Stefan Monnier |
Subject: |
Re: using pcomplete for comint.el/shell.el |
Date: |
Fri, 15 Feb 2002 17:49:37 -0500 |
> One of the design goals was to avoid loading pcomplete unless the user
> actually used the completion facilities. So this made things a little
> bit tricky. I've attached the patch to shell.el to implement this.
> Other modes will have to do something very similar.
>
> Or would it be better if we just unconditionally required pcomplete.el
> for shell.el?
>
> After this is implemented, we can just remove a lot of cruft in
> comint.el.
Sounds good. On a related note, I really would like it if we could
make a `read-shell-command' that provides pcomplete completion for
things like M-! and friends.
> Also, one issue to consider is that this will break backwards
> compatibility with modes deriving from comint.
Could you expand on that ? What kind of breakage ?
Can it be avoided ?
Stefan
PS: I currently use the following quick-and-ugly hack for `shell-command':
--- simple.el 6 Feb 2002 15:08:45 -0000 1.520
+++ simple.el 15 Feb 2002 22:47:39 -0000
@@ -1135,6 +1152,20 @@
is run interactively. A value of nil means that output to stderr and
stdout will be intermixed in the output stream.")
+(defun minibuffer-shell-complete ()
+ "Complete current minibuffer input as a shell command."
+ (interactive)
+ (require 'shell)
+ (pcomplete-shell-setup)
+ (let ((comint-dynamic-complete-functions shell-dynamic-complete-functions))
+ (call-interactively 'comint-dynamic-complete)))
+
+(defvar minibuffer-local-shell-completion-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map minibuffer-local-map)
+ (define-key map "\t" 'minibuffer-shell-complete)
+ map))
+
(defun shell-command (command &optional output-buffer error-buffer)
"Execute string COMMAND in inferior shell; display output, if any.
With prefix argument, insert the COMMAND's output at point.
@@ -1186,7 +1217,7 @@
specifies the value of ERROR-BUFFER."
(interactive (list (read-from-minibuffer "Shell command: "
- nil nil nil 'shell-command-history)
+ nil
minibuffer-local-shell-completion-map nil 'shell-command-history)
current-prefix-arg
shell-command-default-error-buffer))
;; Look for a handler in case default-directory is a remote file name.
@@ -1399,8 +1430,9 @@
;; Do this before calling region-beginning
;; and region-end, in case subprocess output
;; relocates them while we are in the minibuffer.
- (setq string (read-from-minibuffer "Shell command on region: "
- nil nil nil
+ (setq string (read-from-minibuffer
+ "Shell command on region: "
+ nil minibuffer-local-shell-completion-map nil
'shell-command-history))
;; call-interactively recognizes region-beginning and
;; region-end specially, leaving them in the history.
- using pcomplete for comint.el/shell.el, Colin Walters, 2002/02/14
- Re: using pcomplete for comint.el/shell.el,
Stefan Monnier <=
- Re: using pcomplete for comint.el/shell.el, Richard Stallman, 2002/02/16
- Re: using pcomplete for comint.el/shell.el, Colin Walters, 2002/02/16
- Re: using pcomplete for comint.el/shell.el, Richard Stallman, 2002/02/17
- Re: using pcomplete for comint.el/shell.el, John Wiegley, 2002/02/18
- Re: using pcomplete for comint.el/shell.el, Colin Walters, 2002/02/18
- Re: using pcomplete for comint.el/shell.el, John Wiegley, 2002/02/18
- Re: using pcomplete for comint.el/shell.el, Richard Stallman, 2002/02/19