From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.help Subject: Re: two-mode: make-local-variable and cpu consumption Date: Tue, 04 Mar 2008 00:53:16 +0100 Message-ID: <47CC8F6C.7040004@gmail.com> References: <20080224192529.GA945@gaston.couberia.bzh> <47C4305C.5040002@gmail.com> <20080303202956.GB25919@gaston.couberia.bzh> <47CC619C.5030507@gmail.com> <20080303213634.GA23462@gaston.couberia.bzh> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1204588467 11717 80.91.229.12 (3 Mar 2008 23:54:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Mar 2008 23:54:27 +0000 (UTC) To: Emacs Users Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 04 00:54:52 2008 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 1JWKUa-0007jf-Ll for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Mar 2008 00:54:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JWKU2-0007pu-IN for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Mar 2008 18:54:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JWKTn-0007oh-Ux for help-gnu-emacs@gnu.org; Mon, 03 Mar 2008 18:53:59 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JWKTj-0007nb-V1 for help-gnu-emacs@gnu.org; Mon, 03 Mar 2008 18:53:59 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JWKTj-0007nY-MM for help-gnu-emacs@gnu.org; Mon, 03 Mar 2008 18:53:55 -0500 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JWKTh-000682-PO for help-gnu-emacs@gnu.org; Mon, 03 Mar 2008 18:53:55 -0500 Original-Received: from c83-254-148-228.bredband.comhem.se ([83.254.148.228]:64259 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1JWKTZ-0003Pi-6X for help-gnu-emacs@gnu.org; Tue, 04 Mar 2008 00:53:47 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: <20080303213634.GA23462@gaston.couberia.bzh> X-Antivirus: avast! (VPS 080303-0, 2008-03-03), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.148.228 X-Scan-Result: No virus found in message 1JWKTZ-0003Pi-6X. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1JWKTZ-0003Pi-6X 5da368e92e415b2cc39ff693b8d2739d X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) 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:52031 Archived-At: Peter Münster wrote: > On Mon, Mar 03 2008, Lennart Borgman (gmail) wrote: > >> Yes, it is bit complex. However that is normally nothing you see as a user. >> But I see it, I am still struggling with some problems with refontification >> after changes... ;-) >> >> Could you perhaps send me an example of a file with those two modes? Ok, thanks Peter, that finally gave me a reason to fix some code in MuMaMo to make these things simple. I have just uploaded a new beta of nXhtml here: http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/ If you use that beta with the following little code you will get what you want I believe: (mumamo-easy-make-chunk-fun mumamo-test-lua-chunk "\\startluacode" "\\stopluacode" 'lua-mode) (mumamo-easy-make-chunk-fun mumamo-test-MP-chunk "\\startMPcode" "\\stopMPcode" 'metapost-mode) (define-mumamo-turn-on test-lua-and-MP "Just a quick test with lua and MP." ("lua MP test" context-mode (mumamo-test-lua-chunk mumamo-test-MP-chunk))) Though I don't have lua-mode and context-mode here so I have not tested. Do you want to test? > % engine=luatex > \startluacode > -- here is lua-mode > local function sort_table(s1, s2) > local function cmp(a, b) > if s2 ~= "" and a[s1] == b[s1] then > return a[s2] < b[s2] > else > return a[s1] < b[s1] > end > end > if s1 ~= "" then > table.sort(thirddata.inifile.t, cmp) > end > end > \stopluacode > \starttext > % here is context-mode > \startitemize > \item bla bla bla > \item bla bla bla > \item bla bla bla > \item bla bla bla > \stopitemize > > \startMPcode > % here is metapost-mode > path p; > p := ((0,0)--(1,0)--(1,2)--(-0.5,2)--(-0.5,1)--(0,1)--cycle) scaled 1cm; > draw p; > \stopMPcode > \stoptext > >>> (setq default-mode (list "PDFConTeXt-en" 'context-mode)) >>> (setq second-modes (list (list "Lua" "\\startlua" "\\stoplua" 'lua-mode) >>> (list "MP" "\\startMP" "\\stopMP" 'metapost-mode))) >> What markup does two-modes expect to see in the buffer then? > > The main markup is ConTeXt, inside \startlua...\stoplua it's lua and inside > \startMP...\stopMP it's metapost. > > Cheers, Peter >