From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Font-Locking for Allout Mode Date: Thu, 08 Mar 2007 17:42:18 +0100 Organization: University Koblenz-Landau Campus Koblenz Message-ID: <87tzwvlmad.fsf@baldur.tsdh.de> References: <87mz2o3jib.fsf@baldur.tsdh.de> <877itrn86x.fsf@baldur.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1173375646 15511 80.91.229.12 (8 Mar 2007 17:40:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Mar 2007 17:40:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 08 18:40:38 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HPMbO-0005VZ-LO for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2007 18:40:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HPMbc-0006iH-0y for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Mar 2007 12:40:44 -0500 Original-Path: shelby.stanford.edu!newshub.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!news.uni-kl.de!cache.uni-koblenz.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 108 Original-NNTP-Posting-Host: dslb-084-063-029-019.pools.arcor-ip.net Original-X-Trace: cache.uni-koblenz.de 1173372139 1202 84.63.29.19 (8 Mar 2007 16:42:19 GMT) Original-X-Complaints-To: news@cache.uni-koblenz.de Original-NNTP-Posting-Date: Thu, 8 Mar 2007 16:42:19 +0000 (UTC) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVWVlFmseNrkqmgzeif v9JYdoX7Ctb5AAAACXBIWXMAAAsSAAALEgHS3X78AAAACXZwQWcAAAAwAAAAMADO7oxXAAABqUlE QVQ4y8WTy3KkMAxFVQT2Iz/2QOAD3CZ7jNV7YNr//ysjmWcqlUWyGVU11dzjK9myAPwm4P8A963D /TCV06dDeURzkQug8fFm8OYAIT5afRI/DAfQNbzcvhnn/Ud1gD/wTl7rvFHvNc7Fo2GgFJTRe8dA ay/gCV121NAZJto50TlhB0VgQFD4QCwNTMWAZgRCUCOUaMTCMGYHjvBihwC2xYmIoh+It2BZgozR Qo6K6he3oc1g5oTYjRsp4c1ha6BgwG8BSUCZH4SkoApgZigbnEaRBG+rignUDNUQROLiBCwh8dpJ istayMcfQDgrXEN9wB47kM3BwsXNDfjjv7SEi3wBuVfY7UQ6xQeRoNzdhiZeThugh5x/A9gEosHn 3ub+xtCc40OH6ocg8jVXelssj8+TKO+G73a/kRtgk0ySzMk9VYwhSEKDcvcXCFPgIW1aZVYey3AB 3fZpSctqU/FMf68a5rkWfaqWNbV1vya6QN83tWVPpeq6mpcTPNaEKfVpndXcV+kCtufsaeYsrKa0 niDZVi02Wf6lpb05cthffufLTxyfi/wD4S56Bxo/ZasAAAAmelRYdENvbW1lbnQAAHjacy5KTSxJ TVEozyzJUAjJSFVw9/QNAABS5wcjkMtlcAAAABp6VFh0SlBFRy1Db2xvcnNwYWNlAAB42jMCAAAz ADMRFn5jAAAAJ3pUWHRKUEVHLVNhbXBsaW5nLWZhY3RvcnMAAHjaM6ow0jGsMARhABGDAulkDxti AAAAAElFTkSuQmCC User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux) Cancel-Lock: sha1:Rz5MOfyjJiUshPBkxQ7EGLvaEWY= Original-Xref: shelby.stanford.edu gnu.emacs.help:146203 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:41808 Archived-At: Stephen Berman writes: Hi Stehen, > You cannot see the fontified allout headings in emacs lisp mode > because the emacs lisp comment fontification overrides it. No, I don't think so. I fontify TODO and FIXME, too, even though they're fontified with camment-face by default. And I add the new allout keywords with ,----[ ~/.emacs ] | (defun th-font-lock-allout () | (interactive) | (font-lock-add-keywords nil th-allout-font-lock-keywords)) `---- and calling `font-lock-add-keywords' with omitted optional variable HOW should add the new keywords to the beginning of the fontification list, which normally should overwrite mode-specific fontification. At least that's my understanding of the docs. ,----[ C-h f font-lock-add-keywords RET ] | font-lock-add-keywords is a compiled Lisp function in `font-lock.el'. | (font-lock-add-keywords MODE KEYWORDS &optional HOW) [...] | By default they are added at the beginning of the current highlighting list. | If optional argument HOW is `set', they are used to replace the current | highlighting list. If HOW is any other non-nil value, they are added at the | end of the current highlighting list. `---- > If you use allout with a text-mode file, then you'll see the > fontification. Nope, I changed the first line of my .emacs to ;;; -*- mode: text -*- -*-coding: utf-8 -*- but when I opened it no fontification was done, although allout was activated automatically. > I don't know if it's possible to see it in emacs lisp mode; perhaps by > modifying font-locking of lisp comments to exclude lines beginning > with `;;;_'. It has to work. I highlight TODO and FIXME in all programming modes I use with ,----[ ~/.emacs ] | (defvar th-font-lock-modes | '(c-mode c++-mode emacs-lisp-mode lisp-mode ruby-mode haskell-mode)) | | (eval-at-startup | (dolist (mode th-font-lock-modes) | (font-lock-add-keywords | mode | '(("\\<\\(FIXME\\|TODO\\):" 1 font-lock-warning-face t))))) `---- and that works flawlessly. >>> I don't know if this indicates a bug in that code. >> >> I don't get you here. Does that mean that you use a different code >> snippet for allout fontification? If yes, could you post your working >> snippet? > > I use the same code you do (I had also found it on emacswiki and > modified it as you did). What I meant is that I don't know why it's > necessary to add the file local variable for allout-mode (or > alternatively, invoke font-lock-fontify-buffer) to see the > fontification using that code, so maybe the code isn't quite right. Hm, maybe. But I think the "mode: allout" can be omitted nowadays. I guess I use a newer allout-version than you and it switches on if it finds the local variable "allout-layout". ,---- | allout-version is a variable defined in `allout.el'. | Its value is "2.2.1" `---- ,----[ C-h f allout-init RET ] | allout-init is an interactive compiled Lisp function in `allout.el'. | (allout-init &optional MODE) | | Prime `allout-mode' to enable/disable auto-activation, wrt | `allout-layout'. | ^^^^^^^^^^^^^^^ `---- > BTW, when I add ";;mode: allout" to an the Local Variables section of > an Emacs lisp file with an allout-layout specification, I still get > the expected hiding, so it puzzles me that you don't. Did you eval > (allout-init t) before visiting the file? That's in my .emacs. I think that's omitted in the new allout version with respect to allout-layout. Bye, Tassilo -- People say that if you play Microsoft CD's backwards, you hear satanic things, but that's nothing, because if you play them forwards, they install Windows.