From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.devel Subject: diary font-lock issue Date: Tue, 16 May 2006 03:22:57 -0400 Message-ID: <8jwtcmqvqm.fsf@fencepost.gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1147764203 25418 80.91.229.2 (16 May 2006 07:23:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 16 May 2006 07:23:23 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 16 09:23:21 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 1Fftth-00076y-6s for ged-emacs-devel@m.gmane.org; Tue, 16 May 2006 09:23:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ffttg-0005Bl-KK for ged-emacs-devel@m.gmane.org; Tue, 16 May 2006 03:23:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FfttU-0005BI-Ke for emacs-devel@gnu.org; Tue, 16 May 2006 03:23:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FfttT-0005B1-KR for emacs-devel@gnu.org; Tue, 16 May 2006 03:23:00 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FfttT-0005Ap-Bv for emacs-devel@gnu.org; Tue, 16 May 2006 03:22:59 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fftw3-0001MO-SO for emacs-devel@gnu.org; Tue, 16 May 2006 03:25:39 -0400 Original-Received: from localhost ([127.0.0.1]) by fencepost.gnu.org with esmtp (Exim 4.34) id 1FfttR-00063d-GH; Tue, 16 May 2006 03:22:57 -0400 Original-To: emacs-devel@gnu.org X-Spook: Rubin UFO munitions BATF offensive information warfare X-Ran: TI*8q<%1=-=+S^oTV|I8k9R0U2>=07Ec`N{Rj!b(.!3a^#76!`Mkx!{N2:jBP1'1_#cJ$G X-Hue: black X-Attribution: GM User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) 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:54563 Archived-At: I'm trying to fix a bug recently reported by Stephen Berman ("Fontification problem with fancy diary") on the pretest-bug list. I'm stumped, and would appreciate some help from people knowledgeable about font-lock. I can simplify the issue to this: elisp: ------- (setq foo-font-lock-keywords '(("\\(\\(?:Fri\\|Mon\\|S\\(?:atur\\|un\\)\\|\\(?:T\\(?:hur\\|ue\\)\\|Wedne\\)s\\)day\\), \\(A\\(?:pril\\|ugust\\)\\|December\\|February\\|J\\(?:anuary\\|u\\(?:ly\\|ne\\)\\)\\|Ma\\(?:rch\\|y\\)\\|\\(?:Novem\\|Octo\\|Septem\\)ber\\) [0-9]+, -?[0-9]+\n=+$" . font-lock-keyword-face))) (define-derived-mode foo-mode fundamental-mode "foo" (set (make-local-variable 'font-lock-defaults) '(foo-font-lock-keywords t)) (set (make-local-variable 'font-lock-multiline) t)) sample input file: ------- Friday, May 5, 2006 =================== 9.00 Xxxx Xxxxxx Xxxxx xXxxxxxxxxxxxx 15.20-15.50 Xxxx Xxxxxxxxxxxxxxxxx 17.30-19.00 Xxxx Xxxxxxxxxx 18.00-19.30 Xxxx XXX Monday, May 8, 2006 =================== 8.00 Xxxxxxxx xx Xxxxxxxx Xxxxxxxxxx xxx Xxxxxxxxxxxxx 14.30 Xxxxxx XxxxxXXxXxxxxx xxx Xxxx 15.30-17.00 Xxxx XxxxxXX 16.45 Xxxx xxx XxxxxXX xxxxxxx 17.15-18.15 Xxxx XxxxxXx Tuesday, May 9, 2006 ==================== 14.50 Xxxx xxx Xxxxxxxxxxxxxxxxxxxxx xxxxxxx 15.30-16.00 Xxxx Wednesday, May 10, 2006 ======================= 20.00-21.15 Xxxxxx Xxxxxx ------ Defining foo-mode as above, and visiting the above example file, the last "Wednesday, May 10, 2006" does not get font-locked. If the "15.30-16.00" line in the immediately previous Tuesday section is not there, it works as it should. Alternatively, if the "\n=+$" part is removed from the font-lock keywords, it works as it should. That made me think it might be a multiline font-lock pattern issue. Hence I added the setting of font-lock-multiline in the mode definition (the diary does not have this), but that did not help. TIA for any help. PS For clarity, the font-lock definition can be replaced by: (setq foo-font-lock-keywords (list (cons (format "%s, %s %s, %s" (regexp-opt '("Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday") t) (regexp-opt '("January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December") t) "[0-9]+" "[0-9]+\n=+$") font-lock-keyword-face)))