all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* indirect-region (make-indirect-buffer) breaks major-mode  fontification
@ 2009-11-17 12:43 senny
  2009-11-17 14:01 ` Lennart Borgman
       [not found] ` <mailman.10887.1258466524.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 12+ messages in thread
From: senny @ 2009-11-17 12:43 UTC (permalink / raw)
  To: help-gnu-emacs

Hey there

I am looking for a way to edit java-script and css snippets in a HTML
document with their corresponding major modes. I've tried some of the
multi major mode solutions but found most of them buggy and performing
slowly. Recently I found the indirect-buffer feature of emacs. This is
exactly what I am looking for but it somehow breaks fontification.
When I clone a region into an indirect buffer the code does not get
highlighted correctly.

This seems only to happen when the original buffer is visible in an
other window. when I only edit the indirect buffer, then fontification
works as expected.

Is there a workaround for this problem?

Regards,
Senny


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
  2009-11-17 12:43 indirect-region (make-indirect-buffer) breaks major-mode fontification senny
@ 2009-11-17 14:01 ` Lennart Borgman
       [not found] ` <mailman.10887.1258466524.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Lennart Borgman @ 2009-11-17 14:01 UTC (permalink / raw)
  To: senny; +Cc: help-gnu-emacs

On Tue, Nov 17, 2009 at 1:43 PM, senny <yves.senn@gmail.com> wrote:
> Hey there
>
> I am looking for a way to edit java-script and css snippets in a HTML
> document with their corresponding major modes. I've tried some of the
> multi major mode solutions but found most of them buggy and performing
> slowly. Recently I found the indirect-buffer feature of emacs. This is
> exactly what I am looking for but it somehow breaks fontification.
> When I clone a region into an indirect buffer the code does not get
> highlighted correctly.
>
> This seems only to happen when the original buffer is visible in an
> other window. when I only edit the indirect buffer, then fontification
> works as expected.
>
> Is there a workaround for this problem?


Perhaps try latest version of nXhtml? Which version have you tried and
what problems did you find. Did you report any bugs in nXhtml?




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
       [not found] ` <mailman.10887.1258466524.2239.help-gnu-emacs@gnu.org>
@ 2009-11-17 14:16   ` senny
  2009-11-17 14:20     ` Joost Kremers
  2009-11-17 15:13     ` Lennart Borgman
  0 siblings, 2 replies; 12+ messages in thread
From: senny @ 2009-11-17 14:16 UTC (permalink / raw)
  To: help-gnu-emacs

On 17 Nov., 15:01, Lennart Borgman <lennart.borg...@gmail.com> wrote:
> On Tue, Nov 17, 2009 at 1:43 PM, senny <yves.s...@gmail.com> wrote:
> > Hey there
>
> > I am looking for a way to edit java-script and css snippets in a HTML
> > document with their corresponding major modes. I've tried some of the
> > multi major mode solutions but found most of them buggy and performing
> > slowly. Recently I found the indirect-buffer feature of emacs. This is
> > exactly what I am looking for but it somehow breaks fontification.
> > When I clone a region into an indirect buffer the code does not get
> > highlighted correctly.
>
> > This seems only to happen when the original buffer is visible in an
> > other window. when I only edit the indirect buffer, then fontification
> > works as expected.
>
> > Is there a workaround for this problem?
>
> Perhaps try latest version of nXhtml? Which version have you tried and
> what problems did you find. Did you report any bugs in nXhtml?

I tried nXhtml when I used emacsW32, which was about two or three
months ago (cant remember the exact version number of nXhtml). The
mode felt kinda clumsy for me. I did not report any errors because I
didn't looked into the details, why things are not working. My
impression of nXhtml was, that it was slowing my cursor movement down
a lot and that it had some unexpected behaviours from time to time.

The other thing is, that I am looking for a flexible solution, I am
editing a lot of different template languages (jsp, esp, rhtml) and
it would be cool to use the same solution for all these cases. Thats
why i was heading for the "indirect-buffer" approach.

Regards,
Senny


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode fontification
  2009-11-17 14:16   ` senny
@ 2009-11-17 14:20     ` Joost Kremers
  2009-11-17 14:40       ` senny
  2009-11-17 15:13     ` Lennart Borgman
  1 sibling, 1 reply; 12+ messages in thread
From: Joost Kremers @ 2009-11-17 14:20 UTC (permalink / raw)
  To: help-gnu-emacs

