mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Allow eval-ing named character literals
* lisp/progmodes/elisp-mode.el (elisp--preceding-sexp): Skip over named character literals. * test/lisp/progmodes/elisp-mode-tests.el (elisp--preceding-sexp--char-name): Add test for skipping over named character literals (bug#23354). Copyright-paperwork-exempt: yes
This commit is contained in:
parent
33d6250a93
commit
1331467910
2 changed files with 17 additions and 0 deletions
|
|
@ -1051,6 +1051,17 @@ If CHAR is not a character, return nil."
|
|||
((or (eq (following-char) ?\')
|
||||
(eq (preceding-char) ?\'))
|
||||
(setq left-quote ?\`)))
|
||||
|
||||
;; When after a named character literal, skip over the entire
|
||||
;; literal, not only its last word.
|
||||
(when (= (preceding-char) ?})
|
||||
(let ((begin (save-excursion
|
||||
(backward-char)
|
||||
(skip-syntax-backward "w-")
|
||||
(backward-char 3)
|
||||
(when (looking-at-p "\\\\N{") (point)))))
|
||||
(when begin (goto-char begin))))
|
||||
|
||||
(forward-sexp -1)
|
||||
;; If we were after `?\e' (or similar case),
|
||||
;; use the whole thing, not just the `e'.
|
||||
|
|
|
|||
|
|
@ -641,5 +641,11 @@ to (xref-elisp-test-descr-to-target xref)."
|
|||
(elisp--xref-find-definitions (eval '(provide 'stephe-leake-feature)))
|
||||
nil)
|
||||
|
||||
(ert-deftest elisp--preceding-sexp--char-name ()
|
||||
(with-temp-buffer
|
||||
(emacs-lisp-mode)
|
||||
(insert "?\\N{HEAVY CHECK MARK}")
|
||||
(should (equal (elisp--preceding-sexp) ?\N{HEAVY CHECK MARK}))))
|
||||
|
||||
(provide 'elisp-mode-tests)
|
||||
;;; elisp-mode-tests.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue