aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-05-11 18:52:17 +0000
committerStefan Monnier2005-05-11 18:52:17 +0000
commit90cbc9cda0faefbc14da6c5f50c6c9d6c4236d83 (patch)
tree9d824f7ada1fa6039a89a0becc5acaf97850f985
parent28cfe103568ad90a4e14e89ef516060358645474 (diff)
downloademacs-90cbc9cda0faefbc14da6c5f50c6c9d6c4236d83.tar.gz
emacs-90cbc9cda0faefbc14da6c5f50c6c9d6c4236d83.zip
(font-lock-fontify-syntactically-region): Don't use comment-end if
comment-start-skip is not set. Obey the font-lock-comment-delimiter-face variables.
-rw-r--r--lisp/font-lock.el34
1 files changed, 17 insertions, 17 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index f2a6d244a79..f1199d1e14e 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1314,10 +1314,10 @@ START should be at the beginning of a line."
1314(defun font-lock-fontify-syntactically-region (start end &optional loudly ppss) 1314(defun font-lock-fontify-syntactically-region (start end &optional loudly ppss)
1315 "Put proper face on each string and comment between START and END. 1315 "Put proper face on each string and comment between START and END.
1316START should be at the beginning of a line." 1316START should be at the beginning of a line."
1317 (let (state face beg 1317 (let ((comment-end-regexp
1318 (comment-end-regexp 1318 (regexp-quote
1319 (regexp-quote 1319 (replace-regexp-in-string "^ *" "" comment-end)))
1320 (replace-regexp-in-string "^ *" "" comment-end)))) 1320 state face beg)
1321 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) 1321 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name)))
1322 (goto-char start) 1322 (goto-char start)
1323 ;; 1323 ;;
@@ -1333,18 +1333,18 @@ START should be at the beginning of a line."
1333 (setq state (parse-partial-sexp (point) end nil nil state 1333 (setq state (parse-partial-sexp (point) end nil nil state
1334 'syntax-table)) 1334 'syntax-table))
1335 (when face (put-text-property beg (point) 'face face)) 1335 (when face (put-text-property beg (point) 'face face))
1336 (when (eq face 'font-lock-comment-face) 1336 (when (and (eq face 'font-lock-comment-face)
1337 comment-start-skip)
1337 ;; Find the comment delimiters 1338 ;; Find the comment delimiters
1338 ;; and use font-lock-comment-delimiter-face for them. 1339 ;; and use font-lock-comment-delimiter-face for them.
1339 (save-excursion 1340 (save-excursion
1340 (goto-char beg) 1341 (goto-char beg)
1341 (if (and comment-start-skip (looking-at comment-start-skip)) 1342 (if (looking-at comment-start-skip)
1342 (put-text-property beg (match-end 0) 'face 1343 (put-text-property beg (match-end 0) 'face
1343 'font-lock-comment-delimiter-face))) 1344 font-lock-comment-delimiter-face)))
1344 (if (and comment-end 1345 (if (looking-back comment-end-regexp (point-at-bol))
1345 (looking-back comment-end-regexp (point-at-bol)))
1346 (put-text-property (match-beginning 0) (point) 'face 1346 (put-text-property (match-beginning 0) (point) 'face
1347 'font-lock-comment-delimiter-face)))) 1347 font-lock-comment-delimiter-face))))
1348 (< (point) end)) 1348 (< (point) end))
1349 (setq state (parse-partial-sexp (point) end nil nil state 1349 (setq state (parse-partial-sexp (point) end nil nil state
1350 'syntax-table))))) 1350 'syntax-table)))))
@@ -1856,7 +1856,7 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
1856; (put 'font-lock-fontify-more 'menu-enable '(identity)) 1856; (put 'font-lock-fontify-more 'menu-enable '(identity))
1857; (put 'font-lock-fontify-less 'menu-enable '(identity))) 1857; (put 'font-lock-fontify-less 'menu-enable '(identity)))
1858; 1858;
1859;;; Put the appropriate symbol property values on now. See above. 1859; ;; Put the appropriate symbol property values on now. See above.
1860;(put 'global-font-lock-mode 'menu-selected 'global-font-lock-mode) 1860;(put 'global-font-lock-mode 'menu-selected 'global-font-lock-mode)
1861;(put 'font-lock-mode 'menu-selected 'font-lock-mode) 1861;(put 'font-lock-mode 'menu-selected 'font-lock-mode)
1862;(put 'font-lock-fontify-more 'menu-enable '(nth 2 font-lock-fontify-level)) 1862;(put 'font-lock-fontify-more 'menu-enable '(nth 2 font-lock-fontify-level))
@@ -1890,7 +1890,7 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
1890; (font-lock-fontify-level (1+ (car font-lock-fontify-level))) 1890; (font-lock-fontify-level (1+ (car font-lock-fontify-level)))
1891; (error "No more decoration"))) 1891; (error "No more decoration")))
1892; 1892;
1893;;; This should be called by `font-lock-set-defaults'. 1893; ;; This should be called by `font-lock-set-defaults'.
1894;(defun font-lock-set-menu () 1894;(defun font-lock-set-menu ()
1895; ;; Activate less/more fontification entries if there are multiple levels for 1895; ;; Activate less/more fontification entries if there are multiple levels for
1896; ;; the current buffer. Sets `font-lock-fontify-level' to be of the form 1896; ;; the current buffer. Sets `font-lock-fontify-level' to be of the form
@@ -1911,7 +1911,7 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
1911; (setq font-lock-fontify-level (list level (> level 1) 1911; (setq font-lock-fontify-level (list level (> level 1)
1912; (< level (1- (length keywords)))))))) 1912; (< level (1- (length keywords))))))))
1913; 1913;
1914;;; This should be called by `font-lock-unset-defaults'. 1914; ;; This should be called by `font-lock-unset-defaults'.
1915;(defun font-lock-unset-menu () 1915;(defun font-lock-unset-menu ()
1916; ;; Deactivate less/more fontification entries. 1916; ;; Deactivate less/more fontification entries.
1917; (setq font-lock-fontify-level nil)) 1917; (setq font-lock-fontify-level nil))
@@ -1919,7 +1919,7 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
1919;;; End of Menu support. 1919;;; End of Menu support.
1920 1920
1921;;; Various regexp information shared by several modes. 1921;;; Various regexp information shared by several modes.
1922;;; Information specific to a single mode should go in its load library. 1922; ;; Information specific to a single mode should go in its load library.
1923 1923
1924;; Font Lock support for C, C++, Objective-C and Java modes is now in 1924;; Font Lock support for C, C++, Objective-C and Java modes is now in
1925;; cc-fonts.el (and required by cc-mode.el). However, the below function 1925;; cc-fonts.el (and required by cc-mode.el). However, the below function
@@ -2071,9 +2071,9 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
2071 ;; ELisp and CLisp `&' keywords as types. 2071 ;; ELisp and CLisp `&' keywords as types.
2072 '("\\&\\sw+\\>" . font-lock-type-face) 2072 '("\\&\\sw+\\>" . font-lock-type-face)
2073 ;; 2073 ;;
2074;;; This is too general -- rms. 2074;;; This is too general -- rms.
2075;;; A user complained that he has functions whose names start with `do' 2075;;; A user complained that he has functions whose names start with `do'
2076;;; and that they get the wrong color. 2076;;; and that they get the wrong color.
2077;;; ;; CL `with-' and `do-' constructs 2077;;; ;; CL `with-' and `do-' constructs
2078;;; '("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face) 2078;;; '("(\\(\\(do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 1 font-lock-keyword-face)
2079 ))) 2079 )))