Subject: Re: bug#52389: 29.0.50; Imenu does not pop up the Completions eagerly

From: Protesilaos Stavrou <[email-masked]>
Date: Fri, 17 Dec 2021 13:57:52 +0200

On 2021-12-13, 10:53 +0200, Juri Linkov <[email-masked]> wrote:

>> Regarding this bug report, I am not sure what the status is.  Should I
>> rewrite the patch to specify a define-obsolete-variable-alias instead?
>> Or is someone else taking care of it?
>
> It seems everyone agrees here it would be preferable to
> rewrite the patch using define-obsolete-variable-alias.

Please find attached the patch that implements the new user option.  I
did not include a NEWS entry as things should work the way they did
before.

The combined use of "not" and "no" concepts in this case feels awkward.
I prefer my original approach of changing the logic, though I understand
it would be backward-incompatible.

-- 
Protesilaos Stavrou
https://protesilaos.com
>From 2487aaba2f531563e1acc0979a738ade7bb322f2 Mon Sep 17 00:00:00 2001
Message-Id: <[email-masked]>
From: Protesilaos Stavrou <[email-masked]>
Date: Fri, 17 Dec 2021 13:46:29 +0200
Subject: [PATCH] Deprecate Imenu option for eager completion buffer

The now-deprecated user option had confusing language as it produced
the opposite effect of what it meant.  Read bug#52389.

* imenu.el (imenu-eager-completion-buffer): Remove old user option.
(imenu-no-eager-completion-buffer): Write alias for the deprecated
user option.
(imenu--completion-buffer): Check for the new variable.
---
 lisp/imenu.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/imenu.el b/lisp/imenu.el
index 22412d5f88..86f7d2d3ff 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -99,10 +99,15 @@ (defcustom imenu-use-popup-menu 'on-mouse
 		 (const :tag "Never" nil)
                  (other :tag "Always" t)))
 
-(defcustom imenu-eager-completion-buffer t
-  "If non-nil, eagerly popup the completion buffer."
+(define-obsolete-variable-alias
+  'imenu-eager-completion-buffer
+  'imenu-no-eager-completion-buffer
+  "29.1")
+
+(defcustom imenu-no-eager-completion-buffer t
+  "If non-nil, do not eagerly popup the completion buffer."
   :type 'boolean
-  :version "22.1")
+  :version "29.1")
 
 (defcustom imenu-after-jump-hook nil
   "Hooks called after jumping to a place in the buffer.
@@ -727,7 +732,7 @@ (defun imenu--completion-buffer (index-alist &optional prompt)
                          name))))
     (let ((minibuffer-setup-hook minibuffer-setup-hook))
       ;; Display the completion buffer.
-      (if (not imenu-eager-completion-buffer)
+      (if (not imenu-no-eager-completion-buffer)
 	  (add-hook 'minibuffer-setup-hook 'minibuffer-completion-help))
       (setq name (completing-read prompt
 				  prepared-index-alist
-- 
2.34.1