emacs-devel
[Top][All Lists]
Advanced

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

Re: highlight-changes-mode


From: rsharman
Subject: Re: highlight-changes-mode
Date: Sat, 9 Dec 2006 14:40:33 -0500

Richard Stallman writes:
 >     The current implementation allows the situation where a user no longer
 >     wants it turned on by default, but has an existing buffer that has
 >     some changes already highlighted.  If disabling the global mode
 >     automatically disables highlight changes modes in that buffer, then
 >     the highlighting of the changes disappears; we have lost information.
 > 
 > That is clearly true.  The question is whether this is a useful feature
 > that we want, or whether it is better to make this mode like the others.


Personally I think it is useful. 

I certainly have no problems with global-highlight-changes always
turning on the mode in all buffers.  It is only the unconditional
turning off that I have qualms with.

Can I suggest a compromise?

The default behaviour is changed to always affect existing buffers in
both enabling and disabling.  All references to the variable 
highlight-changes-global-changes-existing-buffers are removed.

A new variable highlight-changes-mode-turn-off-fn can be set to a
function to be called to [optionally] turn off the mode in a buffer.
If set to nil (the default) the mode is turned off unconditionally.

This is implemented by a different change to define-global-minor-mode
from what I'd suggested earlier.  Instead of the :only-new keyword 
there is a :turn-off keyword.  If specified this function is called
instead of the mode being turned off directly.  It is a
more symmetric change than the previous one.


(defvar highlight-changes-mode-turn-off-fn nil
  "*If non-nil, a function to maybe turn off highlight changes mode.
It is called by global-highlight-changes when the mode is turned off.
The default setting of nil causes highlight changes mode to be
disabled in all buffers.")

(defun highlight-changes-mode-turn-off ()
  (if highlight-changes-mode-turn-off-fn
      (funcall highlight-changes-mode-turn-off-fn)
    (highlight-changes-mode -1)))


So to summarize,  the default behaviour is as you prefer, but we allow
a user to override it




reply via email to

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