From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#41781: 27.0.91; [PATCH] Eldoc describes the wrong function when reading an expression from the minibuffer Date: Sat, 20 Jun 2020 10:49:14 +0300 Message-ID: <83h7v6w51h.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="126454"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41781@debbugs.gnu.org To: Daniel Koning , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 20 09:50:10 2020 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 1jmYGQ-000Wno-PO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Jun 2020 09:50:10 +0200 Original-Received: from localhost ([::1]:44904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmYGP-0002ms-9u for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Jun 2020 03:50:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmYGI-0002mf-C3 for bug-gnu-emacs@gnu.org; Sat, 20 Jun 2020 03:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jmYGI-0002O4-33 for bug-gnu-emacs@gnu.org; Sat, 20 Jun 2020 03:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jmYGI-0005q2-1D for bug-gnu-emacs@gnu.org; Sat, 20 Jun 2020 03:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Jun 2020 07:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41781 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 41781-submit@debbugs.gnu.org id=B41781.159263938022411 (code B ref 41781); Sat, 20 Jun 2020 07:50:01 +0000 Original-Received: (at 41781) by debbugs.gnu.org; 20 Jun 2020 07:49:40 +0000 Original-Received: from localhost ([127.0.0.1]:57215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmYFw-0005pP-CE for submit@debbugs.gnu.org; Sat, 20 Jun 2020 03:49:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmYFl-0005p1-RC for 41781@debbugs.gnu.org; Sat, 20 Jun 2020 03:49:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36287) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmYFf-0002N3-M8; Sat, 20 Jun 2020 03:49:23 -0400 Original-Received: from [176.228.60.248] (port=2940 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jmYFe-0000uM-Og; Sat, 20 Jun 2020 03:49:23 -0400 In-Reply-To: (message from Daniel Koning on Tue, 09 Jun 2020 21:56:14 -0500) 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:182197 Archived-At: Stefan, any comments? > From: Daniel Koning > Date: Tue, 09 Jun 2020 21:56:14 -0500 > > The Eldoc message shows the documentation for the wrong function (or no > documentation at all) in this specific situation: > > (a) You're typing an elisp expression into `read-from-minibuffer', and > (b) the function name contains punctuation, such as ! or ?, whose > character class is "punctuation" and not "symbol" in the standard syntax > table. > > Function names as described in (b) are not only legal but quite common > in third-party code. There aren't many in the standard distribution, but > you'll notice a few here and there. Try this: > > (require 'pcvs) > (call-interactively #'eval-expression) > ----- > Eval: (cvs-mode! > ----- > > The mode line shows the documentation for `cvs-mode' (without the !), > which is a different function and has a different lambda list. > > This is happening because the syntax table in the minibuffer never gets > changed to the elisp table, which acknowledges all the valid symbol > characters as part of the "symbol" class. > > There are a couple different spots in the code to which you could > attribute this lapse. For one, the elisp-mode.el function > `elisp--current-symbol' isn't wrapped in a `with-syntax-table', unlike > other similar definitions in the same file. I think anyone invoking this > function could reasonably expect it to observe elisp syntax, so that's > what my tiny patch addresses. This fixes the Eldoc problem. > > But here's another weird thing further down the call stack. > `read--expression' has a FIXME comment saying to turn on > `emacs-lisp-mode' in the minibuffer -- which would also set the > appropriate syntax table -- but it doesn't actually do it. I guess that > must not work for whatever reason (since it has to have taken longer to > write the comment than it would have taken to add the code). Should it > be changed now so that it does set the major mode? Is there a problem > with specialized major modes in the minibuffer? I hereby kick the can > over to whoever knows more. > > Daniel > > > [2:text/x-patch Hide Save:0001-lisp-progmodes-elisp-mode.el-elisp-current-symbol-Se.patch (1kB)] > > >From 1d4ed0e89b4ebc040609b7476128062685843c7f Mon Sep 17 00:00:00 2001 > From: Daniel Koning > Date: Tue, 9 Jun 2020 19:24:11 -0500 > Subject: [PATCH] lisp/progmodes/elisp-mode.el (elisp--current-symbol): Set > syntax table. > > Even if `elisp-current-symbol' is called from a buffer with a different > active syntax table (such as the minibuffer in `read-from-minibuffer'), > use `emacs-lisp-mode-syntax-table' to determine the symbol boundaries. > > Copyright-paperwork-exempt: yes > --- > lisp/progmodes/elisp-mode.el | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el > index f39ecf9b7b..65c01b2ce1 100644 > --- a/lisp/progmodes/elisp-mode.el > +++ b/lisp/progmodes/elisp-mode.el > @@ -1615,10 +1615,11 @@ elisp--beginning-of-sexp > > ;; returns nil unless current word is an interned symbol. > (defun elisp--current-symbol () > - (let ((c (char-after (point)))) > - (and c > - (memq (char-syntax c) '(?w ?_)) > - (intern-soft (current-word))))) > + (with-syntax-table emacs-lisp-mode-syntax-table > + (let ((c (char-after (point)))) > + (and c > + (memq (char-syntax c) '(?w ?_)) > + (intern-soft (current-word)))))) > > (defun elisp-function-argstring (arglist) > "Return ARGLIST as a string enclosed by (). > -- > 2.20.1 >