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

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

Re: Major and minor modes


From: Héctor Lahoz
Subject: Re: Major and minor modes
Date: Wed, 14 Jun 2017 09:40:04 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Emanuel Berg wrote:
> In principle I suppose you can have as many
> minor modes as you want for any major mode but
> it isn't difficult to predict a scenario where
> the minor modes contradict each other and/or
> work in opposite ways to what makes sense for
> the underlying major mode.
> 
> I never heard of anyone putting up fences in
> their code to prevent that, and it is a good
> thing they didn't as that would make all code
> interdependent and besides people aren't that
> stupid to setup a system that doesn't make
> sense anyway. And if they are, let's go
> nuts already.

Interesting matter. I have never thought of it
thoroughly but it seems it is more difficult
to write a minor mode. Because a minor mode
doesn't know what other minor modes are in
effect when it is running (environment).

Then I have this question. One major mode is
suitable for a type of data. Everything is text
but it is formatted differently. Usually in the
same buffer you have several sections with
different types. So, for example, you could have
some C code, then some text and then an ASCII
picture. What I do is changing the major mode
as I edit the different sections. Is there
some way to tell Emacs what major mode should
be used for each section so it can switch the mode
automatically when point enters that section?

Besides, major modes usually handle the buffer
as a whole thing for parsing and that stuff.



reply via email to

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