From: "Stefan Monnier" <monnier+gnu/emacs@RUM.cs.yale.edu>
Cc: emacs-devel@gnu.org
Subject: Re: using pcomplete for comint.el/shell.el
Date: Fri, 15 Feb 2002 17:49:37 -0500 [thread overview]
Message-ID: <200202152249.g1FMnbU25659@rum.cs.yale.edu> (raw)
In-Reply-To: 1013730609.754.60.camel@space-ghost
> 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.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2002-02-15 22:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-14 23:50 using pcomplete for comint.el/shell.el Colin Walters
2002-02-15 22:49 ` Stefan Monnier [this message]
2002-02-16 1:26 ` Colin Walters
2002-02-16 8:03 ` Eli Zaretskii
2002-02-17 16:48 ` Richard Stallman
2002-02-16 21:55 ` Richard Stallman
2002-02-17 0:43 ` Colin Walters
2002-02-17 22:49 ` Richard Stallman
2002-02-18 21:30 ` John Wiegley
2002-02-18 21:55 ` Colin Walters
2002-02-18 22:21 ` John Wiegley
2002-02-19 21:31 ` Richard Stallman
2002-02-23 21:39 ` Colin Walters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200202152249.g1FMnbU25659@rum.cs.yale.edu \
--to=monnier+gnu/emacs@rum.cs.yale.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.