senny wrote:
> The other thing is, that I am looking for a flexible solution, I am
> editing a lot of different template languages (jsp, esp, rhtml) and
> it would be cool to use the same solution for all these cases. Thats
> why i was heading for the "indirect-buffer" approach.

have you looked at multi-mode.el? it uses the indirect-buffer approach, so
perhaps you're reinventing the wheel?

http://www.emacswiki.org/emacs/MultipleModes


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
  2009-11-17 14:20     ` Joost Kremers
@ 2009-11-17 14:40       ` senny
  0 siblings, 0 replies; 12+ messages in thread
From: senny @ 2009-11-17 14:40 UTC (permalink / raw)
  To: help-gnu-emacs

On 17 Nov., 15:20, Joost Kremers <joostkrem...@yahoo.com> wrote:
> senny wrote:
> > The other thing is, that I am looking for a flexible solution, I am
> > editing a lot of different template languages (jsp, esp, rhtml) and
> > it would be cool to use the same solution for all these cases. Thats
> > why i was heading for the "indirect-buffer" approach.
>
> have you looked at multi-mode.el? it uses the indirect-buffer approach, so
> perhaps you're reinventing the wheel?
>
> http://www.emacswiki.org/emacs/MultipleModes
>
> --
> Joost Kremers                                      joostkrem...@yahoo.com
> Selbst in die Unterwelt dringt durch Spalten Licht
> EN:SiS(9)

I haven't used multi-mode.el but I am willing to give it a try. Is
there a documentation page on how to set up the mode definitions
correctly? I only find the multi-mode.el file, which seems to be only
the framework to enable multiple major modes.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
  2009-11-17 14:16   ` senny
  2009-11-17 14:20     ` Joost Kremers
@ 2009-11-17 15:13     ` Lennart Borgman
       [not found]       ` <ADEECBBC-DEC5-45E1-9A56-C8877DA04F7C@gmail.com>
  1 sibling, 1 reply; 12+ messages in thread
From: Lennart Borgman @ 2009-11-17 15:13 UTC (permalink / raw)
  To: senny; +Cc: help-gnu-emacs

On Tue, Nov 17, 2009 at 3:16 PM, senny <yves.senn@gmail.com> wrote:
> On 17 Nov., 15:01, Lennart Borgman <lennart.borg...@gmail.com> wrote:
>> On Tue, Nov 17, 2009 at 1:43 PM, senny <yves.s...@gmail.com> wrote:
>> > Hey there
>>
>> > I am looking for a way to edit java-script and css snippets in a HTML
>> > document with their corresponding major modes. I've tried some of the
>> > multi major mode solutions but found most of them buggy and performing
>> > slowly. Recently I found the indirect-buffer feature of emacs. This is
>> > exactly what I am looking for but it somehow breaks fontification.
>> > When I clone a region into an indirect buffer the code does not get
>> > highlighted correctly.
>>
>> > This seems only to happen when the original buffer is visible in an
>> > other window. when I only edit the indirect buffer, then fontification
>> > works as expected.
>>
>> > Is there a workaround for this problem?
>>
>> Perhaps try latest version of nXhtml? Which version have you tried and
>> what problems did you find. Did you report any bugs in nXhtml?
>
> I tried nXhtml when I used emacsW32, which was about two or three
> months ago (cant remember the exact version number of nXhtml). The
> mode felt kinda clumsy for me.


Thanks senny. Can you tell more exactly what you think is clumsy?
(nXhtml contains a lot of multi major modes and other things related
to web programming.)


> I did not report any errors because I
> didn't looked into the details, why things are not working.


But can you please tell what it was that did not work for you?


> My
> impression of nXhtml was, that it was slowing my cursor movement down
> a lot


I have made some optimisations since then (or rather removed some
mistakes). If it feels slow you can also byte compile the whole
nXhtml. (There is a menu entry in the nXhtml menu for that to make it
easier.)

But of course any multi major mode solution that is dynamic and checks
for chunk boundaries while you are editing is doing a little bit more.
However I do not think you will notice it very much normally. If you
have an example where it feels slow I would be glad to know. (Please
try the latest version then.)


> and that it had some unexpected behaviours from time to time.


You mean bugs, or? Unfortunately I have no idea what you mean unless
you tell me more.


> The other thing is, that I am looking for a flexible solution, I am
> editing a lot of different template languages (jsp, esp, rhtml) and
> it would be cool to use the same solution for all these cases.


