diff options
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r-- | lisp/font-lock.el | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index cf15a7d8f87..b70e345e983 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -620,6 +620,7 @@ Major/minor modes can set this variable if they know which option applies.") ;; We use this to preserve or protect things when modifying text properties. (defmacro save-buffer-state (varlist &rest body) "Bind variables according to VARLIST and eval BODY restoring buffer state." + (declare (indent 1) (debug let)) (let ((modified (make-symbol "modified"))) `(let* ,(append varlist `((,modified (buffer-modified-p)) @@ -634,8 +635,6 @@ Major/minor modes can set this variable if they know which option applies.") ,@body) (unless ,modified (restore-buffer-modified-p nil))))) - (put 'save-buffer-state 'lisp-indent-function 1) - (def-edebug-spec save-buffer-state let) ;; ;; Shut up the byte compiler. (defvar font-lock-face-attributes)) ; Obsolete but respected if set. @@ -1826,15 +1825,15 @@ Sets various variables using `font-lock-defaults' (or, if nil, using "Font Lock mode face used to highlight preprocessor directives." :group 'font-lock-highlighting-faces) -(defface font-lock-regexp-backslash +(defface font-lock-regexp-grouping-backslash '((((class color) (min-colors 16)) :inherit escape-glyph) (t :inherit bold)) - "Font Lock mode face used to highlight a backslash in Lisp regexps." + "Font Lock mode face for backslashes in Lisp regexp grouping constructs." :group 'font-lock-highlighting-faces) -(defface font-lock-regexp-backslash-construct +(defface font-lock-regexp-grouping-construct '((t :inherit bold)) - "Font Lock mode face used to highlight `\' constructs in Lisp regexps." + "Font Lock mode face used to highlight grouping constructs in Lisp regexps." :group 'font-lock-highlighting-faces) ;;; End of Colour etc. support. @@ -2083,22 +2082,22 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item." ("\\<:\\sw+\\>" 0 font-lock-builtin-face) ;; ELisp and CLisp `&' keywords as types. ("\\&\\sw+\\>" . font-lock-type-face) - ;; Make regexp grouping constructs bold, so they stand out, but only - ;; in strings. + ;; ELisp regexp grouping constructs ((lambda (bound) - (if (re-search-forward "\\(\\\\\\\\\\)\\((\\(?:?:\\)?\\|[|)]\\)" bound t) - (let ((face (get-text-property (1- (point)) 'face))) - (if (listp face) - (memq 'font-lock-string-face face) - (eq 'font-lock-string-face face))))) - (1 'font-lock-regexp-backslash prepend) - (2 'font-lock-regexp-backslash-construct prepend)) - - ;; Underline innermost grouping, so that you can more easily see what - ;; belongs together. 2005-05-12: Font-lock can go into an - ;; unbreakable endless loop on this -- something's broken. - ;;("[\\][\\][(]\\(?:\\?:\\)?\\(\\(?:[^\\\"]+\\|[\\]\\(?:[^\\]\\|[\\][^(]\\)\\)+?\\)[\\][\\][)]" - ;;1 'underline prepend) + (catch 'found + ;; The following loop is needed to continue searching after matches + ;; that do not occur in strings. The associated regexp matches one + ;; of `\\\\' `\\(' `\\(?:' `\\|' `\\)'. `\\\\' has been included to + ;; avoid highlighting, for example, `\\(' in `\\\\('. + (while (re-search-forward "\\(\\\\\\\\\\)\\(?:\\(\\\\\\\\\\)\\|\\((\\(?:\\?:\\)?\\|[|)]\\)\\)" bound t) + (unless (match-beginning 2) + (let ((face (get-text-property (1- (point)) 'face))) + (when (or (and (listp face) + (memq 'font-lock-string-face face)) + (eq 'font-lock-string-face face)) + (throw 'found t))))))) + (1 'font-lock-regexp-grouping-backslash prepend) + (3 'font-lock-regexp-grouping-construct prepend)) ;;; This is too general -- rms. ;;; A user complained that he has functions whose names start with `do' ;;; and that they get the wrong color. |