all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Small gud.el patch
Date: Thu, 03 Aug 2006 14:31:41 -0400	[thread overview]
Message-ID: <jwvodv1lm1f.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87k65pvo5m.fsf@robotron.kosmorama> (David Hansen's message of "Thu, 03 Aug 2006 17:23:33 +0200")

> 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	other threads:[~2006-08-03 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-03 15:23 Small gud.el patch David Hansen
2006-08-03 18:31 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvodv1lm1f.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.