Hm. What do you mean? This exactly what nXhtml gives you, isn't it? Do
you mean that you are not looking for a flexible solution?

If you are missing some special template language then please tell me.


> Thats
> why i was heading for the "indirect-buffer" approach.

> Regards,
> Senny
>




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
       [not found]           ` <453D5202-26FA-4AE5-9AC6-1F4973C42A9B@gmail.com>
@ 2009-11-17 20:28             ` Lennart Borgman
       [not found]             ` <mailman.10926.1258489768.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Lennart Borgman @ 2009-11-17 20:28 UTC (permalink / raw)
  To: Yves Senn, emacs help

On Tue, Nov 17, 2009 at 8:53 PM, Yves Senn <yves.senn@gmail.com> wrote:
>
> Of course there are a lot of features I don't use embedded into emacs.
> But I try not to drop loads of third party code into my configurations when I just need
> a little piece. Its like installing eclipse to edit xml files but I guess thats just my opinion.


No, some people think this way. Others think it is good to get the whole nXhtml.

I have just decided I do not have time to distribute it in pieces. A
lot of people would get their setup wrong. Using multi major modes is
a bit more complicated if you do it yourself.


> The buffer approach is very simple. It lets me write a function that
> lets me edit a part from one buffer in another one with another major-mode.
>
> That would completely accomplish the goal to edit parts with another mode
> and would also allow me to use the features provided by the given mode.
>
>>
>> Maybe you just want to use narrowing in Emacs to edit a part of a buffer?
>
> I use narrowing a lot but it does not allow me to change the current major-mode.
> Another thing, that "indirect" buffers allow me is to edit those parts all at once in different windows.
>
> I know it is not the best solution but for the few occurrences when I am doing html prototyping or SSJS
> it would be enough for sure.


Yes, it can work in many cases. Sometimes the rest of the buffer
interferes so you do not get the syntax hilighting you expect. The
same for indentation.


> Integrated is probably the wrong term. I mean that I am heading for a simple solution
> using the on board mechanisms from emacs (indirect buffers) in this case.


It is perhaps good to try. A lot of people have done so, but after a
while they discover that it does not work as they expected. (That was
how I started too.)


>>> I hope I could make it more clear to you what I tried to mention in my
>>> response.
>>
>>
>> Thanks for trying.
>
> After that discussion I think I will give nXhtml an other shot. When I got some spare
> time I will look more into nXhtml and will send you my thoughts.


Ok, there is a new beta now at

  http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/

This has support for server side javascript. Just do

  M-x ssjs-html-mumamo-mode

to turn it on.


> Regards,
> Senny
>
>
>>
>>
>>> Regards,
>>> Senny
>>>
>>> Am 17.11.2009 um 16:13 schrieb Lennart Borgman:
>>>
>>> On Tue, Nov 17, 2009 at 3:16 PM, senny <yves.senn@gmail.com> wrote:
>>>
>>> On 17 Nov., 15:01, Lennart Borgman <lennart.borg...@gmail.com> wrote:
>>>
>>> On Tue, Nov 17, 2009 at 1:43 PM, senny <yves.s...@gmail.com> wrote:
>>>
>>> Hey there
>>>
>>> I am looking for a way to edit java-script and css snippets in a HTML
>>>
>>> document with their corresponding major modes. I've tried some of the
>>>
>>> multi major mode solutions but found most of them buggy and performing
>>>
>>> slowly. Recently I found the indirect-buffer feature of emacs. This is
>>>
>>> exactly what I am looking for but it somehow breaks fontification.
>>>
>>> When I clone a region into an indirect buffer the code does not get
>>>
>>> highlighted correctly.
>>>
>>> This seems only to happen when the original buffer is visible in an
>>>
>>> other window. when I only edit the indirect buffer, then fontification
>>>
>>> works as expected.
>>>
>>> Is there a workaround for this problem?
>>>
>>> Perhaps try latest version of nXhtml? Which version have you tried and
>>>
>>> what problems did you find. Did you report any bugs in nXhtml?
>>>
>>> I tried nXhtml when I used emacsW32, which was about two or three
>>>
>>> months ago (cant remember the exact version number of nXhtml). The
>>>
>>> mode felt kinda clumsy for me.
>>>
>>>
>>> Thanks senny. Can you tell more exactly what you think is clumsy?
>>> (nXhtml contains a lot of multi major modes and other things related
>>> to web programming.)
>>>
>>>
>>> I did not report any errors because I
>>>
>>> didn't looked into the details, why things are not working.
>>>
>>>
>>> But can you please tell what it was that did not work for you?
>>>
>>>
>>> My
>>>
>>> impression of nXhtml was, that it was slowing my cursor movement down
>>>
>>> a lot
>>>
>>>
>>> I have made some optimisations since then (or rather removed some
>>> mistakes). If it feels slow you can also byte compile the whole
>>> nXhtml. (There is a menu entry in the nXhtml menu for that to make it
>>> easier.)
>>>
>>> But of course any multi major mode solution that is dynamic and checks
>>> for chunk boundaries while you are editing is doing a little bit more.
>>> However I do not think you will notice it very much normally. If you
>>> have an example where it feels slow I would be glad to know. (Please
>>> try the latest version then.)
>>>
>>>
>>> and that it had some unexpected behaviours from time to time.
>>>
>>>
>>> You mean bugs, or? Unfortunately I have no idea what you mean unless
>>> you tell me more.
>>>
>>>
>>> The other thing is, that I am looking for a flexible solution, I am
>>>
>>> editing a lot of different template languages (jsp, esp, rhtml) and
>>>
>>> it would be cool to use the same solution for all these cases.
>>>
>>>
>>> Hm. What do you mean? This exactly what nXhtml gives you, isn't it? Do
>>> you mean that you are not looking for a flexible solution?
>>>
>>> If you are missing some special template language then please tell me.
>>>
>>>
>>> Thats
>>>
>>> why i was heading for the "indirect-buffer" approach.
>>>
>>> Regards,
>>>
>>> Senny
>>>
>>>
>>>
>
>




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
       [not found]             ` <mailman.10926.1258489768.2239.help-gnu-emacs@gnu.org>
