all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vivek Dasmohapatra <vivek@etla.org>
To: emacs-devel@gnu.org
Subject: pcomplete makes assumptions about its interactive entry points
Date: Thu, 5 Sep 2013 17:17:33 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1309051716270.21225@octopus.pepperfish.net> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 481 bytes --]

Forwarded at author's request

---------- Forwarded message ----------
Date: Tue, 3 Sep 2013 01:35:06 +0100 (BST)
From: Vivek Dasmohapatra <vivek@etla.org>
To: John Wiegley <johnw@gnu.org>
Subject: pcomplete

Hi - pcomplete makes an assumption (I think) about the interactive
entry point(s) which can be used to drive it which means that non-
native entry points don't get completion cycling.

Attached is a possible fix plus the alteration required
to make erc completion use it.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/X-DIFF; NAME=pcomplete-entry-points.patch, Size: 2136 bytes --]

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 01efd83..3917638 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -3964,7 +3964,9 @@ This places `point' just after the prompt, or at the beginning of the line."
     (kill-line)))
 
 (defun erc-complete-word-at-point ()
-  (run-hook-with-args-until-success 'erc-complete-functions))
+  (let ((pcomplete-extra-entry-points
+	 (cons 'completion-at-point pcomplete-extra-entry-points)))
+  (run-hook-with-args-until-success 'erc-complete-functions)))
 
 (define-obsolete-function-alias 'erc-complete-word 'completion-at-point "24.1")
 
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 957505f..30a743b 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -471,6 +471,15 @@ Same as `pcomplete' but using the standard completion UI."
                           (plist-get :predicate (nthcdr 3 data)))))
 
 ;;; Pcomplete's native UI.
+(defvar pcomplete-extra-entry-points nil
+  "When an non-native command is driving `pcomplete', that command's
+symbol must be placed in this variable while `pcomplete' is invoked
+in order to allow completion cycling to occur.\n
+For example:\n
+  When completing ab → aba abc abd able via `completion-at-point',\n
+which [may] delegate to `pcomplete' via `completion-at-point-functions',
+the functions in that list should bind this variable to include the
+symbol 'completion-at-point.")
 
 ;;;###autoload
 (defun pcomplete (&optional interactively)
@@ -481,9 +490,10 @@ completion functions list (it should occur fairly early in the list)."
   (if (and interactively
 	   pcomplete-cycle-completions
 	   pcomplete-current-completions
-	   (memq last-command '(pcomplete
-				pcomplete-expand-and-complete
-				pcomplete-reverse)))
+           (or (memq last-command '(pcomplete
+                                    pcomplete-expand-and-complete
+                                    pcomplete-reverse))
+               (memq last-command pcomplete-extra-entry-points)))
       (progn
 	(delete-char (- pcomplete-last-completion-length))
 	(if (eq this-command 'pcomplete-reverse)

             reply	other threads:[~2013-09-05 16:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 16:17 Vivek Dasmohapatra [this message]
2013-09-13  1:44 ` pcomplete makes assumptions about its interactive entry points Stefan Monnier
2013-09-13  1:52   ` Vivek Dasmohapatra

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=alpine.DEB.2.00.1309051716270.21225@octopus.pepperfish.net \
    --to=vivek@etla.org \
    --cc=emacs-devel@gnu.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.