changeset 96139:f55e63ce44fd

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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 21 Jun 2008 04:10:26 +0000
parents 41be5bc2426e
children fea1ab635d2d
files lisp/ChangeLog lisp/textmodes/rst.el
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Jun 21 02:37:02 2008 +0000
+++ b/lisp/ChangeLog	Sat Jun 21 04:10:26 2008 +0000
@@ -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.
--- a/lisp/textmodes/rst.el	Sat Jun 21 02:37:02 2008 +0000
+++ b/lisp/textmodes/rst.el	Sat Jun 21 04:10:26 2008 +0000
@@ -406,7 +406,6 @@
   (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 @@
 	(set sym sym)
 	(setq i (1+ i))))))
 
+(rst-define-level-faces)
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3044,15 +3044,21 @@
       ;; 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 @@
 	     (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))))