@ 2009-11-18  7:54               ` senny
  2009-11-18 13:30                 ` Lennart Borgman
       [not found]                 ` <mailman.10965.1258551083.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 12+ messages in thread
From: senny @ 2009-11-18  7:54 UTC (permalink / raw)
  To: help-gnu-emacs

On 17 Nov., 21:28, Lennart Borgman <lennart.borg...@gmail.com> wrote:
> On Tue, Nov 17, 2009 at 8:53 PM, Yves Senn <yves.s...@gmail.com> wrote:
>
> > Of course there are a lot of features I don't use embedded into emacs.
> > But I try not to drop loads of third party code into my configurations when I just need
> > a little piece. Its like installing eclipse to edit xml files but I guess thats just my opinion.
>
> No, some people think this way. Others think it is good to get the whole nXhtml.
>
> I have just decided I do not have time to distribute it in pieces. A
> lot of people would get their setup wrong. Using multi major modes is
> a bit more complicated if you do it yourself.
>
> > The buffer approach is very simple. It lets me write a function that
> > lets me edit a part from one buffer in another one with another major-mode.
>
> > That would completely accomplish the goal to edit parts with another mode
> > and would also allow me to use the features provided by the given mode.
>
> >> Maybe you just want to use narrowing in Emacs to edit a part of a buffer?
>
> > I use narrowing a lot but it does not allow me to change the current major-mode.
> > Another thing, that "indirect" buffers allow me is to edit those parts all at once in different windows.
>
> > I know it is not the best solution but for the few occurrences when I am doing html prototyping or SSJS
> > it would be enough for sure.
>
> Yes, it can work in many cases. Sometimes the rest of the buffer
> interferes so you do not get the syntax hilighting you expect. The
> same for indentation.
>
> > Integrated is probably the wrong term. I mean that I am heading for a simple solution
> > using the on board mechanisms from emacs (indirect buffers) in this case.
>
> It is perhaps good to try. A lot of people have done so, but after a
> while they discover that it does not work as they expected. (That was
> how I started too.)
>
> >>> I hope I could make it more clear to you what I tried to mention in my
> >>> response.
>
> >> Thanks for trying.
>
> > After that discussion I think I will give nXhtml an other shot. When I got some spare
> > time I will look more into nXhtml and will send you my thoughts.
>
> Ok, there is a new beta now at
>
>  http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/
>
> This has support for server side javascript. Just do
>
>   M-x ssjs-html-mumamo-mode
>
> to turn it on.
>
> > Regards,
> > Senny
>
> >>> Regards,
> >>> Senny
>
> >>> Am 17.11.2009 um 16:13 schrieb Lennart Borgman:
>
> >>> On Tue, Nov 17, 2009 at 3:16 PM, senny <yves.s...@gmail.com> wrote:
>
> >>> On 17 Nov., 15:01, Lennart Borgman <lennart.borg...@gmail.com> wrote:
>
> >>> On Tue, Nov 17, 2009 at 1:43 PM, senny <yves.s...@gmail.com> wrote:
>
> >>> Hey there
>
> >>> I am looking for a way to edit java-script and css snippets in a HTML
>
> >>> document with their corresponding major modes. I've tried some of the
>
> >>> multi major mode solutions but found most of them buggy and performing
>
> >>> slowly. Recently I found the indirect-buffer feature of emacs. This is
>
> >>> exactly what I am looking for but it somehow breaks fontification.
>
> >>> When I clone a region into an indirect buffer the code does not get
>
> >>> highlighted correctly.
>
> >>> This seems only to happen when the original buffer is visible in an
>
> >>> other window. when I only edit the indirect buffer, then fontification
>
> >>> works as expected.
>
> >>> Is there a workaround for this problem?
>
> >>> Perhaps try latest version of nXhtml? Which version have you tried and
>
> >>> what problems did you find. Did you report any bugs in nXhtml?
>
> >>> I tried nXhtml when I used emacsW32, which was about two or three
>
> >>> months ago (cant remember the exact version number of nXhtml). The
>
> >>> mode felt kinda clumsy for me.
>
> >>> Thanks senny. Can you tell more exactly what you think is clumsy?
> >>> (nXhtml contains a lot of multi major modes and other things related
> >>> to web programming.)
>
> >>> I did not report any errors because I
>
> >>> didn't looked into the details, why things are not working.
>
> >>> But can you please tell what it was that did not work for you?
>
> >>> My
>
> >>> impression of nXhtml was, that it was slowing my cursor movement down
>
> >>> a lot
>
> >>> I have made some optimisations since then (or rather removed some
> >>> mistakes). If it feels slow you can also byte compile the whole
> >>> nXhtml. (There is a menu entry in the nXhtml menu for that to make it
> >>> easier.)
>
> >>> But of course any multi major mode solution that is dynamic and checks
> >>> for chunk boundaries while you are editing is doing a little bit more.
> >>> However I do not think you will notice it very much normally. If you
> >>> have an example where it feels slow I would be glad to know. (Please
> >>> try the latest version then.)
>
> >>> and that it had some unexpected behaviours from time to time.
>
> >>> You mean bugs, or? Unfortunately I have no idea what you mean unless
> >>> you tell me more.
>
> >>> The other thing is, that I am looking for a flexible solution, I am
>
> >>> editing a lot of different template languages (jsp, esp, rhtml) and
>
> >>> it would be cool to use the same solution for all these cases.
>
> >>> Hm. What do you mean? This exactly what nXhtml gives you, isn't it? Do
> >>> you mean that you are not looking for a flexible solution?
>
> >>> If you are missing some special template language then please tell me.
>
> >>> Thats
>
> >>> why i was heading for the "indirect-buffer" approach.
>
> >>> Regards,
>
> >>> Senny

Hey Lennart

I just played around with the nxhtml beta you uploaded. The
highlighting seems to work good and the cursor movement relay has been
increased. After just a few minutes using the mode I've got some
complaints tough.
  - When I scroll through pages (using scroll-down and scroll-up) the
performance is poor
  - When I call (cleanup-buffer => starterkit function to indent,
untabify and trailing whitespace removal)
    It takes like 6 seconds to clean the buffer where nxml mode takes
around half a second.
  - There were still some indentation bugs
  - The mode tried to validate the page all the time, which takes
about a second and blocks emacs
I tried everything with the following page: www.postfinance.ch

Regards,
Senny


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
  2009-11-18  7:54               ` senny
