From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <8635n753o3.fsf@mail.linkov.net> References: <76FA3F83D086455EAA01FF0FB000FCDB@us.oracle.com> <871r6hk99k.fsf@gnus.org> <87bl5k2ug1.fsf@gnus.org> <87czpwb4gw.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36289"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 9923@debbugs.gnu.org, Stefan Monnier To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 05 19:10:43 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mtvyE-0009Ft-Nl for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Dec 2021 19:10:42 +0100 Original-Received: from localhost ([::1]:40546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtvyD-0003qi-Iv for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Dec 2021 13:10:41 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtvxa-0003oE-UU for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 13:10:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mtvxa-0006Kq-LG for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 13:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mtvxa-0000eP-Gx for bug-gnu-emacs@gnu.org; Sun, 05 Dec 2021 13:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Dec 2021 18:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9923 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 9923-submit@debbugs.gnu.org id=B9923.16387277592417 (code B ref 9923); Sun, 05 Dec 2021 18:10:02 +0000 Original-Received: (at 9923) by debbugs.gnu.org; 5 Dec 2021 18:09:19 +0000 Original-Received: from localhost ([127.0.0.1]:59365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtvws-0000cu-Nu for submit@debbugs.gnu.org; Sun, 05 Dec 2021 13:09:19 -0500 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:41481) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtvwr-0000am-2G for 9923@debbugs.gnu.org; Sun, 05 Dec 2021 13:09:17 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id E32DC20003; Sun, 5 Dec 2021 18:09:09 +0000 (UTC) In-Reply-To: <87czpwb4gw.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 29 Aug 2021 19:48:15 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221620 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit > but now noticed that after typing 'C-h m' it fails with: > > Debugger entered--Lisp error: (args-out-of-range 1786) > mouse-posn-property((# 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) #)(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 # 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) #)(context-menu-region) run-hook-wrapped(#f(compiled-function (fun) #) context-menu-region) context-menu-map() (lambda (_) (context-menu-map))(ignore) where-is-internal(ignore nil t) #f(compiled-function (sym) #)(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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=describe-mode-window-buffer.patch 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) --=-=-= Content-Type: text/plain An alternative is the patch that I proposed earlier: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=help-fns--list-local-commands-ignore.patch 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. --=-=-=--