unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 51173@debbugs.gnu.org
Subject: bug#51173: 28.0.60; gnus-article-describe-key doesn't work
Date: Mon, 29 Nov 2021 20:49:12 +0200	[thread overview]
Message-ID: <86o862re53.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvk0i6cos9.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 21 Oct 2021 12:43:10 -0400")

[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]

>>>>>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: isearch-describe-key.patch --]
[-- Type: text/x-diff, Size: 1265 bytes --]

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	other threads:[~2021-11-29 18:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13  1:05 bug#51173: 28.0.60; gnus-article-describe-key doesn't work Katsumi Yamaoka
2021-10-13 11:59 ` Lars Ingebrigtsen
2021-10-13 16:33   ` Juri Linkov
2021-10-13 17:24     ` Juri Linkov
2021-10-13 18:49       ` Lars Ingebrigtsen
2021-10-13 19:18         ` Juri Linkov
2021-10-13 20:01       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-14 16:16         ` Juri Linkov
2021-10-14 18:41           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-15  6:49         ` Juri Linkov
2021-10-15 18:32           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-16 17:55             ` Juri Linkov
2021-10-16 19:53               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-18 16:20                 ` Juri Linkov
2021-10-20 17:55                   ` Juri Linkov
2021-10-21 16:43                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-29 18:49                       ` Juri Linkov [this message]
2021-11-29 20:57                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-30  3:26                           ` Eli Zaretskii
2021-11-30 13:06                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-30  8:54                           ` Juri Linkov
2021-12-01 17:36                             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86o862re53.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=51173@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).