From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/minor-mode-conventions.html | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 devdocs/elisp/minor-mode-conventions.html (limited to 'devdocs/elisp/minor-mode-conventions.html') diff --git a/devdocs/elisp/minor-mode-conventions.html b/devdocs/elisp/minor-mode-conventions.html new file mode 100644 index 00000000..ab711037 --- /dev/null +++ b/devdocs/elisp/minor-mode-conventions.html @@ -0,0 +1,41 @@ +

Conventions for Writing Minor Modes

There are conventions for writing minor modes just as there are for major modes (see Major Modes). These conventions are described below. The easiest way to follow them is to use the macro define-minor-mode. See Defining Minor Modes.

In addition, several major mode conventions (see Major Mode Conventions) apply to minor modes as well: those regarding the names of global symbols, the use of a hook at the end of the initialization function, and the use of keymaps and other tables.

The minor mode should, if possible, support enabling and disabling via Custom (see Customization). To do this, the mode variable should be defined with defcustom, usually with :type 'boolean. If just setting the variable is not sufficient to enable the mode, you should also specify a :set method which enables the mode by invoking the mode command. Note in the variable’s documentation string that setting the variable other than via Custom may not take effect. Also, mark the definition with an autoload cookie (see autoload cookie), and specify a :require so that customizing the variable will load the library that defines the mode. For example:

;;;###autoload
+(defcustom msb-mode nil
+  "Toggle msb-mode.
+Setting this variable directly does not take effect;
+use either \\[customize] or the function `msb-mode'."
+  :set 'custom-set-minor-mode
+  :initialize 'custom-initialize-default
+  :version "20.4"
+  :type    'boolean
+  :group   'msb
+  :require 'msb)
+
+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Minor-Mode-Conventions.html +

+
-- cgit v1.2.3