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

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

bug#32643: 26; minor-mode variables


From: Drew Adams
Subject: bug#32643: 26; minor-mode variables
Date: Wed, 5 Sep 2018 08:13:45 -0700 (PDT)

(emacs) `Minor Modes' says "Most minor modes also have a "mode 
variable", with the same name as the mode command."

It doesn't say why some do and some don't.  Why doesn't it?  What's the
answer to that question?  For example, why doesn't variable
`auto-fill-mode' exist?  Shouldn't all minor modes have a variable?
Which ones should?

Beyond the Emacs manual, (elisp) `Minor Mode Conventions' says this:

  Define a variable whose name ends in '-mode'.  We call this the
  "mode variable".  The minor mode command should set this variable.
  The value will be 'nil' if the mode is disabled, and non-'nil' if
  the mode is enabled.  The variable should be buffer-local if the
  minor mode is buffer-local.

  This variable is used in conjunction with the 'minor-mode-alist' to
  display the minor mode name in the mode line.  It also determines
  whether the minor mode keymap is active, via 'minor-mode-map-alist'
  (*note Controlling Active Maps::).  Individual commands or hooks
  can also check its value.

That says that, by convention, minor modes ahould have a variable.
Isn't it then a bug that some provided by Emacs do not?  And shouldn't
the Elisp manual (and perhaps the Emacs manual) give criteria for when a
minor mode should probably not have a variable?

What's more, the same node about conventions says this:

  Define a command, called the "mode command", whose name is the same
  as the mode variable.  Its job is to set the value of the mode
  variable, plus anything else that needs to be done to actually
  enable or disable the mode's features.

That suggests that the primary job of the mode command is to set the
mode variable.  This suggests strongly that it is a bug not to have a
mode variable.

In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-30
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor `Microsoft Corp.', version 10.0.16299
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





reply via email to

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