aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBasil L. Contovounesios2019-02-26 11:57:53 +0000
committerEli Zaretskii2019-03-02 09:19:00 +0200
commita89fabe96396b2197cffc5a9e694004e1c691fa9 (patch)
tree6eaab26b63e26a2f1d71d86d3bda0e5ff5b4af70
parent5ec7ca14d9e8a2eb5bf817dfd47300f73f37ec91 (diff)
downloademacs-a89fabe96396b2197cffc5a9e694004e1c691fa9.tar.gz
emacs-a89fabe96396b2197cffc5a9e694004e1c691fa9.zip
Update example major mode code in Elisp manual
* doc/lispref/modes.texi (Example Major Modes): Update code examples to reflect current state of lisp/textmodes/text-mode.el and lisp/emacs-lisp/lisp-mode.el. (bug#34671)
-rw-r--r--doc/lispref/modes.texi29
1 files changed, 13 insertions, 16 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 13430243298..919816f3dee 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1217,6 +1217,7 @@ the conventions listed above:
1217 (modify-syntax-entry ?\\ ". " st) 1217 (modify-syntax-entry ?\\ ". " st)
1218 ;; Add 'p' so M-c on 'hello' leads to 'Hello', not 'hello'. 1218 ;; Add 'p' so M-c on 'hello' leads to 'Hello', not 'hello'.
1219 (modify-syntax-entry ?' "w p" st) 1219 (modify-syntax-entry ?' "w p" st)
1220 @dots{}
1220 st) 1221 st)
1221 "Syntax table used while in `text-mode'.") 1222 "Syntax table used while in `text-mode'.")
1222@end group 1223@end group
@@ -1226,6 +1227,7 @@ the conventions listed above:
1226(defvar text-mode-map 1227(defvar text-mode-map
1227 (let ((map (make-sparse-keymap))) 1228 (let ((map (make-sparse-keymap)))
1228 (define-key map "\e\t" 'ispell-complete-word) 1229 (define-key map "\e\t" 'ispell-complete-word)
1230 @dots{}
1229 map) 1231 map)
1230 "Keymap for `text-mode'. 1232 "Keymap for `text-mode'.
1231Many other modes, such as `mail-mode', `outline-mode' and 1233Many other modes, such as `mail-mode', `outline-mode' and
@@ -1269,11 +1271,11 @@ illustrate how these modes are written.
1269@smallexample 1271@smallexample
1270@group 1272@group
1271;; @r{Create mode-specific table variables.} 1273;; @r{Create mode-specific table variables.}
1272(defvar lisp-mode-abbrev-table nil) 1274(define-abbrev-table 'lisp-mode-abbrev-table ()
1273(define-abbrev-table 'lisp-mode-abbrev-table ()) 1275 "Abbrev table for Lisp mode.")
1274 1276
1275(defvar lisp-mode-syntax-table 1277(defvar lisp-mode-syntax-table
1276 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table))) 1278 (let ((table (make-syntax-table lisp--mode-syntax-table)))
1277 (modify-syntax-entry ?\[ "_ " table) 1279 (modify-syntax-entry ?\[ "_ " table)
1278 (modify-syntax-entry ?\] "_ " table) 1280 (modify-syntax-entry ?\] "_ " table)
1279 (modify-syntax-entry ?# "' 14" table) 1281 (modify-syntax-entry ?# "' 14" table)
@@ -1288,10 +1290,9 @@ each calls the following function to set various variables:
1288 1290
1289@smallexample 1291@smallexample
1290@group 1292@group
1291(defun lisp-mode-variables (&optional syntax keywords-case-insensitive) 1293(defun lisp-mode-variables (&optional syntax keywords-case-insensitive elisp)
1292 (when syntax 1294 (when syntax
1293 (set-syntax-table lisp-mode-syntax-table)) 1295 (set-syntax-table lisp-mode-syntax-table))
1294 (setq local-abbrev-table lisp-mode-abbrev-table)
1295 @dots{} 1296 @dots{}
1296@end group 1297@end group
1297@end smallexample 1298@end smallexample
@@ -1302,8 +1303,7 @@ variable to handle Lisp comments:
1302 1303
1303@smallexample 1304@smallexample
1304@group 1305@group
1305 (make-local-variable 'comment-start) 1306 (setq-local comment-start ";")
1306 (setq comment-start ";")
1307 @dots{} 1307 @dots{}
1308@end group 1308@end group
1309@end smallexample 1309@end smallexample
@@ -1317,6 +1317,7 @@ common. The following code sets up the common commands:
1317@group 1317@group
1318(defvar lisp-mode-shared-map 1318(defvar lisp-mode-shared-map
1319 (let ((map (make-sparse-keymap))) 1319 (let ((map (make-sparse-keymap)))
1320 (set-keymap-parent map prog-mode-map)
1320 (define-key map "\e\C-q" 'indent-sexp) 1321 (define-key map "\e\C-q" 'indent-sexp)
1321 (define-key map "\177" 'backward-delete-char-untabify) 1322 (define-key map "\177" 'backward-delete-char-untabify)
1322 map) 1323 map)
@@ -1331,7 +1332,7 @@ And here is the code to set up the keymap for Lisp mode:
1331@group 1332@group
1332(defvar lisp-mode-map 1333(defvar lisp-mode-map
1333 (let ((map (make-sparse-keymap)) 1334 (let ((map (make-sparse-keymap))
1334 (menu-map (make-sparse-keymap "Lisp"))) 1335 (menu-map (make-sparse-keymap "Lisp")))
1335 (set-keymap-parent map lisp-mode-shared-map) 1336 (set-keymap-parent map lisp-mode-shared-map)
1336 (define-key map "\e\C-x" 'lisp-eval-defun) 1337 (define-key map "\e\C-x" 'lisp-eval-defun)
1337 (define-key map "\C-c\C-z" 'run-lisp) 1338 (define-key map "\C-c\C-z" 'run-lisp)
@@ -1355,17 +1356,13 @@ Blank lines separate paragraphs. Semicolons start comments.
1355 1356
1356\\@{lisp-mode-map@} 1357\\@{lisp-mode-map@}
1357Note that `run-lisp' may be used either to start an inferior Lisp job 1358Note that `run-lisp' may be used either to start an inferior Lisp job
1358or to switch back to an existing one. 1359or to switch back to an existing one."
1359@end group 1360@end group
1360
1361@group 1361@group
1362Entry to this mode calls the value of `lisp-mode-hook'
1363if that value is non-nil."
1364 (lisp-mode-variables nil t) 1362 (lisp-mode-variables nil t)
1365 (set (make-local-variable 'find-tag-default-function) 1363 (setq-local find-tag-default-function 'lisp-find-tag-default)
1366 'lisp-find-tag-default) 1364 (setq-local comment-start-skip
1367 (set (make-local-variable 'comment-start-skip) 1365 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
1368 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
1369 (setq imenu-case-fold-search t)) 1366 (setq imenu-case-fold-search t))
1370@end group 1367@end group
1371@end smallexample 1368@end smallexample