unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Colin Walters <walters@verbum.org>
Subject: Re: using pcomplete for comint.el/shell.el
Date: 16 Feb 2002 19:43:26 -0500	[thread overview]
Message-ID: <1013906606.32274.59.camel@space-ghost> (raw)
In-Reply-To: <200202162155.g1GLtP209864@aztec.santafe.edu>

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

On Sat, 2002-02-16 at 16:55, Richard Stallman wrote:

> It should not redefine itself, that is confusing.  It should just call
> pcomplete every time.

Hm.  I don't find it particularly confusing, but I guess it maybe does
try to be a bit too efficient at the expense of comprehensibility.  

How about this version?



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

--- shell.el.~1.105.~	Mon Dec  3 12:24:41 2001
+++ shell.el	Sat Feb 16 19:31:54 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,22 @@
 	(progn (goto-char (match-beginning 1))
 	       (skip-chars-forward ";&|")))))
 
+(defvar shell-pcomplete-setup-p nil)
+(defun shell-pcomplete ()
+  "Invoke `pcomplete', after ensuring this buffer is set up for it."
+  (interactive)
+  (unless (prog1 shell-pcomplete-setup-p
+	    (setq shell-pcomplete-setup-p t))
+    (pcomplete-comint-setup 'shell-dynamic-complete-functions))
+  (call-interactively #'pcomplete))
+
+(defun shell-pcomplete-reverse ()
+  "Invoke `pcomplete-reverse', after ensuring this buffer is set up for it."
+  (interactive)
+  (unless (prog1 shell-pcomplete-setup-p
+	    (setq shell-pcomplete-setup-p t))
+    (pcomplete-comint-setup 'shell-dynamic-complete-functions))
+  (call-interactively #'pcomplete-reverse))
 
 (defun shell-dynamic-complete-command ()
   "Dynamically complete the command at point.

  reply	other threads:[~2002-02-17  0:43 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1013906606.32274.59.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 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).