unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* using pcomplete for comint.el/shell.el
@ 2002-02-14 23:50 Colin Walters
  2002-02-15 22:49 ` Stefan Monnier
  2002-02-16 21:55 ` Richard Stallman
  0 siblings, 2 replies; 13+ messages in thread
From: Colin Walters @ 2002-02-14 23:50 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

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.




[-- Attachment #2: shell.diff --]
[-- Type: text/plain, Size: 1956 bytes --]

--- 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 ";&|")))))
 
+(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))
 
 (defun shell-dynamic-complete-command ()
   "Dynamically complete the command at point.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2002-02-23 21:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-14 23:50 using pcomplete for comint.el/shell.el Colin Walters
2002-02-15 22:49 ` Stefan Monnier
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).