emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 4e0c583: Don't display wrong ElDoc information when


From: Noam Postavsky
Subject: [Emacs-diffs] master 4e0c583: Don't display wrong ElDoc information when inside ELisp strings or comments
Date: Tue, 20 Aug 2019 08:41:38 -0400 (EDT)

branch: master
commit 4e0c5830dab466be2df99b8814b742a662d67ac7
Author: Mauro Aranda <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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..516e4f9 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1571,14 +1571,12 @@ In the absence of INDEX, just call 
`eldoc-docstring-format-sym-doc'."
 ;; 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]