From mboxrd@z Thu Jan 1 00:00:00 1970 Path: quimby.gnus.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: using pcomplete for comint.el/shell.el Date: Fri, 15 Feb 2002 17:49:37 -0500 Message-ID: <200202152249.g1FMnbU25659@rum.cs.yale.edu> References: <1013730609.754.60.camel@space-ghost> NNTP-Posting-Host: quimby2.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: quimby2.netfonds.no 1013814213 31891 195.204.10.66 (15 Feb 2002 23:03:33 GMT) X-Complaints-To: usenet@quimby2.netfonds.no NNTP-Posting-Date: 15 Feb 2002 23:03:33 GMT Cc: emacs-devel@gnu.org Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby2.netfonds.no with esmtp (Exim 3.12 #1 (Debian)) id 16brO8-0008IG-00 for ; Sat, 16 Feb 2002 00:03:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian)) id 16brCA-0000E9-00; Fri, 15 Feb 2002 17:51:10 -0500 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian)) id 16brAr-0000A6-00 for ; Fri, 15 Feb 2002 17:49:50 -0500 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g1FMnbU25659; Fri, 15 Feb 2002 17:49:37 -0500 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Colin Walters Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: quimby.gnus.org gmane.emacs.devel:1188 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:1188 > 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