all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: 35567@debbugs.gnu.org
Subject: bug#35567: 27.0.50; Emacs-Lisp and ElDoc confusion with some strings
Date: Sat, 10 Aug 2019 11:03:05 -0300	[thread overview]
Message-ID: <CABczVwfEsEO3_i-iCy18ekRm-8BkcAx1TPF1kg07UNo7+PD_JQ@mail.gmail.com> (raw)
In-Reply-To: <CABczVwfi4RTgrJub8wg_ThcjX--SFH_GsJPm_Uwd1TkZ_aEcgQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 55 bytes --]

Oops, previous patch had a typo in the commit message.

[-- Attachment #1.2: Type: text/html, Size: 87 bytes --]

[-- Attachment #2: 0001-Don-t-display-wrong-ElDoc-information-when-inside-EL.patch --]
[-- Type: text/x-patch, Size: 1745 bytes --]

From b6636d8ac641660c397bc38e191a06e0ddc8b1c7 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Sat, 10 Aug 2019 10:48:24 -0300
Subject: [PATCH] Don't display wrong ElDoc information when inside ELisp
 strings or comments

* lisp/progmodes/elisp-mode.el (elisp--fnsym-in-current-sexp): Since
forward-sexp assumes point is not in a string or comment, avoid
calling it and then checking if point is inside a string, since that
sometimes will fail with awkward results.  (Bug#35567)
---
 lisp/progmodes/elisp-mode.el | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 36797fc..f229d07 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1571,14 +1571,12 @@ elisp--docstring-first-line
 ;; Return a list of current function name and argument index.
 (defun elisp--fnsym-in-current-sexp ()
   (save-excursion
-    (let ((argument-index (1- (elisp--beginning-of-sexp))))
-      ;; If we are at the beginning of function name, this will be -1.
-      (when (< argument-index 0)
-	(setq argument-index 0))
-      ;; Don't do anything if current word is inside a string.
-      (if (= (or (char-after (1- (point))) 0) ?\")
-	  nil
-	(list (elisp--current-symbol) argument-index)))))
+    (unless (nth 8 (syntax-ppss))
+      (let ((argument-index (1- (elisp--beginning-of-sexp))))
+        ;; If we are at the beginning of function name, this will be -1.
+        (when (< argument-index 0)
+	  (setq argument-index 0))
+        (list (elisp--current-symbol) argument-index)))))
 
 ;; Move to the beginning of current sexp.  Return the number of nested
 ;; sexp the point was over or after.
-- 
2.7.4


  reply	other threads:[~2019-08-10 14:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04 21:14 bug#35567: 27.0.50; Emacs-Lisp and ElDoc confusion with some strings Mauro Aranda
2019-08-10 14:00 ` Mauro Aranda
2019-08-10 14:03   ` Mauro Aranda [this message]
2019-08-20 12:42     ` Noam Postavsky

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=CABczVwfEsEO3_i-iCy18ekRm-8BkcAx1TPF1kg07UNo7+PD_JQ@mail.gmail.com \
    --to=maurooaranda@gmail.com \
    --cc=35567@debbugs.gnu.org \
    /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.