>From b232d11d6753a98563badc823668214ff32e6d81 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 26 Feb 2019 11:57:53 +0000 Subject: [PATCH 1/3] 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) --- doc/lispref/modes.texi | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 6349dec98b..f4d7f41a62 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1237,6 +1237,7 @@ Example Major Modes (modify-syntax-entry ?\\ ". " st) ;; Add 'p' so M-c on 'hello' leads to 'Hello', not 'hello'. (modify-syntax-entry ?' "w p" st) + @dots{} st) "Syntax table used while in `text-mode'.") @end group @@ -1246,6 +1247,7 @@ Example Major Modes (defvar text-mode-map (let ((map (make-sparse-keymap))) (define-key map "\e\t" 'ispell-complete-word) + @dots{} map) "Keymap for `text-mode'. Many other modes, such as `mail-mode', `outline-mode' and @@ -1289,11 +1291,11 @@ Example Major Modes @smallexample @group ;; @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 - (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 ?# "' 14" table) @@ -1308,10 +1310,9 @@ Example Major Modes @smallexample @group -(defun lisp-mode-variables (&optional syntax keywords-case-insensitive) +(defun lisp-mode-variables (&optional syntax keywords-case-insensitive elisp) (when syntax (set-syntax-table lisp-mode-syntax-table)) - (setq local-abbrev-table lisp-mode-abbrev-table) @dots{} @end group @end smallexample @@ -1322,8 +1323,7 @@ Example Major Modes @smallexample @group - (make-local-variable 'comment-start) - (setq comment-start ";") + (setq-local comment-start ";") @dots{} @end group @end smallexample @@ -1337,6 +1337,7 @@ Example Major Modes @group (defvar lisp-mode-shared-map (let ((map (make-sparse-keymap))) + (set-keymap-parent map prog-mode-map) (define-key map "\e\C-q" 'indent-sexp) (define-key map "\177" 'backward-delete-char-untabify) map) @@ -1351,7 +1352,7 @@ Example Major Modes @group (defvar lisp-mode-map (let ((map (make-sparse-keymap)) - (menu-map (make-sparse-keymap "Lisp"))) + (menu-map (make-sparse-keymap "Lisp"))) (set-keymap-parent map lisp-mode-shared-map) (define-key map "\e\C-x" 'lisp-eval-defun) (define-key map "\C-c\C-z" 'run-lisp) @@ -1375,17 +1376,13 @@ Example Major Modes \\@{lisp-mode-map@} 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 - @group -Entry to this mode calls the value of `lisp-mode-hook' -if that value is non-nil." (lisp-mode-variables nil t) - (set (make-local-variable 'find-tag-default-function) - 'lisp-find-tag-default) - (set (make-local-variable 'comment-start-skip) - "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") + (setq-local find-tag-default-function 'lisp-find-tag-default) + (setq-local comment-start-skip + "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") (setq imenu-case-fold-search t)) @end group @end smallexample -- 2.20.1