summaryrefslogtreecommitdiff
path: root/cape.el
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-08-18 10:43:36 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2024-08-18 10:44:10 +0200
commita40c06a259f3dd59eb5f5d7a397a781c09865681 (patch)
tree408f380a609cf6ca9671b76b956cc50c3aef9f1f /cape.el
parent37e96afde051ce9648b46b358d9c1f5fa7a7932f (diff)
cape-elisp-symbol: Insert wrappers in emacs-lisp-mode in strings and comments
Diffstat (limited to 'cape.el')
-rw-r--r--cape.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/cape.el b/cape.el
index c92e99e..cfdbfc8 100644
--- a/cape.el
+++ b/cape.el
@@ -133,6 +133,7 @@ The buffers are scanned for completion candidates by `cape-line'."
(defcustom cape-elisp-symbol-wrapper
'((org-mode ?~ ?~)
(markdown-mode ?` ?`)
+ (emacs-lisp-mode ?` ?')
(rst-mode "``" "``")
(log-edit-mode "`" "'")
(change-log-mode "`" "'")
@@ -471,6 +472,9 @@ STATUS is the exit status."
(when-let (((not (eq status 'exact)))
(c (cl-loop for (m . c) in cape-elisp-symbol-wrapper
if (derived-mode-p m) return c))
+ ((or (not (derived-mode-p 'emacs-lisp-mode))
+ ;; Inside comment or string
+ (let ((s (syntax-ppss))) (or (nth 3 s) (nth 4 s)))))
(x (if (stringp (car c)) (car c) (string (car c))))
(y (if (stringp (cadr c)) (cadr c) (string (cadr c)))))
(save-excursion