* two-mode: make-local-variable and cpu consumption
@ 2008-02-24 19:25 Peter Münster
2008-02-26 15:29 ` Lennart Borgman (gmail)
2008-03-03 20:29 ` Peter Münster
0 siblings, 2 replies; 9+ messages in thread
From: Peter Münster @ 2008-02-24 19:25 UTC (permalink / raw)
To: Emacs Users
Hello,
I've two problems with two-mode.el:
1.) make-local-variable does not work with default-mode and second-modes:
After (make-local-variable 'default-mode) and
(make-local-variable 'second-modes) new assignments with setq don't have
any effect.
2.) When the current buffer is in two-mode-mode, the cpu usage of emacs is
100%.
Could anybody help please?
Thanks in advance for any hints!
Regards, Peter
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: two-mode: make-local-variable and cpu consumption
2008-02-24 19:25 two-mode: make-local-variable and cpu consumption Peter Münster
@ 2008-02-26 15:29 ` Lennart Borgman (gmail)
2008-03-03 20:29 ` Peter Münster
2008-03-03 20:29 ` Peter Münster
1 sibling, 1 reply; 9+ messages in thread
From: Lennart Borgman (gmail) @ 2008-02-26 15:29 UTC (permalink / raw)
To: Emacs Users
Peter Münster wrote:
> Hello,
>
> I've two problems with two-mode.el:
>
> 1.) make-local-variable does not work with default-mode and second-modes:
> After (make-local-variable 'default-mode) and
> (make-local-variable 'second-modes) new assignments with setq don't have
> any effect.
>
> 2.) When the current buffer is in two-mode-mode, the cpu usage of emacs is
> 100%.
>
> Could anybody help please?
Hi Peter,
Perhaps you want to try MuMaMo:
http://www.emacswiki.org/cgi-bin/wiki/MuMaMo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: two-mode: make-local-variable and cpu consumption
2008-02-24 19:25 two-mode: make-local-variable and cpu consumption Peter Münster
2008-02-26 15:29 ` Lennart Borgman (gmail)
@ 2008-03-03 20:29 ` Peter Münster
1 sibling, 0 replies; 9+ messages in thread
From: Peter Münster @ 2008-03-03 20:29 UTC (permalink / raw)
To: Emacs Users
On Sun, Feb 24 2008, Peter Münster wrote:
> I've two problems with two-mode.el:
>
> 1.) make-local-variable does not work with default-mode and second-modes:
> After (make-local-variable 'default-mode) and
> (make-local-variable 'second-modes) new assignments with setq don't have
> any effect.
Here I'm still looking for any hint.
> 2.) When the current buffer is in two-mode-mode, the cpu usage of emacs is
> 100%.
For this one, I've found the solution: The string of the default-mode must
be exactly the same as indicated in the status-line.
With
(setq default-mode (list "ConTeXt" 'context-mode))
I got the hight cpu-usage.
But with
(setq default-mode (list "PDFConTeXt-en" 'context-mode))
the problem is solved.
Cheers, Peter
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: two-mode: make-local-variable and cpu consumption
2008-02-26 15:29 ` Lennart Borgman (gmail)
@ 2008-03-03 20:29 ` Peter Münster
2008-03-03 20:37 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 9+ messages in thread
From: Peter Münster @ 2008-03-03 20:29 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Users
On Tue, Feb 26 2008, Lennart Borgman (gmail) wrote:
> Perhaps you want to try MuMaMo:
>
> http://www.emacswiki.org/cgi-bin/wiki/MuMaMo
Seems to be quite complicated to set up.
With two-mode, I only need to setup default-mode and second-modes:
(setq default-mode (list "PDFConTeXt-en" 'context-mode))
(setq second-modes (list (list "Lua" "\\startlua" "\\stoplua" 'lua-mode)
(list "MP" "\\startMP" "\\stopMP" 'metapost-mode)))
Cheers, Peter
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: two-mode: make-local-variable and cpu consumption
2008-03-03 20:29 ` Peter Münster
@ 2008-03-03 20:37 ` Lennart Borgman (gmail)
2008-03-03 21:36 ` Peter Münster
0 siblings, 1 reply; 9+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-03 20:37 UTC (permalink / raw)
To: Lennart Borgman (gmail), Emacs Users
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?
Peter Münster wrote:
> On Tue, Feb 26 2008, Lennart Borgman (gmail) wrote:
>
>> Perhaps you want to try MuMaMo:
>>
>> http://www.emacswiki.org/cgi-bin/wiki/MuMaMo
>
> Seems to be quite complicated to set up.
>
> With two-mode, I only need to setup default-mode and second-modes:
>
> (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?
> Cheers, Peter
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: two-mode: make-local-variable and cpu consumption
2008-03-03 20:37 ` Lennart Borgman (gmail)
@ 2008-03-03 21:36 ` Peter Münster
2008-03-03 23:53 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 9+ messages in thread
From: Peter Münster @ 2008-03-03 21:36 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: Emacs Users
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?
% 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
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: two-mode: make-local-variable and cpu consumption
2008-03-03 21:36 ` Peter Münster
@ 2008-03-03 23:53 ` Lennart Borgman (gmail)
2008-03-04 10:32 ` Peter Münster
0 siblings, 1 reply; 9+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-03 23:53 UTC (permalink / raw)
To: Emacs Users
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
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: two-mode: make-local-variable and cpu consumption
2008-03-03 23:53 ` Lennart Borgman (gmail)
@ 2008-03-04 10:32 ` Peter Münster
2008-03-04 18:07 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 9+ messages in thread
From: Peter Münster @ 2008-03-04 10:32 UTC (permalink / raw)
To: Emacs Users
On Tue, Mar 04 2008, Lennart Borgman (gmail) wrote:
> (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?
Ok, I've tested it quickly. Seems to work all right. The ConTeXt part has
another background color, but I suppose that this is configurable.
So thank you for your mode, I'll keep it on my disk, even if it's quite
heavy... ;)
Thanks for your help!
Peter
--
http://pmrb.free.fr/contact/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: two-mode: make-local-variable and cpu consumption
2008-03-04 10:32 ` Peter Münster
@ 2008-03-04 18:07 ` Lennart Borgman (gmail)
0 siblings, 0 replies; 9+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-04 18:07 UTC (permalink / raw)
To: Emacs Users
Peter Münster wrote:
> On Tue, Mar 04 2008, Lennart Borgman (gmail) wrote:
>
>> (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?
>
> Ok, I've tested it quickly. Seems to work all right. The ConTeXt part has
> another background color, but I suppose that this is configurable.
Yes.
> So thank you for your mode, I'll keep it on my disk, even if it's quite
> heavy... ;)
Thanks for testing.
> Thanks for your help!
> Peter
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-03-04 18:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24 19:25 two-mode: make-local-variable and cpu consumption Peter Münster
2008-02-26 15:29 ` Lennart Borgman (gmail)
2008-03-03 20:29 ` Peter Münster
2008-03-03 20:37 ` Lennart Borgman (gmail)
2008-03-03 21:36 ` Peter Münster
2008-03-03 23:53 ` Lennart Borgman (gmail)
2008-03-04 10:32 ` Peter Münster
2008-03-04 18:07 ` Lennart Borgman (gmail)
2008-03-03 20:29 ` Peter Münster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).