emacs-devel
[Top][All Lists]
Advanced

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

Re: Small gud.el patch


From: Stefan Monnier
Subject: Re: Small gud.el patch
Date: Thu, 03 Aug 2006 14:31:41 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> 1. Wrong coloring of the 'd' in 'end' (syntactic keywords
>    gave the 'd' comment end syntax).

> 2. "end" after a "document" is now colored as a keyword.

IIRC an earlier version of the code did exactly what your patch does.
The problem is that the \n you modify belongs to the previous line, so
you're now dealing with a multiline keyword here.

This causes problems for example if you go and modify the line just before
the "end": the refontification of that line will remove the annotation on
the \n.

I've installed the patch below instead,


        Stefan


Index: lisp/progmodes/gud.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/gud.el,v
retrieving revision 1.114
diff -u -r1.114 gud.el
--- lisp/progmodes/gud.el       13 Jul 2006 21:57:05 -0000      1.114
+++ lisp/progmodes/gud.el       3 Aug 2006 18:29:22 -0000
@@ -3180,7 +3180,15 @@
 (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.
-    ("^en\\(d\\)\\>" (1 "> b"))))
+    ("^end\\>"
+     (0 (progn
+          (unless (eq (match-beginning 0) (point-min))
+            (put-text-property (1- (match-beginning 0)) (match-beginning 0)
+                               'syntax-table (eval-when-compile
+                                               (string-to-syntax "> b")))
+            (put-text-property (1- (match-beginning 0)) (match-end 0)
+                               'font-lock-multiline t)
+            nil))))))
 
 (defun gdb-script-font-lock-syntactic-face (state)
   (cond




reply via email to

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