Subject: bug#15362: 24.1; pcomplete unnecessarily restricts tab-completion entry points

From: Vivek Dasmohapatra <[email-masked]>
Date: Fri, 13 Sep 2013 13:29:13 +0100 (BST)

> So if cycling is to take place, it should presumably not be done by
> pcomplete but by completion-at-point (e.g. obeying
> completion-cycle-threshold).
>
> IOW, I don't understand how your patch can fix your problem.
> Can you provide a reproducible recipe starting from "emacs -Q"?

   emacs -Q

   customise the erc group, make sure erc-pcomplete is on (it
   should be)

   customise erc-complete-functions, add erc-pcomplete to
   the head of that list

   M-x erc RET … ; connect to freenode, enter #emacs

   j TAB ; big list of nicks beginning with jpops up

   l TAB ; unconditionally completes to whichever jl… nick
         ; was at the head of the list.

Analaysis:

   TAB                           → completion-at-point
   completion-at-point           → completion-at-point-functions
   completion-at-point-functions → erc-complete-word-at-point
   erc-complete-word-at-point    →
       (run-hook-with-args-until-success 'erc-complete-functions)
   erc-complete-functions        → erc-pcomplete
   erc-pcomplete                 → (call-interactively 'pcomplete)
   pcomplete                     →
       (memq last-command '(pcomplete
                            pcomplete-expand-and-complete
                            pcomplete-reverse)

   The above test controls entry into the cycling code.