aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2017-03-11 11:35:14 -0500
committerStefan Monnier2017-03-11 11:35:14 -0500
commit4086d850dc02c95615095adddd1e798377f03cec (patch)
tree9fa2ba63504701e9ac813f7af8e6c1985e303ebe
parentee51550c3951a47446ec85cb7f0b1ea7a898acaf (diff)
downloademacs-4086d850dc02c95615095adddd1e798377f03cec.tar.gz
emacs-4086d850dc02c95615095adddd1e798377f03cec.zip
Highlight useless backslashes in Elisp strings
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2): Put warning face on backslashes that have no effect.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index d720e0bc573..3ed0d062e34 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -411,6 +411,15 @@ This will generate compile-time constants from BINDINGS."
411 ;; Words inside \\[] tend to be for `substitute-command-keys'. 411 ;; Words inside \\[] tend to be for `substitute-command-keys'.
412 (,(concat "\\\\\\\\\\[\\(" lisp-mode-symbol-regexp "\\)\\]") 412 (,(concat "\\\\\\\\\\[\\(" lisp-mode-symbol-regexp "\\)\\]")
413 (1 font-lock-constant-face prepend)) 413 (1 font-lock-constant-face prepend))
414 ;; Ineffective backslashes (typically in need of doubling).
415 ("\\(?:[^\\]\\|^\\)\\(?:\\\\\\\\\\)*\\(\\(\\\\\\)\\([^\"\\]\\)\\)"
416 (2 (and (nth 3 (syntax-ppss))
417 (equal (ignore-errors
418 (car (read-from-string
419 (format "\"%s\"" (match-string 1)))))
420 (match-string 3))
421 font-lock-warning-face)
422 prepend))
414 ;; Words inside ‘’ and `' tend to be symbol names. 423 ;; Words inside ‘’ and `' tend to be symbol names.
415 (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)" 424 (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)"
416 lisp-mode-symbol-regexp "\\)['’]") 425 lisp-mode-symbol-regexp "\\)['’]")