bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51173: 28.0.60; gnus-article-describe-key doesn't work


From: Juri Linkov
Subject: bug#51173: 28.0.60; gnus-article-describe-key doesn't work
Date: Mon, 29 Nov 2021 20:49:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>>>>>> OTOH we should probably try and change the `key` arg to use the new
>>>>>> key-list format expected by `describe-key` (i.e. a list of (SEQ
>>>>>> . RAW-SEQ) pairs).
>>>>>
>>>>> `gnus-article-describe-key` just passes down the value
>>>>> that `read-key-sequence` returns.
>>>>
>>>> I know.  This is the old calling convention of `describe-key`; we
>>>> should move to the new one.
>>>
>>> Is seems everything is covered by this patch:
>>
>> So this is pushed now.
>
> Thanks, and sorry I didn't get to it earlier.  FWIW, it does look good,

Oh, another regression:

 C-s                 ;; isearch-forward
 C-h k               ;; isearch-describe-key

then typing any key to describe in isearch-mode
leaves isearch in a broken state: it displays the
search prompt, but no isearch indicator on the mode-line.
So something exits isearch.  Adding a breakpoint
in isearch-done reveals this backtrace:

  isearch-done()
  isearch-mouse-leave-buffer()
  mouse-minibuffer-check(19)
  mouse-set-point(19)
  help--analyze-key("\23" [19] nil)
  describe-key((("\23" . [19])))
  funcall-interactively(describe-key (("\23" . [19])))
  isearch-describe-key()
  funcall-interactively(isearch-describe-key)
  command-execute(isearch-describe-key)

I don't know if more functions using describe-key are broken,
but copying the same code from gnus-article-describe-key
that gives the buffer argument to describe-key fixes this.
I have no idea for a better way to avoid such problems.

More precautions are added to this patch:
when isearch-mouse-commands contains isearch-describe-key,
isearch-mouse-leave-buffer won't leave isearch-mode.

Also to avoid a broken state, isearch-update
should be used only when isearch-mode is active:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 0a041b7a1e..043d2c016e 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -525,15 +525,17 @@ isearch-describe-key
   "Display documentation of the function invoked by isearch key."
   (interactive)
   (let ((display-buffer-overriding-action isearch--display-help-action))
-    (call-interactively 'describe-key))
-  (isearch-update))
+    (describe-key (list (cons (read-key-sequence nil t)
+                              (this-single-command-raw-keys)))
+                  (current-buffer)))
+  (when isearch-mode (isearch-update)))
 
 (defun isearch-describe-mode ()
   "Display documentation of Isearch mode."
   (interactive)
   (let ((display-buffer-overriding-action isearch--display-help-action))
     (describe-function 'isearch-forward))
-  (isearch-update))
+  (when isearch-mode (isearch-update)))
 
 (defalias 'isearch-mode-help 'isearch-describe-mode)
 
@@ -1498,7 +1500,7 @@ isearch-done
 
   (and (not edit) isearch-recursive-edit (exit-recursive-edit)))
 
-(defvar isearch-mouse-commands '(mouse-minor-mode-menu)
+(defvar isearch-mouse-commands '(mouse-minor-mode-menu isearch-describe-key)
   "List of mouse commands that are allowed during Isearch.")
 
 (defun isearch-mouse-leave-buffer ()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]