From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#35567: 27.0.50; Emacs-Lisp and ElDoc confusion with some strings Date: Sat, 4 May 2019 18:14:54 -0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000828a5a0588165c33" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="59712"; mail-complaints-to="usenet@blaine.gmane.org" To: 35567@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 04 23:16:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hN20z-000FQE-Cx for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 May 2019 23:16:13 +0200 Original-Received: from localhost ([127.0.0.1]:33007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hN20y-0001Ui-9u for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 May 2019 17:16:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hN20q-0001Ub-4i for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 17:16:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hN20o-0003wZ-7h for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 17:16:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38940) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hN20o-0003w3-3M for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 17:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hN20n-0005Wu-Rd for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 17:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 May 2019 21:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35567 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.155700452221189 (code B ref -1); Sat, 04 May 2019 21:16:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 May 2019 21:15:22 +0000 Original-Received: from localhost ([127.0.0.1]:52480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hN209-0005Vg-9f for submit@debbugs.gnu.org; Sat, 04 May 2019 17:15:21 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hN205-0005VR-LL for submit@debbugs.gnu.org; Sat, 04 May 2019 17:15:19 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49510) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hN200-0003DU-C8 for submit@debbugs.gnu.org; Sat, 04 May 2019 17:15:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hN1zy-0001Ng-CG for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 17:15:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hN1zw-00035y-He for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 17:15:10 -0400 Original-Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]:35279) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hN1zw-00032o-21 for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 17:15:08 -0400 Original-Received: by mail-lj1-x234.google.com with SMTP id z26so3191124ljj.2 for ; Sat, 04 May 2019 14:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=2EeDTqcJZ6trdJCbdTyVgk8YVYOFtihBViVTQ8ZrLog=; b=YNCCfDtd6FUorvT6fGRrfRxwz0dk75PBGPuynXi5GR1eVJogN8VgleVfMpE/NtQNEI jVqwlmH9XPZ8gHHCaK2FN6oEoSXu/kcs5Z2SeH0AvlVwIqmlQOtLN+KemXmzai+hHjpv yaRk2Bn0vsSYE6y87RuovY5IZBRGUj9w3+UT3UHEgayRHGn/hp79pUe1C0Cvuje2TOTt 8SG9hpF81UJL3a+eAAZ17nq3u4OApGoNHiQtVyVc4eci/j4yEZZeU+zgCW/XXz9l2IDE 9nB0PYJzYcMntw+YT6j5adz1OFUkioxGkHGE3aVAvDgQwEXV9Tw3X7QhrA+V7zd9S9Hz 5bng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=2EeDTqcJZ6trdJCbdTyVgk8YVYOFtihBViVTQ8ZrLog=; b=M5/xZPpWBl1hPX6YId9eMhkldIG8N2zrDKJDTDGdnlUPDN1gKMljlQKIW/s4b/LWrO fm1NPcRWPttOmhuThRLCoGYnjZ4QRXAlFzX3zPxZbfIFy3PVEfmGSzHprRYt65iTBj1Q dl6iY46qcxRQUgaXnUdBDGbYcKh9p+bnebmbcT+8yTYS3ZRuVT7Aexxgj+/1zEgoQlLX yXyVzEpelLNNsw/9U2SftK+12vGijpaxLbiCe2suAGQY8RsTw3u/oPywOQWVe+MpAHmW YNZ1/odjmStXLX4ELdzPtAH+f05pinvkctxXktz1lLvsMmbrEBBXob/16iICWw71Kh97 d8pw== X-Gm-Message-State: APjAAAWNg5SVdWk41jv2rf3P8ssOnsxWoTV+B6cDLlVeJ7x0HK7jeooi jiWh5gwr7DlCBFBAsZY1d6xSrwxIVenQLbBcFnB0U/sT X-Google-Smtp-Source: APXvYqx9pJrjLzWfCCEUA2WMv9XS8O/nGy3RKl1ViM9ZFHni1KlMB/ut9+NWE/cOsAH/GPfR2uMfqqk8uaMcqnBNT6M= X-Received: by 2002:a2e:8794:: with SMTP id n20mr9660668lji.76.1557004506243; Sat, 04 May 2019 14:15:06 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158763 Archived-At: --000000000000828a5a0588165c33 Content-Type: multipart/alternative; boundary="000000000000828a580588165c31" --000000000000828a580588165c31 Content-Type: text/plain; charset="UTF-8" Hello. I've found some cases where ElDoc displays function information in the echo area, when it shouldn't. Try the following, with the attached test.el (no need to eval it): 1) emacs -Q 2) C-x C-f test.el 3) There are two 'and' in the doc string of foo. Do a search for 'and' and stop after the first: C-s and C-f: ElDoc doesn't show a function in the echo area, that's fine. Now search for the next 'and': C-s C-s C-f: ElDoc shows `and: (CONDITIONS...)' in the echo area. That shouldn't happen. 4) Also, there's a " in a comment, in the last line. Search for "here", just like for "and" before: C-s here C-f: ElDoc again shows `and: (CONDITIONS...)'. That again, shouldn't happen. In these cases, I see that elisp--fnsym-in-current-sexp doesn't return nil, as it should when point is inside a string. So far, I've only found that a quoted ( confuses it, when the ) is not quoted. But for the bug to become visible, the word that follows ")" has to be an interned symbol. Another example is in the file lisp/files.el. Put point in the doc string of the variable file-name-version-regexp, and see that ElDoc shows `while: (TEST BODY...)' in the echo area. I think that happens because there are " in some comments lines before the doc string. It seems that the problem is that elisp--beginning-of-sexp calls forward-sexp, even though its doc string explicitly says that it assumes point is not in a string or a comment. Most of the time it still works, but it fails in some cases, and in those cases, the check for the current word not being inside a string loses its purpose. Perhaps using the return value of syntax-ppss before calling elisp--beginning-of-sexp would be enough to avoid this confusion. Also, let me ask: was there any discussion about the usefulness of having ElDoc display information when point is inside a comment? I ask because I only see the intention to check when not inside a string. Best regards, Mauro. In GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.18.9) of 2019-05-04 built on the-blackbeard Repository revision: a90ad2297391cf5fe284a4c6e81724360ed018a4 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 16.04.6 LTS Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS PDUMPER LCMS2 GMP Important settings: value of $LANG: en_US.utf8 value of $XMODIFIERS: locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 8 44043 5027) (symbols 24 5870 1) (strings 16 14982 1524) (string-bytes 1 501645) (vectors 8 8861) (vector-slots 4 114202 9774) (floats 8 17 14) (intervals 28 191 4) (buffers 564 11) (heap 1024 7516 761)) --000000000000828a580588165c31 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello.<= br>
I've found some cases where ElDoc displays function information = in
the echo area, when it shouldn't.

