From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Daniel Koning Newsgroups: gmane.emacs.bugs Subject: bug#41781: 27.0.91; [PATCH] Eldoc describes the wrong function when reading an expression from the minibuffer Date: Tue, 09 Jun 2020 21:56:14 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="112963"; mail-complaints-to="usenet@ciao.gmane.io" To: 41781@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 10 04:57:12 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 1jiqvQ-000TLp-Mv for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jun 2020 04:57:12 +0200 Original-Received: from localhost ([::1]:40942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiqvP-0005Tw-AX for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Jun 2020 22:57:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiqvH-0005Tg-00 for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 22:57:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jiqvG-0006l6-ME for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 22:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jiqvG-0004Fg-Kp for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 22:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Koning Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jun 2020 02:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41781 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.159175778816300 (code B ref -1); Wed, 10 Jun 2020 02:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Jun 2020 02:56:28 +0000 Original-Received: from localhost ([127.0.0.1]:33100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jiquh-0004Eq-LM for submit@debbugs.gnu.org; Tue, 09 Jun 2020 22:56:28 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:43258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jiquf-0004Eg-Q4 for submit@debbugs.gnu.org; Tue, 09 Jun 2020 22:56:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiquf-0005SG-HA for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 22:56:25 -0400 Original-Received: from sender4-of-o56.zoho.com ([136.143.188.56]:21653) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jique-0006hc-CS for bug-gnu-emacs@gnu.org; Tue, 09 Jun 2020 22:56:25 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1591757778; cv=none; d=zohomail.com; s=zohoarc; b=HAZ4zOk5SxpymvHXOmQGCgeBnCQx1hl47bGgDUSNxgFsezL2FcpbyBH8Bnnw5DBDNq1C0MFc4OhbqcIhXN8d2vbHvSCXNUgVwo1qJ6Pg8vfGjrblCvLMSjAzAJvJcLVTP1KEOjwZIBGwHXQ0KXHBx+4Rs6VJU2DH8xAyc60SV90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591757778; h=Content-Type:Date:From:MIME-Version:Message-ID:Subject:To; bh=MVMydE3AvfGLURR34mlVxp8EUCjXR6/GCd4qp3qCXN4=; b=QpnMPIUZeeREehEeibL+zz2i9SGIBiggDNO3DexX/Bdv5yybBa4lSb+XzjOIibDDYawg7PnWdExOJJTopz+84DyT8szlCYyLHY9dNrvBug2aHkjni8b2kDqXG1g8qAgWGOq3yK3tbCk5Ykk4I/F6Pvx8xLVpczzPFEgFhzRAEHo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass smtp.mailfrom=dk@danielkoning.com; dmarc=pass header.from= header.from= Original-Received: from cornelius (112.157.239.35.bc.googleusercontent.com [35.239.157.112]) by mx.zohomail.com with SMTPS id 1591757776290483.59589247107033; Tue, 9 Jun 2020 19:56:16 -0700 (PDT) X-Zoho-Virus-Status: 1 X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.56; envelope-from=dk@danielkoning.com; helo=sender4-of-o56.zoho.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/09 22:56:20 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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:181803 Archived-At: --=-=-= Content-Type: text/plain Severity: minor Tags: patch 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-progmodes-elisp-mode.el-elisp-current-symbol-Se.patch Content-Description: elisp--current-symbol patch >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 --=-=-=--