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: Luc Teirlinck
Subject: Re: enriched-mode and switching major modes.
Date: Sat, 11 Sep 2004 16:51:27 -0500 (CDT)

Stefan Monnier wrote:

   > !     (let ((inhibit-quit t))

   Please don't mess with inhibit-quit unless it's *really* *really* necessary.
   I'd recommend you just stop worrying about `quit' here or else use
   `unwind-protect' if there are cleanup operations that need to be done.

There is nothing time consuming done inside that `inhibit-quit'.
Actually, after this some code in post-command-hook will run (which
automatically prevents quitting) but nothing time consuming is done
there either.

There are several problems.  I could take care of the very bad problem
of `enriched-change-major-mode-flag' not being reset to nil with no
code _explicitly_ inside inhibit-quit and even less time consuming
code in post-command-hook.  But doing this could leave Enriched mode
disabled in buffers in which it should be enabled and these buffers
may not even be current when the user returns.  The disabling was done
behind the user's back, without even notifying the user.  C-x s will
save the buffer in the wrong format.  My code completely avoids this
risk.

Auto Revert mode runs tons of relatively more time consuming stuff
inside an implicit inhibit-quit, and before I started using Tramp, as
well as after we disabled auto-reverting for remote files, this has
never caused me any problems, nor did I see anybody else complain
about such problems.  (Again, except for the Tramp stuff.)

Of course, if somebody accidentally introduces an infinite loop in
`enriched-mode', my inhibit-quit (as well as the use of
post-command-hook) will make a bad problem even worse.  But the same
holds for any function run from a timer, pre- or post-command-hook.

Sincerely,

Luc.
 
 




reply via email to

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