[Top][All Lists]

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

Re: enriched-mode and switching major modes.

From: Luc Teirlinck
Subject: Re: enriched-mode and switching major modes.
Date: Sat, 11 Sep 2004 20:46:15 -0500 (CDT)

Stefan Monnier wrote:

   It seems you don't realize that a lot of elisp code suffers from such
   "not 100% correct state if C-g is hit at the wrong moment".  It's not such
   a big deal.

It is a big deal if the nature of the inconsistent state is not obvious.
In this case the situation is particularly bad, because even
immediately doing C-x C-c after the quit may result in buffers being
saved in the wrong format.

   you can do

   !       (add-to-list 'enriched-marked-buffers (current-buffer))))
   !       (setq enriched-change-major-mode-flag t)
   !       (enriched-mode 0)

No, because enriched-mode sets enriched-change-major-mode-flag to nil,
(It has to.)

   !       (add-to-list 'enriched-marked-buffers (current-buffer))))
   !       (setq enriched-change-major-mode-flag t)
   !       (let (enriched-change-major-mode-flag)
   !         (enriched-mode 0))

would be less bad.  But even that would give problems if a quit happened
during the execution of enriched-mode.

Ayway, why try to find half-baked solutions to a completely
_non-existent_ problem?  `inhibit-quit' is only a problem around code
that can take a non-trivial time to execute.

   Oh, and please don't go through details like mentioning with-local-quit
   when it's just one of many possible cases (and especially since the cause
   of the "problem" is not with-local-quit, but just the `quit' itself).

It is because of `with-local-quit' that more than one buffer can be
involved.  That could not happen with an error or a regular quit.
(Unless the error was handled in a way similar to `with-local-quit'.)

   BTW, looking at the enriched-mode code, I'm wondering whether all this
   fiddling is necessary.  After all the variables it sets are:

Eventually Enriched mode will need to set more variables.  It is not a
major mode but feels very much like one.

>From other people's reactions it would seem that the two major
alternatives are my patch (or some variation thereof) and simply
making enriched-mode into a major mode.

I do not object against making enriched-mode into a major mode.  It
would be a lot _simpler_ than the solution I implemented.  But note
that after my patch you can use Enriched mode as a major mode _anyway_
(for all practical purposes) by combining it with fundamental mode.
But you can also combine it with any other major mode that is
"compatible" with Enriched mode.  So you get extra flexibility for the
added complexity.


   - use-hard-newlines: we agreed this should also be permanent-local.

It now is.  (I installed that.)



reply via email to

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