aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2021-09-25 18:59:37 +0200
committerStefan Kangas2021-09-25 19:02:31 +0200
commit80fddff5d64ff915651eb751685b7430de00c536 (patch)
treeb330e20b6d6701b711c9175989cc461658bade52
parent4778e10572cc3d094f27fafa96426ad81af3794b (diff)
downloademacs-80fddff5d64ff915651eb751685b7430de00c536.tar.gz
emacs-80fddff5d64ff915651eb751685b7430de00c536.zip
Clarify define-derived-mode docstring
* lisp/emacs-lisp/derived.el (define-derived-mode): Doc fixes; correctly mention that the mode name is used in the mode line, clarify argument types, and how the mode hook is named. (Bug17567) (derived-mode-hook-name, derived-mode-map-name) (derived-mode-syntax-table-name, derived-mode-abbrev-table-name): Clarify that argument is a symbol.
-rw-r--r--lisp/emacs-lisp/derived.el22
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 5e9644d823c..9557f3a4634 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -94,19 +94,19 @@
94;;; PRIVATE: defsubst must be defined before they are first used 94;;; PRIVATE: defsubst must be defined before they are first used
95 95
96(defsubst derived-mode-hook-name (mode) 96(defsubst derived-mode-hook-name (mode)
97 "Construct a mode-hook name based on a MODE name." 97 "Construct a mode-hook name based on the symbol MODE."
98 (intern (concat (symbol-name mode) "-hook"))) 98 (intern (concat (symbol-name mode) "-hook")))
99 99
100(defsubst derived-mode-map-name (mode) 100(defsubst derived-mode-map-name (mode)
101 "Construct a map name based on a MODE name." 101 "Construct a map name based on the symbol MODE."
102 (intern (concat (symbol-name mode) "-map"))) 102 (intern (concat (symbol-name mode) "-map")))
103 103
104(defsubst derived-mode-syntax-table-name (mode) 104(defsubst derived-mode-syntax-table-name (mode)
105 "Construct a syntax-table name based on a MODE name." 105 "Construct a syntax-table name based on the symbol MODE."
106 (intern (concat (symbol-name mode) "-syntax-table"))) 106 (intern (concat (symbol-name mode) "-syntax-table")))
107 107
108(defsubst derived-mode-abbrev-table-name (mode) 108(defsubst derived-mode-abbrev-table-name (mode)
109 "Construct an abbrev-table name based on a MODE name." 109 "Construct an abbrev-table name based on the symbol MODE."
110 (intern (concat (symbol-name mode) "-abbrev-table"))) 110 (intern (concat (symbol-name mode) "-abbrev-table")))
111 111
112;; PUBLIC: define a new major mode which inherits from an existing one. 112;; PUBLIC: define a new major mode which inherits from an existing one.
@@ -120,7 +120,7 @@ The arguments are as follows:
120CHILD: the name of the command for the derived mode. 120CHILD: the name of the command for the derived mode.
121PARENT: the name of the command for the parent mode (e.g. `text-mode') 121PARENT: the name of the command for the parent mode (e.g. `text-mode')
122 or nil if there is no parent. 122 or nil if there is no parent.
123NAME: a string which will appear in the status line (e.g. \"Hypertext\") 123NAME: a string that will appear in the mode line (e.g. \"HTML\")
124DOCSTRING: an optional documentation string--if you do not supply one, 124DOCSTRING: an optional documentation string--if you do not supply one,
125 the function will attempt to invent something useful. 125 the function will attempt to invent something useful.
126KEYWORD-ARGS: 126KEYWORD-ARGS:
@@ -132,12 +132,12 @@ KEYWORD-ARGS:
132 to this mode. The command `customize-mode' uses this. 132 to this mode. The command `customize-mode' uses this.
133 :syntax-table TABLE 133 :syntax-table TABLE
134 Use TABLE instead of the default (CHILD-syntax-table). 134 Use TABLE instead of the default (CHILD-syntax-table).
135 A nil value means to simply use the same syntax-table 135 TABLE should be an unquoted symbol. A nil value means
136 as the parent. 136 to simply use the same syntax-table as the parent.
137 :abbrev-table TABLE 137 :abbrev-table TABLE
138 Use TABLE instead of the default (CHILD-abbrev-table). 138 Use TABLE instead of the default (CHILD-abbrev-table).
139 A nil value means to simply use the same abbrev-table 139 TABLE should be an unquoted symbol. A nil value means
140 as the parent. 140 to simply use the same abbrev-table as the parent.
141 :after-hook FORM 141 :after-hook FORM
142 A single Lisp form which is evaluated after the mode 142 A single Lisp form which is evaluated after the mode
143 hooks have been run. It should not be quoted. 143 hooks have been run. It should not be quoted.
@@ -166,8 +166,8 @@ the parent, and then sets the variable `case-fold-search' to nil:
166Note that if the documentation string had been left out, it would have 166Note that if the documentation string had been left out, it would have
167been generated automatically, with a reference to the keymap. 167been generated automatically, with a reference to the keymap.
168 168
169The new mode runs the hook constructed by the function 169The new mode runs the hook named MODE-hook. For `foo-mode',
170`derived-mode-hook-name'. 170the hook will be named `foo-mode-hook'.
171 171
172See Info node `(elisp)Derived Modes' for more details. 172See Info node `(elisp)Derived Modes' for more details.
173 173