@ 2009-11-18 13:30                 ` Lennart Borgman
       [not found]                 ` <mailman.10965.1258551083.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Lennart Borgman @ 2009-11-18 13:30 UTC (permalink / raw)
  To: senny; +Cc: help-gnu-emacs

On Wed, Nov 18, 2009 at 8:54 AM, senny <yves.senn@gmail.com> wrote:
>
>> > After that discussion I think I will give nXhtml an other shot. When I got some spare
>> > time I will look more into nXhtml and will send you my thoughts.
>>
>> Ok, there is a new beta now at
>>
>>  http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/
>>
>> This has support for server side javascript. Just do
>>
>>   M-x ssjs-html-mumamo-mode
>>
>> to turn it on.

> Hey Lennart

Hi Senny,

> I just played around with the nxhtml beta you uploaded. The
> highlighting seems to work good and the cursor movement relay has been
> increased. After just a few minutes using the mode I've got some
> complaints tough.


Thanks for testing.


>  - When I scroll through pages (using scroll-down and scroll-up) the
> performance is poor


It is a bit slower the first time you scroll, since syntax coloring
has to be handled a bit differently. Normally Emacs tries to guess
what to do. It does not check everything from the beginning of the
file before coloring the syntax. It looks a little bit backwards and
tries to guess how to color the syntax.