Try t= he following, with the attached test.el (no need to eval it):
1) emacs -= Q
2) C-x C-f test.el
3) There are two 'and' in the doc string= of foo.=C2=A0 Do a search for 'and'
and stop after the first:C-s and C-f: ElDoc doesn't show a function in the echo area, that'= ;s
fine.
Now search for the next 'and':
C-s C-s C-f: ElDoc= shows `and: (CONDITIONS...)' in the echo area.=C2=A0 That
shouldn&#= 39;t happen.
4) Also, there's a " in a comment, in the last lin= e.=C2=A0 Search for "here",
just like for "and" befo= re:
C-s here C-f: ElDoc again shows `and: (CONDITIONS...)'.=C2=A0 Th= at again,
shouldn't happen.

In these cases, I see that elisp-= -fnsym-in-current-sexp doesn't return nil,
as it = should when point is inside a string.=C2=A0 So far, I've only found tha= t
a quoted ( confuses it, when the ) is not quoted.=C2=A0 But for the bu= g to
become visible, the word that follows ")" has to be an in= terned symbol.

Another example is in the file lisp/files.el.=C2=A0 P= ut point in the doc string of
the variable file-name-version-regexp, and= see that ElDoc shows
`while: (TEST BODY...)' in the echo area.=C2= =A0 I think that happens because
there are " in some comments lines= before the doc string.

It seems that the problem is that elisp--beg= inning-of-sexp calls
forward-sexp, even though its do= c string explicitly says that it assumes
point is not= in a string or a comment.=C2=A0 Most of the time it still works,
but it fails in some cases, and in those cases, the check for = the current
word not being inside a string loses its = purpose.

Perhaps using the return value of syntax-ppss before callin= g
elisp--beginning-of-sexp would be enough to avoid this confusion.
<= br>Also, let me ask: was there any discussion about the usefulness of havin= g
ElDoc display information when point is inside a comment?=C2=A0 I ask = because
I only see the intention to check when not inside a string.
<= br>Best regards,
Mauro.

In GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.1= 8.9)
=C2=A0of 2019-05-04 built on the-blackbeard
Repository revision:= a90ad2297391cf5fe284a4c6e81724360ed018a4
Repository branch: master
W= indowing system distributor 'The X.Org Foundation', version 11.0.11= 906000
System Description: Ubuntu 16.04.6 LTS

Recent messages:For information about GNU Emacs and the GNU system, type C-h C-a.

C= onfigured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBU= S GSETTINGS GLIB
NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M= 17N_FLT LIBOTF
XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS PD= UMPER LCMS2 GMP

Important settings:
=C2=A0 value of $LANG: en_US.= utf8
=C2=A0 value of $XMODIFIERS:
=C2=A0 locale-coding-system: utf-8= -unix

Major mode: Lisp Interaction

Minor modes in effect:
= =C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 eldoc-mode:= t
=C2=A0 electric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2= =A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-= mode: t
=C2=A0 global-font-lock-mode: t
=C2=A0 font-lock-mode: t
= =C2=A0 blink-cursor-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 au= to-encryption-mode: t
=C2=A0 auto-compression-mode: t
=C2=A0 line-num= ber-mode: t
=C2=A0 transient-mark-mode: t

Load-path shadows:
N= one found.

Features:
(shadow sort mail-extr emacsbug message rmc = puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs fo= rmat-spec rfc822 mml
easymenu mml-sec password-cache epa derived epg epg= -config gnus-util
rmail rmail-loaddefs text-property-search time-date mm= -decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mail= header cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util ma= il-prsvr mail-utils
elec-pair mule-util tooltip eldoc electric uniquify = ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-= win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list re= place newcomment
text-mode elisp-mode lisp-mode prog-mode register page = menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font= -lock
syntax facemenu font-core term/tty-colors frame cl-generic cham ge= orgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean<= br>japanese eucjp-ms cp51932 hebrew greek romanian slovak czech europeanethiopic indian cyrillic chinese composite charscript charprop
case-tab= le epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-prelo= aded nadvice loaddefs button faces cus-face macroexp files
text-properti= es overlay sha1 md5 base64 format env code-pages mule
custom widget hash= table-print-readable backquote threads dbusbind
inotify lcms2 dynamic-se= tting system-font-setting font-render-setting
move-toolbar gtk x-toolkit= x multi-tty make-network-process emacs)

Memory information:
((co= nses 8 44043 5027)
=C2=A0(symbols 24 5870 1)
=C2=A0(strings 16 14982 = 1524)
=C2=A0(string-bytes 1 501645)
=C2=A0(vectors 8 8861)
=C2=A0(= vector-slots 4 114202 9774)
=C2=A0(floats 8 17 14)
=C2=A0(intervals 2= 8 191 4)
=C2=A0(buffers 564 11)
=C2=A0(heap 1024 7516 761))

--000000000000828a580588165c31-- --000000000000828a5a0588165c33 Content-Type: text/x-emacs-lisp; charset="US-ASCII"; name="test.el" Content-Disposition: attachment; filename="test.el" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jva00god0 KGRlZnVuIGZvbyAoKQogICJEb2Mgc3RyaW5nIG9mIGZvby4KSWYgeW91IGhhdmUgdG8gcXVvdGUg YSBwYXJlbnRoZXNpcyBhdCB0aGUgYm9sLCBpdCB3aWxsIGJlIHRyb3VibGUgZm9yCmVsaXNwLWVs ZG9jLWRvY3VtZW50YXRpb24tZnVuY3Rpb24uCldyaXRlIChsaWtlIHRoaXMpIGFuZCB5b3Ugd2ls bCBmaW5kIG5vIHByb2JsZW0uICBCdXQgcHV0ClwoYSBxdW90ZWQgcGFyZW50aGVzaXMpIGFuZCB5 b3UnbGwgY29uZnVzZSBlbGlzcC1lbGRvYy1kb2N1bWVudGF0aW9uLWZ1bmN0aW9uLiIKICBuaWwp Cgo7OyBBbHNvLCBpbiBjb21tZW50cywgbG9vayB3aGF0IGhhcHBlbnMgd2hlbiB5b3UgcHV0IGEg IiBoZXJlLgo= --000000000000828a5a0588165c33--