emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/progmodes/gud.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/gud.el,v
Date: Sat, 10 Feb 2007 20:21:28 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        07/02/10 20:21:28

Index: gud.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/gud.el,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -b -r1.121 -r1.122
--- gud.el      21 Jan 2007 03:20:45 -0000      1.121
+++ gud.el      10 Feb 2007 20:21:28 -0000      1.122
@@ -3177,20 +3177,25 @@
     ("\\$\\(\\w+\\)" (1 font-lock-variable-name-face))
     ("^\\s-*\\(\\w\\(\\w\\|\\s_\\)*\\)" (1 font-lock-keyword-face))))
 
-;; FIXME: The keyword "end" associated with "document"
-;; should have font-lock-keyword-face (currently font-lock-doc-face).
 (defvar gdb-script-font-lock-syntactic-keywords
   '(("^document\\s-.*\\(\n\\)" (1 "< b"))
-    ;; It would be best to change the \n in front, but it's more difficult.
     ("^end\\>"
-     (0 (progn
-          (unless (eq (match-beginning 0) (point-min))
+     (0 (unless (eq (match-beginning 0) (point-min))
+          ;; We change the \n in front, which is more difficult, but results
+          ;; in better highlighting.  If the doc is empty, the single \n is
+          ;; both the beginning and the end of the docstring, which can't be
+          ;; expressed in syntax-tables.  Instead, we place the "> b" after
+          ;; placing the "< b", so the start marker is overwritten by the
+          ;; termination marker and in the end Emacs simply considers that
+          ;; there's no docstring at all, which is fine.
             (put-text-property (1- (match-beginning 0)) (match-beginning 0)
                                'syntax-table (eval-when-compile
                                                (string-to-syntax "> b")))
+          ;; Make sure that rehighlighting the previous line won't erase our
+          ;; syntax-table property.  
             (put-text-property (1- (match-beginning 0)) (match-end 0)
                                'font-lock-multiline t)
-            nil))))))
+          nil)))))
 
 (defun gdb-script-font-lock-syntactic-face (state)
   (cond




reply via email to

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