That is good for many reasons, for example scrolling will be faster.

However when there are multiple major modes in different parts of the
buffer a bit more have to be done. It has to know what major mode (ie
programming language) there is in the part it is going to put syntax
color on.

You may think that the same stategy as above can be used and all that
is needed is to look back a little bit. This was how it worked before
in nXhtml.

It is faster, but unfortunately it often does not work. There were a
lot of complaints about this. So now nXhtml (or rather MuMaMo, part of
nXhtml) looks from the beginning just to decide what major mode to
use. Actually it have to be rather carefully when searching for the
this. MuMaMo caches this information. The first time you scroll
through a piece of the file it may be slow, but after that it will be
faster.

Maybe I should explain this somewhere, but it is a bit hard to know where.


>  - When I call (cleanup-buffer => starterkit function to indent,
> untabify and trailing whitespace removal)
>    It takes like 6 seconds to clean the buffer where nxml mode takes
> around half a second.


Is this for the example you sent me? That sounds a bit strange. Can
you please send me a copy of cleanup-buffer so I can see what it does?

Can you perhaps also try this in a fresh Emacs with just nXhtm loaded
+ just the function cleanup-buffer. To start a fresh Emacs with just
nXhtml you can do

   M-x emacs-Q-nxthml


>  - There were still some indentation bugs


Yes, that is likeley, those are a bit hard. If you tell me more about
what you have seen it might be possible to fix them.


>  - The mode tried to validate the page all the time, which takes
> about a second and blocks emacs


Validation should of course not block Emacs, but if that happens it is
probably due to some interaction with the multi major mode.
Unfortunately the integration of parsers (like the one from nxml-mode)
can not be done very well without rewriting the parsers at the moment.
(I have some ideas for how to do this, but some very deep changes in
Emacs are necessary for them.)

It might be better for you to use it without the parse (but then XHTML
completion disappears too). You can do that by selecting a multi major
mode which have "html" in its name instead of "nxhtml", for example:

   M-x html-mumamo-mode


> I tried everything with the following page: www.postfinance.ch


Thanks. I have tried that too and I works quite good for me (despite my old pc).

I am using latest CVS Emacs (not yet released). What version of Emacs
are you using?

Is there perhaps something special in your .emacs (or some other startup file)?


