From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: mathias.dahl@gmail.com Newsgroups: gmane.emacs.help Subject: Some parts of font locking in my new major mode works only after modifying the buffer Date: Sun, 18 Aug 2013 14:04:48 -0700 (PDT) Message-ID: <2f4135d5-2203-4d5f-9c78-9a550c224b55@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1376871812 3917 80.91.229.3 (19 Aug 2013 00:23:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Aug 2013 00:23:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 19 02:23:36 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VBDFw-0003Nj-8V for geh-help-gnu-emacs@m.gmane.org; Mon, 19 Aug 2013 02:23:36 +0200 Original-Received: from localhost ([::1]:40382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBDFv-0007VO-RC for geh-help-gnu-emacs@m.gmane.org; Sun, 18 Aug 2013 20:23:35 -0400 X-Received: by 10.224.173.4 with SMTP id n4mr9818650qaz.3.1376859888112; Sun, 18 Aug 2013 14:04:48 -0700 (PDT) X-Received: by 10.49.11.195 with SMTP id s3mr6025qeb.10.1376859888091; Sun, 18 Aug 2013 14:04:48 -0700 (PDT) Original-Path: usenet.stanford.edu!fx3no2941819qab.0!news-out.google.com!he10ni2338qab.0!nntp.google.com!fx3no2941814qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=193.14.125.107; posting-account=JZUL_goAAACG6LHeukNrrFi20WGR0noj Original-NNTP-Posting-Host: 193.14.125.107 User-Agent: G2/1.0 Injection-Date: Sun, 18 Aug 2013 21:04:48 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:200699 X-Mailman-Approved-At: Sun, 18 Aug 2013 20:23:05 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92968 Archived-At: Hi, I see a strange fenomen with my new major mode. I have only two keyword reg= exps (see below). If I load a file that uses this major mode (or runs the m= ajor mode again, or calls font-lock-fontify-buffer manually), the first par= t of the first non-empty line after a comment line, does not get coloured. = The rest of the text is correctly colored. What's more, if I modify the buf= fer, either the line that has missing colours, or a line before it (I can i= nsert a space, and then delete it), suddenly the missing color is added. I = have tried to understand if there is anything wrong with the regexps but si= nce they work on all other lines, I cannot understand how they would be wro= ng. Here is some example buffer content: 1 Words =3D {Esc} $2 $1; 2=20 3 ### Lines 4 5 New Line =3D {Enter}; 6 Newline Indent =3D {Ctrl+j}; (line numbers are added here, by me) Above, "New Line" on line 5 is not coloured with font-lock-variable-name-fa= ce like it should, but "Newline Indent" on line 6 does. And, again, if I to= uch the buffer before line 5, it suddenly works, even if I later undo that = change. Here is the code: (defvar vocola-mode-syntax-table (let ((st (make-syntax-table))) (modify-syntax-entry ?# "<" st) (modify-syntax-entry ?\n ">" st) (modify-syntax-entry ?\{ "(" st) (modify-syntax-entry ?\} ")" st) st) "Syntax table used while in `vocola-mode'.") (defvar vocola-font-lock-keywords '(("^\\([^=3D]+\\)=3D" 1 font-lock-variable-name-face) ("{\\(.+?\\)}" 1 font-lock-type-face))) (defvar vocola-font-lock-defaults '(vocola-font-lock-keywords nil nil)) ;;;###autoload (define-derived-mode vocola-mode prog-mode "Vocola" "Major mode for editing Vocola speech macro files" (set (make-local-variable 'font-lock-defaults) vocola-font-lock-defaults)= =20 (abbrev-mode 1)) (See http://paste.lisp.org/+2YVF for a colorful version) Any ideas? Thanks! /Mathias