emacs-devel
[Top][All Lists]
Advanced

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

Re: enriched-mode and switching major modes.


From: Oliver Scholz
Subject: Re: enriched-mode and switching major modes.
Date: Mon, 06 Sep 2004 09:36:21 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (windows-nt)

Richard Stallman <address@hidden> writes:

>       `enriched-mode' sets
>     buffer-local values for these variables, but when the major mode is
>     set by `after-find-file', these variables are killed.
>
> It sounds like enriched-mode is called too early.
> What is the command that you give?
>
>     One solution is to make Enriched mode into a major mode.  It already
>     very much "feels" like one.
>
>     The other solution would be to make all variables that Enriched mode
>     needs to set permanent locals.  For `use-hard-newlines' we already
>     decided that there was no problem. 
>
> The former is acceptable, but not really nice.

IMO opinion enriched-mode actually serves two purposes: (1) editing of
(very restricted) WP-like documents in the format text/enriched (2) a
means to save the colours that appear in a buffer in a file.

The difference is subtle. A usage scenario of type (1) would be, for
example, that I'd want to keep notes with some text properties in a
file. I'd create that file for this purpose, use text-mode as a major
mode, turn on enriched-mode and then specify myself explicitely which
text properties to use with M-g. A usage scenario of type (2) would
be, that I have a buffer that got its text properties from some Elisp
function and I want to save that buffer to a file, while also saving
the text-properties -- or at least the colours. For instance, when I
save my IRC logs (from ERC), I turn on enriched-mode before that.

As (1) enriched-mode should clearly be a major mode IMO, a derivative
of text-mode. If, for instance, a user wants to keep notes in a file
in the format text/enriched, then I can't actually see the point of
having text/enriched as a minor mode that is used together with
text-mode instead of just being a major mode.

As (2) it should be a minor mode, of course. However, currently some
of enriched-mode's features that make it suitable for (1) get in the
way here. For example I can't just turn on enriched-mode in an ERC
buffer, because enriched-mode rebinds RET. As a minor mode, it should
only affect the way a buffer is saved to a file and nothing else.

So I'd suggest to make enriched-mode a major mode and create a new
additional minor mode for the purpose of (2).

There is a technical problem with making it a major mode: currently
format.el expects modes specified in `format-alist' to be minor
modes.  However, fixing this would be an improvement anyways.

But maybe this all can wait until after the release.  I believe that
(1) is the way it is used most of the time.

    Oliver
-- 
Oliver Scholz               21 Fructidor an 212 de la Révolution
Ostendstr. 61               Liberté, Egalité, Fraternité!
60314 Frankfurt a. M.       




reply via email to

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