> Regards,
> Senny




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
       [not found]                 ` <mailman.10965.1258551083.2239.help-gnu-emacs@gnu.org>
@ 2009-11-18 13:52                   ` senny
  2009-11-18 15:44                     ` Lennart Borgman
  0 siblings, 1 reply; 12+ messages in thread
From: senny @ 2009-11-18 13:52 UTC (permalink / raw)
  To: help-gnu-emacs

On 18 Nov., 14:30, Lennart Borgman <lennart.borg...@gmail.com> wrote:
> On Wed, Nov 18, 2009 at 8:54 AM, senny <yves.s...@gmail.com> wrote:
>
> >> > After that discussion I think I will give nXhtml an other shot. When I got some spare
> >> > time I will look more into nXhtml and will send you my thoughts.
>
> >> Ok, there is a new beta now at
>
> >>  http://ourcomments.org/Emacs/DL/elisp/nxhtml/beta/
>
> >> This has support for server side javascript. Just do
>
> >>   M-x ssjs-html-mumamo-mode
>
> >> to turn it on.
> > Hey Lennart
>
> Hi Senny,
>
> > I just played around with the nxhtml beta you uploaded. The
> > highlighting seems to work good and the cursor movement relay has been
> > increased. After just a few minutes using the mode I've got some
> > complaints tough.
>
> Thanks for testing.
>
> >  - When I scroll through pages (using scroll-down and scroll-up) the
> > performance is poor
>
> It is a bit slower the first time you scroll, since syntax coloring
> has to be handled a bit differently. Normally Emacs tries to guess
> what to do. It does not check everything from the beginning of the
> file before coloring the syntax. It looks a little bit backwards and
> tries to guess how to color the syntax.
>
> That is good for many reasons, for example scrolling will be faster.
>
> However when there are multiple major modes in different parts of the
> buffer a bit more have to be done. It has to know what major mode (ie
> programming language) there is in the part it is going to put syntax
> color on.
>
> You may think that the same stategy as above can be used and all that
> is needed is to look back a little bit. This was how it worked before
> in nXhtml.
>
> It is faster, but unfortunately it often does not work. There were a
> lot of complaints about this. So now nXhtml (or rather MuMaMo, part of
> nXhtml) looks from the beginning just to decide what major mode to
> use. Actually it have to be rather carefully when searching for the
> this. MuMaMo caches this information. The first time you scroll
> through a piece of the file it may be slow, but after that it will be
> faster.
>
> Maybe I should explain this somewhere, but it is a bit hard to know where.
>
> >  - When I call (cleanup-buffer => starterkit function to indent,
> > untabify and trailing whitespace removal)
> >    It takes like 6 seconds to clean the buffer where nxml mode takes
> > around half a second.
>
> Is this for the example you sent me? That sounds a bit strange. Can
> you please send me a copy of cleanup-buffer so I can see what it does?
>
> Can you perhaps also try this in a fresh Emacs with just nXhtm loaded
> + just the function cleanup-buffer. To start a fresh Emacs with just
> nXhtml you can do
>
>    M-x emacs-Q-nxthml
>
> >  - There were still some indentation bugs
>
> Yes, that is likeley, those are a bit hard. If you tell me more about
> what you have seen it might be possible to fix them.
>
> >  - The mode tried to validate the page all the time, which takes
> > about a second and blocks emacs
>
> Validation should of course not block Emacs, but if that happens it is
> probably due to some interaction with the multi major mode.
> Unfortunately the integration of parsers (like the one from nxml-mode)
> can not be done very well without rewriting the parsers at the moment.
> (I have some ideas for how to do this, but some very deep changes in
> Emacs are necessary for them.)
>
> It might be better for you to use it without the parse (but then XHTML
> completion disappears too). You can do that by selecting a multi major
> mode which have "html" in its name instead of "nxhtml", for example:
>
>    M-x html-mumamo-mode
>
> > I tried everything with the following page:www.postfinance.ch
>
> Thanks. I have tried that too and I works quite good for me (despite my old pc).
>
> I am using latest CVS Emacs (not yet released). What version of Emacs
> are you using?
>
> Is there perhaps something special in your .emacs (or some other startup file)?
>
> > Regards,
> > Senny

This discussion is probably not the right place to start a discussion
about nXhtml
features and bugs. You should probably name me a place where we can go
into
detail about the bugs I have with nXhtml mode.
To conclude: I am still looking for a fontification fix with the
"indirect" buffer
approach. All the fuzz i just had with one page and nXhtml shows me,
that I am better
served with a quick and dirty solution. I need things to work fast and
work as expected.
Of course there could be conflicts with nXhtml and my .emacs
configuration (which
has grown fairly large and is available here: http://github.com/senny/emacs-configs)
but I don't have the time to dig into nXhtml and figure out how
everything works.

Thanks for your assistance and the fast feedback.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
  2009-11-18 13:52                   ` senny
@ 2009-11-18 15:44                     ` Lennart Borgman
  2009-11-18 16:38                       ` Lennart Borgman
  0 siblings, 1 reply; 12+ messages in thread
From: Lennart Borgman @ 2009-11-18 15:44 UTC (permalink / raw)
  To: senny; +Cc: help-gnu-emacs

On Wed, Nov 18, 2009 at 2:52 PM, senny <yves.senn@gmail.com> wrote:

>> >  - When I call (cleanup-buffer => starterkit function to indent,
>> > untabify and trailing whitespace removal)
>> >    It takes like 6 seconds to clean the buffer where nxml mode takes
>> > around half a second.
>>
>> Is this for the example you sent me? That sounds a bit strange. Can
>> you please send me a copy of cleanup-buffer so I can see what it does?


I tested this a bit more and found that you are right. It is the
indentation that takes so long time - but only when you use a multi
major mode that has nxml-mode as its main mode.

