aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Aranda2019-08-10 10:48:24 -0300
committerNoam Postavsky2019-08-20 08:34:23 -0400
commit4e0c5830dab466be2df99b8814b742a662d67ac7 (patch)
tree5b90694e051a7d708e32d8763651b4a44410ff15
parent08d7cabc923dad602dd3801c09f02386acda4e3b (diff)
downloademacs-4e0c5830dab466be2df99b8814b742a662d67ac7.tar.gz
emacs-4e0c5830dab466be2df99b8814b742a662d67ac7.zip
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)
-rw-r--r--lisp/progmodes/elisp-mode.el14
1 files changed, 6 insertions, 8 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 36797fc6fdb..516e4f9cd63 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'."
1571;; Return a list of current function name and argument index. 1571;; Return a list of current function name and argument index.
1572(defun elisp--fnsym-in-current-sexp () 1572(defun elisp--fnsym-in-current-sexp ()
1573 (save-excursion 1573 (save-excursion
1574 (let ((argument-index (1- (elisp--beginning-of-sexp)))) 1574 (unless (nth 8 (syntax-ppss))
1575 ;; If we are at the beginning of function name, this will be -1. 1575 (let ((argument-index (1- (elisp--beginning-of-sexp))))
1576 (when (< argument-index 0) 1576 ;; If we are at the beginning of function name, this will be -1.
1577 (setq argument-index 0)) 1577 (when (< argument-index 0)
1578 ;; Don't do anything if current word is inside a string. 1578 (setq argument-index 0))
1579 (if (= (or (char-after (1- (point))) 0) ?\") 1579 (list (elisp--current-symbol) argument-index)))))
1580 nil
1581 (list (elisp--current-symbol) argument-index)))))
1582 1580
1583;; Move to the beginning of current sexp. Return the number of nested 1581;; Move to the beginning of current sexp. Return the number of nested
1584;; sexp the point was over or after. 1582;; sexp the point was over or after.