diff options
| author | Stefan Monnier | 2017-03-11 16:36:23 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2017-03-11 16:36:23 -0500 |
| commit | 46fcaf3361b56306c288f2ddf4dd8a7dfab7ce2f (patch) | |
| tree | e5410fd7960b55e431121d5d21d1b889b1b34cd3 | |
| parent | 4086d850dc02c95615095adddd1e798377f03cec (diff) | |
| download | emacs-46fcaf3361b56306c288f2ddf4dd8a7dfab7ce2f.tar.gz emacs-46fcaf3361b56306c288f2ddf4dd8a7dfab7ce2f.zip | |
Improve last change
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2):
Use ppss to check escaping and add help-echo.
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 3ed0d062e34..c2f5f42ace8 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -412,13 +412,17 @@ This will generate compile-time constants from BINDINGS." | |||
| 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). | 414 | ;; Ineffective backslashes (typically in need of doubling). |
| 415 | ("\\(?:[^\\]\\|^\\)\\(?:\\\\\\\\\\)*\\(\\(\\\\\\)\\([^\"\\]\\)\\)" | 415 | ("\\(\\\\\\)\\([^\"\\]\\)" |
| 416 | (2 (and (nth 3 (syntax-ppss)) | 416 | (1 (let ((ppss (save-excursion (syntax-ppss (match-beginning 0))))) |
| 417 | (equal (ignore-errors | 417 | (and (nth 3 ppss) ;Inside a string. |
| 418 | (car (read-from-string | 418 | (not (nth 5 ppss)) ;The \ is not itself \-escaped. |
| 419 | (format "\"%s\"" (match-string 1))))) | 419 | (equal (ignore-errors |
| 420 | (match-string 3)) | 420 | (car (read-from-string |
| 421 | font-lock-warning-face) | 421 | (format "\"%s\"" |
| 422 | (match-string-no-properties 0))))) | ||
| 423 | (match-string-no-properties 2)) | ||
| 424 | `(face ,font-lock-warning-face | ||
| 425 | help-echo "This \\ has no effect"))) | ||
| 422 | prepend)) | 426 | prepend)) |
| 423 | ;; Words inside ‘’ and `' tend to be symbol names. | 427 | ;; Words inside ‘’ and `' tend to be symbol names. |
| 424 | (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)" | 428 | (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)" |