help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: two-mode: make-local-variable and cpu consumption


From: Lennart Borgman (gmail)
Subject: Re: two-mode: make-local-variable and cpu consumption
Date: Tue, 04 Mar 2008 00:53:16 +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

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]