I do not know what to do about it but I will keep it in mind. (I have
one solution in mind right now...)



> This discussion is probably not the right place to start a discussion
> about nXhtml
> features and bugs. You should probably name me a place where we can go
> into
> detail about the bugs I have with nXhtml mode.


Yes, please go to Launchpad, https://bugs.launchpad.net/nxhtml/+bugs
(this is mentioned on EmacsWiki and in nXhtml documentation). I am a
bit curious about what problems you have found.


> To conclude: I am still looking for a fontification fix with the
> "indirect" buffer
> approach. All the fuzz i just had with one page and nXhtml shows me,
> that I am better
> served with a quick and dirty solution. I need things to work fast and
> work as expected.


I have no opinion on that, of course. (I believe you will save time
using nXhtml instead, but that is just me.) Using a personal quick and
dirty solution is indeed sometimes very useful.


> Of course there could be conflicts with nXhtml and my .emacs
> configuration (which
> has grown fairly large and is available here: http://github.com/senny/emacs-configs)
> but I don't have the time to dig into nXhtml and figure out how
> everything works.


It should normally be no problem as long as those things are correct.
I looked at cleanup-buffer and that should work perfectly well with
nXhtml.

The difficult problems I see normally comes from either incorrect code
in users startup files or problem with using nxml-mode parser in multi
major modes. Since the nxml-mode parser also gives a lot back
(completion+validation) I still think it may be useful. (I have turned
off the use of nxml-mode parser by default in Emacs 22 because of
this.)

And of course all my +-1 position type bugs when I write the chunk
dividing functions.


> Thanks for your assistance and the fast feedback.
>




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: indirect-region (make-indirect-buffer) breaks major-mode  fontification
  2009-11-18 15:44                     ` Lennart Borgman
@ 2009-11-18 16:38                       ` Lennart Borgman
  0 siblings, 0 replies; 12+ messages in thread
From: Lennart Borgman @ 2009-11-18 16:38 UTC (permalink / raw)
  To: senny; +Cc: help-gnu-emacs

On Wed, Nov 18, 2009 at 4:44 PM, Lennart Borgman
<lennart.borgman@gmail.com> wrote:
> On Wed, Nov 18, 2009 at 2:52 PM, senny <yves.senn@gmail.com> wrote:
>
>>> >  - When I call (cleanup-buffer => starterkit function to indent,
>>> > untabify and trailing whitespace removal)
>>> >    It takes like 6 seconds to clean the buffer where nxml mode takes
>>> > around half a second.
>>>
>>> Is this for the example you sent me? That sounds a bit strange. Can
>>> you please send me a copy of cleanup-buffer so I can see what it does?
>
>
> I tested this a bit more and found that you are right. It is the
> indentation that takes so long time - but only when you use a multi
> major mode that has nxml-mode as its main mode.
>
> I do not know what to do about it but I will keep it in mind. (I have
> one solution in mind right now...)


I just uploaded a new beta nXhtml 2.02 where this should be fixed.
Thanks for reminding me of the problem.




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-11-18 16:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-17 12:43 indirect-region (make-indirect-buffer) breaks major-mode fontification senny
2009-11-17 14:01 ` Lennart Borgman
     [not found] ` <mailman.10887.1258466524.2239.help-gnu-emacs@gnu.org>
2009-11-17 14:16   ` senny
2009-11-17 14:20     ` Joost Kremers
2009-11-17 14:40       ` senny
2009-11-17 15:13     ` Lennart Borgman
     [not found]       ` <ADEECBBC-DEC5-45E1-9A56-C8877DA04F7C@gmail.com>
     [not found]         ` <e01d8a50911171135g288b67dfk8bcc6d15812a994c@mail.gmail.com>
     [not found]           ` <453D5202-26FA-4AE5-9AC6-1F4973C42A9B@gmail.com>
2009-11-17 20:28             ` Lennart Borgman
     [not found]             ` <mailman.10926.1258489768.2239.help-gnu-emacs@gnu.org>
2009-11-18  7:54               ` senny
2009-11-18 13:30                 ` Lennart Borgman
     [not found]                 ` <mailman.10965.1258551083.2239.help-gnu-emacs@gnu.org>
2009-11-18 13:52                   ` senny
2009-11-18 15:44                     ` Lennart Borgman
2009-11-18 16:38                       ` Lennart Borgman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.