emacs-pretest-bug
[Top][All Lists]
Advanced

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

Mismatch between code and explanation for minor modes.


From: David Kastrup
Subject: Mismatch between code and explanation for minor modes.
Date: 23 May 2004 10:11:31 +0200

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the address@hidden mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

The Minor Mode Conventions say:

   * Define a command whose name is the same as the mode variable.  Its
     job is to enable and disable the mode by setting the variable.

     The command should accept one optional argument.  If the argument
     is `nil', it should toggle the mode (turn it on if it is off, and
     off if it is on).  It should turn the mode on if the argument is a
     positive integer, the symbol `t', or a list whose CAR is one of
     those.  It should turn the mode off if the argument is a negative
     integer or zero, the symbol `-', or a list whose CAR is one of
     those.  The meaning of other arguments is not specified.

     Here is an example taken from the definition of
     `transient-mark-mode'.  It shows the use of `transient-mark-mode'
     as a variable that enables or disables the mode's behavior, and
     also shows the proper way to toggle, enable or disable the minor
     mode based on the raw prefix argument value.

          (setq transient-mark-mode
                (if (null arg) (not transient-mark-mode)
                  (> (prefix-numeric-value arg) 0)))

However, (prefix-numeric-value '(-)) evaluates to 1.  According to

     It should turn the mode off if the argument is a negative
     integer or zero, the symbol `-', or a list whose CAR is one of
     those.  The meaning of other arguments is not specified.

(transient-mark-mode '(-)) should turn the mode off, not on.

I don't think one can actually generate '(-) as a raw prefix
argument, but one should either adapt the documentation of the
switches, or the operation of prefix-numeric-value.  I think that
changing the latter will probably be the most expedient.


In GNU Emacs 21.3.50.27 (i686-pc-linux-gnu, GTK+ Version 2.2.1)
 of 2004-05-10 on lola.goethe.zz
configured using `configure '--prefix=/usr/local/emacs-21' '--with-gtk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Major mode: C

Minor modes in effect:
  auto-compression-mode: t
  desktop-save-mode: t
  display-time-mode: t
  iswitchb-mode: t
  recentf-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  unify-8859-on-encoding-mode: t
  line-number-mode: t
  abbrev-mode: t

Recent input:
w M-x s e t - v a <tab> <return> s e n d m <tab> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> m <backspace> s m t <tab> <backspace> <tab> 
C-g <mouse-movement> M-x l o a d - l i <tab> <return> 
s m t p <tab> <return> M-x s e t - v a r <tab> <return> 
s m t p <tab> q u <tab> m <tab> <return> t <return> 
M-x r e p o r t - e m a <tab> <return>

Recent messages:
Mark set
Composing main Info directory...done
Making completion list...
Found `minor mode' in Index.  (`,' tries to find next)
Mark set
Saved text from "DEFUN ("prefix-numeric-value", Fprefix_n"
Making completion list...
Quit
Loading smtpmail...done
Loading emacsbug...done

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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