Subject: Re: bug#34776: Acknowledgement (27.0.50; Some questions about choose-completion-string-functions)

From: Eric Abrahamsen <[email-masked]>
Date: Wed, 13 Mar 2019 09:51:11 -0700

On 03/08/19 21:07 PM, Glenn Morris wrote:
> Eric Abrahamsen wrote:
>
>> Actually it looks like I was wrong about using add-function with
>> choose-completion-string-functions, it's just a plain list you stick
>> functions into. I think it has to be an error not to declare it
>> buffer-local... I've worked around this with `make-local-variable', but
>> I'm halfway sure this should be a defvar-local...?
>
> The two uses in the Emacs code-base use add-hook without LOCAL.
> completing-read-multiple and ido-common-initialization.

You're right, I was misinterpreting the code and comments as saying the
functions should be buffer local, when it just meant they *could* be
buffer local. I'll use add-hook with LOCAL.

So never mind! But I'd still like to add something like the attached, as
functions following the current docstring will raise an error.

Eric

diff --git a/lisp/simple.el b/lisp/simple.el
index d4ae5ebb1f..0274bdb459 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -8188,6 +8188,9 @@ choose-completion-string-functions
 BUFFER - the buffer in which the choice should be inserted,
 BASE-POSITION - where to insert the completion.
 
+Functions should also accept and ignore a potential fourth
+argument, passed for backwards compatibility.
+
 If a function in the list returns non-nil, that function is supposed
 to have inserted the CHOICE in the BUFFER, and possibly exited
 the minibuffer; no further functions will be called.