emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master fa9f61e: * lisp/font-lock.el: Fix `font-lock-comment-end-skip` fa


From: Stefan Monnier
Subject: master fa9f61e: * lisp/font-lock.el: Fix `font-lock-comment-end-skip` fallback (bug#34088)
Date: Tue, 11 May 2021 13:19:56 -0400 (EDT)

branch: master
commit fa9f61e0f60c3f8fcc74e1b318e4113a1248b918
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/font-lock.el: Fix `font-lock-comment-end-skip` fallback (bug#34088)
    
    (font-lock-fontify-syntactically-region): Use `comment-end-skip` as
    fallback for `font-lock-comment-end-skip`, as is done for
    `font-lock-comment-start-skip` (and as the name suggests).
    
    * lisp/progmodes/opascal.el (opascal-mode): Revert last change,
    made unnecessary.
---
 lisp/font-lock.el         | 13 ++++++-------
 lisp/progmodes/opascal.el |  1 -
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 82915d8..4dc42d9 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1604,18 +1604,15 @@ START should be at the beginning of a line."
   "If non-nil, Font Lock mode uses this instead of `comment-start-skip'.")
 
 (defvar font-lock-comment-end-skip nil
-  "If non-nil, Font Lock mode uses this instead of `comment-end'.")
+  "If non-nil, Font Lock mode uses this instead of `comment-end-skip'.")
 
 (defun font-lock-fontify-syntactically-region (start end &optional loudly)
   "Put proper face on each string and comment between START and END.
 START should be at the beginning of a line."
   (syntax-propertize end)  ; Apply any needed syntax-table properties.
   (with-syntax-table (or syntax-ppss-table (syntax-table))
-    (let ((comment-end-regexp
-          (or font-lock-comment-end-skip
-              (regexp-quote
-               (replace-regexp-in-string "^ *" "" comment-end))))
-          ;; Find the `start' state.
+    (when (and comment-start (not comment-end-skip)) (comment-normalize-vars))
+    (let (;; Find the `start' state.
           (state (if (or syntax-ppss-table
                          (not font-lock--syntax-table-affects-ppss))
                      (syntax-ppss start)
@@ -1648,7 +1645,9 @@ START should be at the beginning of a line."
                                      comment-start-skip))
                      (put-text-property beg (match-end 0) 'face
                                         font-lock-comment-delimiter-face)))
-               (if (looking-back comment-end-regexp (point-at-bol) t)
+               (if (looking-back (or font-lock-comment-end-skip
+                                     comment-end-skip)
+                                 (point-at-bol) t)
                    (put-text-property (match-beginning 0) (point) 'face
                                       font-lock-comment-delimiter-face))))
            (< (point) end))
diff --git a/lisp/progmodes/opascal.el b/lisp/progmodes/opascal.el
index 686e72c..662d2b4 100644
--- a/lisp/progmodes/opascal.el
+++ b/lisp/progmodes/opascal.el
@@ -1766,7 +1766,6 @@ Coloring:
   (setq-local syntax-propertize-function opascal--syntax-propertize)
 
   (setq-local comment-start "// ")
-  (setq-local comment-end "}")
   (setq-local comment-start-skip "\\(?://\\|(\\*\\|{\\)[ \t]*")
   (setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*)\\|}\\)"))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]