Run rst-define-level-faces when loading.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 21 Jun 2008 04:10:26 +0000 (04:10 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 21 Jun 2008 04:10:26 +0000 (04:10 +0000)
(rst-mode): Don't set the font-lock-multiline var.
(rst-font-lock-find-unindented-line, rst-font-lock-handle-adornment):
Set the font-lock-multiline property by hand.

lisp/ChangeLog
lisp/textmodes/rst.el

index 817dc58..5011a6e 100644 (file)
@@ -1,5 +1,10 @@
 2008-06-21  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * textmodes/rst.el: Run rst-define-level-faces when loading.
+       (rst-mode): Don't set the font-lock-multiline var.
+       (rst-font-lock-find-unindented-line, rst-font-lock-handle-adornment):
+       Set the font-lock-multiline property by hand.
+
        * loadup.el: Don't add emacs-<VERS> name when bootstrapping.
 
        * Makefile.in (emacs-deps): Remove.
index 0d6771e..fdd3585 100644 (file)
@@ -406,7 +406,6 @@ blocks."
   (set (make-local-variable 'font-lock-defaults)
        '(rst-font-lock-keywords-function
         t nil nil nil
-        (font-lock-multiline . t)
         (font-lock-mark-block-function . mark-paragraph)))
   ;; `jit-lock-mode' has been the default since Emacs-21.1, so there's no
   ;; point messing around with font-lock-support-mode any more.
@@ -2749,6 +2748,7 @@ details check the Rst Faces Defaults group."
        (set sym sym)
        (setq i (1+ i))))))
 
+(rst-define-level-faces)
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3044,15 +3044,21 @@ point is not moved."
       ;; Always succeeds because the limit set by PRE-MATCH-FORM is the
       ;; ultimate point to find
       (goto-char (or (rst-forward-indented-block nil limit) limit))
+      (save-excursion
+        ;; Include subsequent empty lines in the font-lock block,
+        ;; in case the user subsequently changes the indentation of the next
+        ;; non-empty line to move it into the indented element.
+        (skip-chars-forward " \t\n")
+        (put-text-property beg-pnt (point) 'font-lock-multiline t))
       (set-match-data (list beg-pnt (point)))
       t)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Adornments
 
-;; Stores the point where the current adornment ends. Also used as a trigger
-;; for `rst-font-lock-handle-adornment'.
-(defvar rst-font-lock-adornment-point nil)
+(defvar rst-font-lock-adornment-point nil
+  "Stores the point where the current adornment ends.  Also used as a trigger
+for `rst-font-lock-handle-adornment'.")
 
 ;; Here `rst-font-lock-handle-adornment' stores the section level of the
 ;; current adornment or t for a transition.
@@ -3174,6 +3180,7 @@ entered.")
             (mtc (cdr ado)))
        (setq rst-font-lock-level (rst-adornment-level key t))
        (goto-char (nth 1 mtc))
+        (put-text-property (nth 0 mtc) (nth 1 mtc) 'font-lock-multiline t)
        (set-match-data mtc)
        t))))