all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Colin Walters <walters@verbum.org>
Subject: using pcomplete for comint.el/shell.el
Date: 14 Feb 2002 18:50:09 -0500	[thread overview]
Message-ID: <1013730609.754.60.camel@space-ghost> (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.

             reply	other threads:[~2002-02-14 23:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-14 23:50 Colin Walters [this message]
2002-02-15 22:49 ` using pcomplete for comint.el/shell.el 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

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=1013730609.754.60.camel@space-ghost \
    --to=walters@verbum.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.