]> git.eshelyaron.com Git - emacs.git/commitdiff
Document that mode commands should be idempotent.
authorPhilipp Stephani <phst@google.com>
Sun, 8 Oct 2017 15:25:31 +0000 (17:25 +0200)
committerPhilipp Stephani <phst@google.com>
Thu, 21 Dec 2017 20:49:08 +0000 (21:49 +0100)
* doc/lispref/modes.texi (Major Mode Conventions, Minor Mode
Conventions): Document that the mode commands should be idempotent.

doc/lispref/modes.texi

index bd94aeadf153561119f764f1835ba37a3ee81404..1a601baee869d9e2f620965dbb044211771239d1 100644 (file)
@@ -313,6 +313,11 @@ The major mode command should set the variable @code{mode-name} to the
 Data}, for other possible forms).  The name of the mode appears
 in the mode line.
 
+@item
+Calling the major mode command twice in direct succession should not
+fail and should do the same thing as calling the command only once.
+In other words, the major mode command should be idempotent.
+
 @item
 @cindex functions in modes
 Since all global names are in the same name space, all the global
@@ -1412,6 +1417,10 @@ a minor mode in a mode hook is a little uglier:
 @noindent
 However, this is not very commonly done.
 
+  Enabling or disabling a minor mode twice in direct succession should
+not fail and should do the same thing as enabling or disabling it only
+once.  In other words, the minor mode command should be idempotent.
+
 @item
 Add an element to @code{minor-mode-alist} for each minor mode
 (@pxref{Definition of minor-mode-alist}), if you want to indicate the