aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-10-30 06:00:10 +0000
committerStefan Monnier2001-10-30 06:00:10 +0000
commit9e59bf581e014fe12dca0514b9ad26dab56f8361 (patch)
tree4bdc46d5a8c784f8efde74980145aa3617f53f44
parent07187d5515984df5565f38325020c1a731b0ad5c (diff)
downloademacs-9e59bf581e014fe12dca0514b9ad26dab56f8361.tar.gz
emacs-9e59bf581e014fe12dca0514b9ad26dab56f8361.zip
(text-mode-map): Remove the \t binding.
(text-mode): Simplify now that the default is more favorable. (paragraph-indent-text-mode): Fix last change.
-rw-r--r--lisp/textmodes/text-mode.el61
1 files changed, 22 insertions, 39 deletions
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index bc142bfc2b7..e35d02a9a30 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -36,35 +36,27 @@
36 :group 'data) 36 :group 'data)
37 37
38(defvar text-mode-variant nil 38(defvar text-mode-variant nil
39 "Non-nil if this buffer's major mode is a variant of Text mode.") 39 "Non-nil if this buffer's major mode is a variant of Text mode.
40 40Use (derived-mode-p 'text-mode) instead.")
41(defvar text-mode-syntax-table nil 41
42 "Syntax table used while in text mode.") 42(defvar text-mode-syntax-table
43 43 (let ((st (make-syntax-table)))
44(defvar text-mode-abbrev-table nil 44 (modify-syntax-entry ?\" ". " st)
45 "Abbrev table used while in text mode.") 45 (modify-syntax-entry ?\\ ". " st)
46(define-abbrev-table 'text-mode-abbrev-table ()) 46 (modify-syntax-entry ?' "w " st)
47 47 st)
48(if text-mode-syntax-table 48 "Syntax table used while in `text-mode'.")
49 () 49
50 (setq text-mode-syntax-table (make-syntax-table)) 50(defvar text-mode-map
51 (modify-syntax-entry ?\" ". " text-mode-syntax-table) 51 (let ((map (make-sparse-keymap)))
52 (modify-syntax-entry ?\\ ". " text-mode-syntax-table) 52 (define-key map "\e\t" 'ispell-complete-word)
53 (modify-syntax-entry ?' "w " text-mode-syntax-table)) 53 (define-key map "\es" 'center-line)
54 54 (define-key map "\eS" 'center-paragraph)
55(defvar text-mode-map nil 55 map)
56 "Keymap for Text mode. 56 "Keymap for `text-mode'.
57Many other modes, such as Mail mode, Outline mode and Indented Text mode, 57Many other modes, such as `mail-mode', `outline-mode' and `indented-text-mode',
58inherit all the commands defined in this map.") 58inherit all the commands defined in this map.")
59 59
60(if text-mode-map
61 ()
62 (setq text-mode-map (make-sparse-keymap))
63 (define-key text-mode-map "\e\t" 'ispell-complete-word)
64 (define-key text-mode-map "\t" 'indent-relative)
65 (define-key text-mode-map "\es" 'center-line)
66 (define-key text-mode-map "\eS" 'center-paragraph))
67
68 60
69(define-derived-mode text-mode nil "Text" 61(define-derived-mode text-mode nil "Text"
70 "Major mode for editing text written for humans to read. 62 "Major mode for editing text written for humans to read.
@@ -73,14 +65,7 @@ You can thus get the full benefit of adaptive filling
73 (see the variable `adaptive-fill-mode'). 65 (see the variable `adaptive-fill-mode').
74\\{text-mode-map} 66\\{text-mode-map}
75Turning on Text mode runs the normal hook `text-mode-hook'." 67Turning on Text mode runs the normal hook `text-mode-hook'."
76 (make-local-variable 'paragraph-start) 68 (set (make-local-variable 'indent-line-function) 'indent-relative))
77 (setq paragraph-start (concat page-delimiter "\\|[ \t]*$"))
78 (if (eq ?^ (aref paragraph-start 0))
79 (setq paragraph-start (substring paragraph-start 1)))
80 (make-local-variable 'paragraph-separate)
81 (setq paragraph-separate paragraph-start)
82 (make-local-variable 'indent-line-function)
83 (setq indent-line-function 'indent-relative-maybe))
84 69
85(define-derived-mode paragraph-indent-text-mode text-mode "Parindent" 70(define-derived-mode paragraph-indent-text-mode text-mode "Parindent"
86 "Major mode for editing text, with leading spaces starting a paragraph. 71 "Major mode for editing text, with leading spaces starting a paragraph.
@@ -91,8 +76,7 @@ Special commands:
91\\{text-mode-map} 76\\{text-mode-map}
92Turning on Paragraph-Indent Text mode runs the normal hooks 77Turning on Paragraph-Indent Text mode runs the normal hooks
93`text-mode-hook' and `paragraph-indent-text-mode-hook'." 78`text-mode-hook' and `paragraph-indent-text-mode-hook'."
94 (paragraph-indent-minor-mode) 79 (paragraph-indent-minor-mode))
95 (run-hooks 'text-mode-hook 'paragraph-indent-text-mode-hook))
96 80
97(defun paragraph-indent-minor-mode () 81(defun paragraph-indent-minor-mode ()
98 "Minor mode for editing text, with leading spaces starting a paragraph. 82 "Minor mode for editing text, with leading spaces starting a paragraph.
@@ -112,8 +96,7 @@ Turning on Paragraph-Indent minor mode runs the normal hook
112(defun text-mode-hook-identify () 96(defun text-mode-hook-identify ()
113 "Mark that this mode has run `text-mode-hook'. 97 "Mark that this mode has run `text-mode-hook'.
114This is how `toggle-text-mode-auto-fill' knows which buffers to operate on." 98This is how `toggle-text-mode-auto-fill' knows which buffers to operate on."
115 (make-local-variable 'text-mode-variant) 99 (set (make-local-variable 'text-mode-variant) t))
116 (setq text-mode-variant t))
117 100
118(add-hook 'text-mode-hook 'text-mode-hook-identify) 101(add-hook 'text-mode-hook 'text-mode-hook-identify)
119 102