unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* custom-set-minor-mode
@ 2005-04-09 22:07 Luc Teirlinck
  2005-04-10 16:48 ` custom-set-minor-mode Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Luc Teirlinck @ 2005-04-09 22:07 UTC (permalink / raw)


Any non-nil value for a minor mode _variable_ is supposed to indicate
an enabled mode.  It would appear that this includes the value 0 and
negative values.  But currently, when set through Custom, such values
disable the mode.

I believe that it is definitely better to use `t' to enable a minor
mode by default through Custom than a random non-nil value like 0.
Otherwise Custom might get confused if something "simplifies" the
non-nil value to `t', as I believe `define-minor-mode' does.  On the
other hand, it is clearly documented that any non-nil value of the
variable indicates an enabled mode.

I can install the following patch, if we want to change this:

===File ~/custom.el-diff====================================
*** custom.el	05 Mar 2005 21:27:39 -0600	1.81
--- custom.el	08 Apr 2005 22:22:22 -0500	
***************
*** 841,848 ****
  this sets the local binding in that buffer instead."
    (if custom-local-buffer
        (with-current-buffer custom-local-buffer
! 	(funcall variable (or value 0)))
!     (funcall variable (or value 0))))
  
  (defun custom-quote (sexp)
    "Quote SEXP iff it is not self quoting."
--- 841,848 ----
  this sets the local binding in that buffer instead."
    (if custom-local-buffer
        (with-current-buffer custom-local-buffer
! 	(funcall variable (if value 1 0)))
!     (funcall variable (if value 1 0))))
  
  (defun custom-quote (sexp)
    "Quote SEXP iff it is not self quoting."
============================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: custom-set-minor-mode
  2005-04-09 22:07 custom-set-minor-mode Luc Teirlinck
@ 2005-04-10 16:48 ` Richard Stallman
  2005-04-11  1:54   ` custom-set-minor-mode Luc Teirlinck
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2005-04-10 16:48 UTC (permalink / raw)
  Cc: emacs-devel

    Otherwise Custom might get confused if something "simplifies" the
    non-nil value to `t', as I believe `define-minor-mode' does.  On the
    other hand, it is clearly documented that any non-nil value of the
    variable indicates an enabled mode.

Yes, any non-nil value *in the variable* should enable the mode.
So your change is clearly correct.

However, 0 as argument to the minor mode function is supposed to turn
the mode off.  Could you verify that still works right afetr your
change?  If it doesn't, another change in another place is probably
needed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: custom-set-minor-mode
  2005-04-10 16:48 ` custom-set-minor-mode Richard Stallman
@ 2005-04-11  1:54   ` Luc Teirlinck
  0 siblings, 0 replies; 3+ messages in thread
From: Luc Teirlinck @ 2005-04-11  1:54 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman wrote:

   However, 0 as argument to the minor mode function is supposed to turn
   the mode off.  Could you verify that still works right afetr your
   change?  If it doesn't, another change in another place is probably
   needed.

Yes, I checked that it still works correctly after my change.  I did
not change anything to minor mode functions, only to `custom-set-minor-mode'.

Sincerely,

Luc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-11  1:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-09 22:07 custom-set-minor-mode Luc Teirlinck
2005-04-10 16:48 ` custom-set-minor-mode Richard Stallman
2005-04-11  1:54   ` custom-set-minor-mode Luc Teirlinck

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).