From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 9923@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#9923: 24.0.91; `where-is' does not find recentf menu items (cmds, not files)
Date: Sun, 05 Dec 2021 20:04:28 +0200 [thread overview]
Message-ID: <8635n753o3.fsf@mail.linkov.net> (raw)
In-Reply-To: <87czpwb4gw.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 29 Aug 2021 19:48:15 +0300")
[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]
> but now noticed that after typing 'C-h m' it fails with:
>
> Debugger entered--Lisp error: (args-out-of-range 1786)
> mouse-posn-property((#<window 178 on *scratch*> 1786 (0 . 0) 0) context-menu-function)
> context-menu-map()
> (lambda (_) (context-menu-map))(ignore)
> where-is-internal(ignore nil t)
> #f(compiled-function (sym) #<bytecode -0x1145d1e4eb4c2a6>)(ignore)
> help-fns--list-local-commands()
> describe-mode()
> funcall-interactively(describe-mode)
> command-execute(describe-mode)
This bug still exists in emacs-28:
emacs-28 -Q
1. context-menu-mode
2. C-h C-n M->
3. C-h m
Debugger entered--Lisp error: (args-out-of-range #<buffer *Help*> 1 37446)
parse-partial-sexp(1 37446)
syntax-ppss(37446)
context-menu-region((keymap #("Context Menu" 0 12 (hide t)) (separator-undo "--") (separator-region "--")) 109)
#f(compiled-function (fun) #<bytecode -0x1ee96643fef4b180>)(context-menu-region)
run-hook-wrapped(#f(compiled-function (fun) #<bytecode -0x1ee96643fef4b180>) context-menu-region)
context-menu-map()
(lambda (_) (context-menu-map))(ignore)
where-is-internal(ignore nil t)
#f(compiled-function (sym) #<bytecode -0x1403be359693d56a>)(ignore)
help-fns--list-local-commands()
describe-mode()
funcall-interactively(describe-mode)
call-interactively(describe-mode nil nil)
command-execute(describe-mode)
I don't know if this is the right fix, but it avoids
the error by explicitly switching to window-buffer
when context-menu is called by describe-mode:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: describe-mode-window-buffer.patch --]
[-- Type: text/x-diff, Size: 2090 bytes --]
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 30fe5e99ff..851da77ce0 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -488,14 +488,15 @@ context-menu-region
`(menu-item "All"
,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer))
:help "Mark the whole buffer for a subsequent cut/copy"))
- (when (let* ((pos (posn-point (event-end click)))
- (char (when pos (char-after pos))))
- (or (and char (eq (char-syntax char) ?\"))
- (nth 3 (save-excursion (syntax-ppss pos)))))
- (define-key-after submenu [mark-string]
- `(menu-item "String"
- ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'string))
- :help "Mark the string at click for a subsequent cut/copy")))
+ (with-current-buffer (window-buffer)
+ (when (let* ((pos (posn-point (event-end click)))
+ (char (when pos (char-after pos))))
+ (or (and char (eq (char-syntax char) ?\"))
+ (nth 3 (save-excursion (syntax-ppss pos)))))
+ (define-key-after submenu [mark-string]
+ `(menu-item "String"
+ ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'string))
+ :help "Mark the string at click for a subsequent cut/copy"))))
(define-key-after submenu [mark-line]
`(menu-item "Line"
,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line))
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 30b6edf0d9..bf1f619858 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -93,7 +93,9 @@ prog-context-menu
'mark-whole-buffer)
;; Include text-mode select menu only in strings and comments.
- (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click)))))
+ (when (nth 8 (save-excursion
+ (with-current-buffer (window-buffer)
+ (syntax-ppss (posn-point (event-end click))))))
(text-mode-context-menu menu click))
menu)
[-- Attachment #3: Type: text/plain, Size: 55 bytes --]
An alternative is the patch that I proposed earlier:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: help-fns--list-local-commands-ignore.patch --]
[-- Type: text/x-diff, Size: 475 bytes --]
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 2c7956d968..85f305617d 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1898,6 +1898,8 @@ help-fns--list-local-commands
(mapatoms
(lambda (sym)
(when (and (commandp sym)
+ ;; Ignore 'ignore'.
+ (not (eq sym 'ignore))
;; Ignore aliases.
(not (symbolp (symbol-function sym)))
;; Ignore everything bound.
next prev parent reply other threads:[~2021-12-05 18:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-31 20:26 bug#9923: 24.0.91; `where-is' does not find recentf menu items (cmds, not files) Drew Adams
2011-11-01 16:05 ` Stefan Monnier
2012-09-17 0:25 ` Drew Adams
2021-08-25 12:18 ` Lars Ingebrigtsen
2021-08-25 14:49 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-26 13:42 ` Lars Ingebrigtsen
2021-08-26 17:44 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-29 16:48 ` Juri Linkov
2021-08-29 18:46 ` Lars Ingebrigtsen
2021-08-30 7:33 ` Juri Linkov
2021-08-31 0:03 ` Lars Ingebrigtsen
2021-08-31 6:41 ` Juri Linkov
2021-08-31 8:36 ` Lars Ingebrigtsen
2021-08-31 18:44 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-30 6:55 ` Juri Linkov
2021-09-30 12:43 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-03 17:54 ` Juri Linkov
2021-10-03 18:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-03 18:53 ` Juri Linkov
2021-10-03 19:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-05 18:04 ` Juri Linkov [this message]
2021-12-05 20:48 ` Lars Ingebrigtsen
2021-12-05 23:13 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-06 9:28 ` Juri Linkov
2021-12-06 13:50 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-06 17:24 ` Juri Linkov
2021-12-06 19:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-08 20:32 ` Juri Linkov
2022-12-15 18:28 ` Juri Linkov
2022-12-15 18:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-15 18:51 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8635n753o3.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=9923@debbugs.gnu.org \
--cc=larsi@gnus.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.