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)
This commit is contained in:
Basil L. Contovounesios 2019-02-26 11:57:53 +00:00 committed by Eli Zaretskii
parent 5ec7ca14d9
commit a89fabe963

View file

@ -1217,6 +1217,7 @@ the conventions listed above:
(modify-syntax-entry ?\\ ". " st) (modify-syntax-entry ?\\ ". " st)
;; Add 'p' so M-c on 'hello' leads to 'Hello', not 'hello'. ;; Add 'p' so M-c on 'hello' leads to 'Hello', not 'hello'.
(modify-syntax-entry ?' "w p" st) (modify-syntax-entry ?' "w p" st)
@dots{}
st) st)
"Syntax table used while in `text-mode'.") "Syntax table used while in `text-mode'.")
@end group @end group
@ -1226,6 +1227,7 @@ the conventions listed above:
(defvar text-mode-map (defvar text-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(define-key map "\e\t" 'ispell-complete-word) (define-key map "\e\t" 'ispell-complete-word)
@dots{}
map) map)
"Keymap for `text-mode'. "Keymap for `text-mode'.
Many other modes, such as `mail-mode', `outline-mode' and Many other modes, such as `mail-mode', `outline-mode' and
@ -1269,11 +1271,11 @@ illustrate how these modes are written.
@smallexample @smallexample
@group @group
;; @r{Create mode-specific table variables.} ;; @r{Create mode-specific table variables.}
(defvar lisp-mode-abbrev-table nil) (define-abbrev-table 'lisp-mode-abbrev-table ()
(define-abbrev-table 'lisp-mode-abbrev-table ()) "Abbrev table for Lisp mode.")
(defvar lisp-mode-syntax-table (defvar lisp-mode-syntax-table
(let ((table (copy-syntax-table emacs-lisp-mode-syntax-table))) (let ((table (make-syntax-table lisp--mode-syntax-table)))
(modify-syntax-entry ?\[ "_ " table) (modify-syntax-entry ?\[ "_ " table)
(modify-syntax-entry ?\] "_ " table) (modify-syntax-entry ?\] "_ " table)
(modify-syntax-entry ?# "' 14" table) (modify-syntax-entry ?# "' 14" table)
@ -1288,10 +1290,9 @@ each calls the following function to set various variables:
@smallexample @smallexample
@group @group
(defun lisp-mode-variables (&optional syntax keywords-case-insensitive) (defun lisp-mode-variables (&optional syntax keywords-case-insensitive elisp)
(when syntax (when syntax
(set-syntax-table lisp-mode-syntax-table)) (set-syntax-table lisp-mode-syntax-table))
(setq local-abbrev-table lisp-mode-abbrev-table)
@dots{} @dots{}
@end group @end group
@end smallexample @end smallexample
@ -1302,8 +1303,7 @@ variable to handle Lisp comments:
@smallexample @smallexample
@group @group
(make-local-variable 'comment-start) (setq-local comment-start ";")
(setq comment-start ";")
@dots{} @dots{}
@end group @end group
@end smallexample @end smallexample
@ -1317,6 +1317,7 @@ common. The following code sets up the common commands:
@group @group
(defvar lisp-mode-shared-map (defvar lisp-mode-shared-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(set-keymap-parent map prog-mode-map)
(define-key map "\e\C-q" 'indent-sexp) (define-key map "\e\C-q" 'indent-sexp)
(define-key map "\177" 'backward-delete-char-untabify) (define-key map "\177" 'backward-delete-char-untabify)
map) map)
@ -1355,16 +1356,12 @@ Blank lines separate paragraphs. Semicolons start comments.
\\@{lisp-mode-map@} \\@{lisp-mode-map@}
Note that `run-lisp' may be used either to start an inferior Lisp job Note that `run-lisp' may be used either to start an inferior Lisp job
or to switch back to an existing one. or to switch back to an existing one."
@end group @end group
@group @group
Entry to this mode calls the value of `lisp-mode-hook'
if that value is non-nil."
(lisp-mode-variables nil t) (lisp-mode-variables nil t)
(set (make-local-variable 'find-tag-default-function) (setq-local find-tag-default-function 'lisp-find-tag-default)
'lisp-find-tag-default) (setq-local comment-start-skip
(set (make-local-variable 'comment-start-skip)
"\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
(setq imenu-case-fold-search t)) (setq imenu-case-fold-search t))
@end group @end group