all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* pcomplete makes assumptions about its interactive entry points
@ 2013-09-05 16:17 Vivek Dasmohapatra
  2013-09-13  1:44 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Vivek Dasmohapatra @ 2013-09-05 16:17 UTC (permalink / raw)
  To: emacs-devel

[-- 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)

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

end of thread, other threads:[~2013-09-13  1:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-05 16:17 pcomplete makes assumptions about its interactive entry points Vivek Dasmohapatra
2013-09-13  1:44 ` Stefan Monnier
2013-09-13  1:52   ` Vivek Dasmohapatra

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.