branch: externals/cape commit a40c06a259f3dd59eb5f5d7a397a781c09865681 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
cape-elisp-symbol: Insert wrappers in emacs-lisp-mode in strings and comments --- cape.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cape.el b/cape.el index c92e99e51d..cfdbfc8589 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