From mboxrd@z Thu Jan 1 00:00:00 1970 Path: quimby.gnus.org!not-for-mail From: Colin Walters Newsgroups: gmane.emacs.devel Subject: using pcomplete for comint.el/shell.el Date: 14 Feb 2002 18:50:09 -0500 Message-ID: <1013730609.754.60.camel@space-ghost> NNTP-Posting-Host: quimby2.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-rDMe+lAOvDQ+zROiN3TN" X-Trace: quimby2.netfonds.no 1013732102 3724 195.204.10.66 (15 Feb 2002 00:15:02 GMT) X-Complaints-To: usenet@quimby2.netfonds.no NNTP-Posting-Date: 15 Feb 2002 00:15:02 GMT Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby2.netfonds.no with esmtp (Exim 3.12 #1 (Debian)) id 16bW1l-0000xy-00 for ; Fri, 15 Feb 2002 01:15:02 +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 16bVqH-0002eJ-00; Thu, 14 Feb 2002 19:03:09 -0500 Original-Received: from monk.debian.net ([216.185.54.61] helo=monk.verbum.org) by fencepost.gnu.org with smtp (Exim 3.33 #1 (Debian)) id 16bVo3-0002W9-00 for ; Thu, 14 Feb 2002 19:00:51 -0500 Original-Received: from space-ghost.verbum.private (freedom.cis.ohio-state.edu [164.107.60.183]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (Client CN "space-ghost.verbum.org", Issuer CN "monk.verbum.org" (verified OK)) by monk.verbum.org (Postfix (Debian/GNU)) with ESMTP id 6278274004BC for ; Thu, 14 Feb 2002 19:00:35 -0500 (EST) Original-Received: by space-ghost.verbum.private (Postfix (Debian/GNU), from userid 1000) id F0672806AFB; Thu, 14 Feb 2002 18:50:10 -0500 (EST) Original-To: emacs-devel@gnu.org X-Mailer: Evolution/1.0 (Preview Release) 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:1152 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:1152 --=-rDMe+lAOvDQ+zROiN3TN Content-Type: text/plain Content-Transfer-Encoding: 7bit John Weigley has been having trouble with getting papers signed for his general Emacs contributions, so he asked me to finish the last bit of work needed to get shell.el to use pcomplete.el. 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. Also, one issue to consider is that this will break backwards compatibility with modes deriving from comint. --=-rDMe+lAOvDQ+zROiN3TN Content-Disposition: attachment; filename=shell.diff Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1 --- shell.el.~1.105.~ Mon Dec 3 12:24:41 2001 +++ shell.el Thu Feb 14 18:49:01 2002 @@ -310,7 +310,8 @@ (setq shell-mode-map (nconc (make-sparse-keymap) comint-mode-map)) (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command) (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command) - (define-key shell-mode-map "\t" 'comint-dynamic-complete) + (define-key shell-mode-map "\t" 'shell-pcomplete) + (define-key shell-mode-map "\M-\t" 'shell-pcomplete-reverse) (define-key shell-mode-map "\M-?" 'comint-dynamic-list-filename-completions) (define-key shell-mode-map [menu-bar completion] @@ -396,7 +397,6 @@ (setq comint-delimiter-argument-list shell-delimiter-argument-list) (setq comint-file-name-chars shell-file-name-chars) (setq comint-file-name-quote-list shell-file-name-quote-list) - (setq comint-dynamic-complete-functions shell-dynamic-complete-functions= ) (make-local-variable 'paragraph-start) (setq paragraph-start comint-prompt-regexp) (make-local-variable 'font-lock-defaults) @@ -857,6 +857,23 @@ (progn (goto-char (match-beginning 1)) (skip-chars-forward ";&|"))))) =20 +(defun shell-pcomplete () + "Proxy function which sets up comint for pcomplete. +See `pcomplete'." + (interactive) + (pcomplete-comint-setup 'shell-dynamic-complete-functions) + (fset 'shell-pcomplete 'pcomplete) + (fset 'shell-pcomplete-reverse 'pcomplete-reverse) + (call-interactively #'pcomplete)) + +(defun shell-pcomplete-reverse () + "Proxy function which sets up comint for pcomplete. +See `pcomplete'." + (interactive) + (pcomplete-comint-setup 'shell-dynamic-complete-functions) + (fset 'shell-pcomplete 'pcomplete) + (fset 'shell-pcomplete-reverse 'pcomplete-reverse) + (call-interactively #'pcomplete-reverse)) =20 (defun shell-dynamic-complete-command () "Dynamically complete the command at point. --=-rDMe+lAOvDQ+zROiN3TN-- _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel