From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Small gud.el patch Date: Thu, 03 Aug 2006 14:31:41 -0400 Message-ID: References: <87k65pvo5m.fsf@robotron.kosmorama> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1154629932 8037 80.91.229.2 (3 Aug 2006 18:32:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 Aug 2006 18:32:12 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 03 20:32:11 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G8hzK-0005vZ-BK for ged-emacs-devel@m.gmane.org; Thu, 03 Aug 2006 20:32:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G8hzJ-00058i-Ed for ged-emacs-devel@m.gmane.org; Thu, 03 Aug 2006 14:32:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G8hz7-00057d-BN for emacs-devel@gnu.org; Thu, 03 Aug 2006 14:31:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G8hz4-00054H-Dt for emacs-devel@gnu.org; Thu, 03 Aug 2006 14:31:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G8hz4-00053x-6I for emacs-devel@gnu.org; Thu, 03 Aug 2006 14:31:50 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G8i2S-0006YV-27 for emacs-devel@gnu.org; Thu, 03 Aug 2006 14:35:20 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id B6B822CEB5F; Thu, 3 Aug 2006 14:31:48 -0400 (EDT) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 421DA452B; Thu, 3 Aug 2006 14:31:41 -0400 (EDT) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 284436C8CC; Thu, 3 Aug 2006 14:31:41 -0400 (EDT) Original-To: emacs-devel@gnu.org In-Reply-To: <87k65pvo5m.fsf@robotron.kosmorama> (David Hansen's message of "Thu, 03 Aug 2006 17:23:33 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58055 Archived-At: > 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