aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-06-03 04:27:53 +0000
committerRichard M. Stallman1997-06-03 04:27:53 +0000
commit6824710a86581e7008d2c5d709b54c16f696ba5d (patch)
treec73a89cf960c4cf536142670a29cb6146bcca1de
parent64dde95b4774dc33a5f52af8356edfacf7eceaec (diff)
downloademacs-6824710a86581e7008d2c5d709b54c16f696ba5d.tar.gz
emacs-6824710a86581e7008d2c5d709b54c16f696ba5d.zip
(spaced-text-mode): Renamed from text-mode.
But change the mode name and hooks. (text-mode): Put the guts of indented-text-mode here. But don't define text-mode-abbrev-table, just use it. Don't set indent-line-function, and use text-mode-map. (indented-text-mode): Call text-mode.
-rw-r--r--lisp/textmodes/text-mode.el62
1 files changed, 33 insertions, 29 deletions
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index ab8895e9872..e7bd36ad695 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -56,26 +56,41 @@ inherit all the commands defined in this map.")
56 (define-key text-mode-map "\eS" 'center-paragraph)) 56 (define-key text-mode-map "\eS" 'center-paragraph))
57 57
58 58
59;(defun non-saved-text-mode ()
60; "Like text-mode, but delete auto save file when file is saved for real."
61; (text-mode)
62; (make-local-variable 'delete-auto-save-files)
63; (setq delete-auto-save-files t))
64
65(defun text-mode () 59(defun text-mode ()
66 "Major mode for editing text intended for humans to read. 60 "Major mode for editing text written for humans to read.
67Special commands: 61In this mode, paragraphs are delimited only by blank lines.
62You can thus get the full benefit of adaptive filling
63 (see the variable `adaptive-fill-mode').
68\\{text-mode-map} 64\\{text-mode-map}
69Turning on Text mode calls the value of the variable `text-mode-hook', 65Turning on Text mode runs the normal hook `text-mode-hook'."
70if that value is non-nil."
71 (interactive) 66 (interactive)
72 (kill-all-local-variables) 67 (kill-all-local-variables)
73 (use-local-map text-mode-map) 68 (use-local-map text-mode-map)
69 (setq local-abbrev-table text-mode-abbrev-table)
70 (set-syntax-table text-mode-syntax-table)
71 (make-local-variable 'paragraph-start)
72 (setq paragraph-start (concat "$\\|" page-delimiter))
73 (make-local-variable 'paragraph-separate)
74 (setq paragraph-separate paragraph-start)
74 (setq mode-name "Text") 75 (setq mode-name "Text")
75 (setq major-mode 'text-mode) 76 (setq major-mode 'text-mode)
77 (run-hooks 'text-mode-hook))
78
79(defun spaced-text-mode ()
80 "Major mode for editing text, with leading spaces starting a paragraph.
81In this mode, you do not need blank lines between paragraphs
82when the first line of the following paragraph starts with whitespace.
83Special commands:
84\\{text-mode-map}
85Turning on Spaced Text mode runs the normal hook `spaced-text-mode-hook'."
86 (interactive)
87 (kill-all-local-variables)
88 (use-local-map text-mode-map)
89 (setq mode-name "Spaced Text")
90 (setq major-mode 'spaced-text-mode)
76 (setq local-abbrev-table text-mode-abbrev-table) 91 (setq local-abbrev-table text-mode-abbrev-table)
77 (set-syntax-table text-mode-syntax-table) 92 (set-syntax-table text-mode-syntax-table)
78 (run-hooks 'text-mode-hook)) 93 (run-hooks 'text-mode-hook 'spaced-text-mode-hook))
79 94
80(defvar indented-text-mode-map () 95(defvar indented-text-mode-map ()
81 "Keymap for Indented Text mode. 96 "Keymap for Indented Text mode.
@@ -88,28 +103,17 @@ All the commands defined in Text mode are inherited unless overridden.")
88 (let ((newmap (make-sparse-keymap))) 103 (let ((newmap (make-sparse-keymap)))
89 (define-key newmap "\t" 'indent-relative) 104 (define-key newmap "\t" 'indent-relative)
90 (setq indented-text-mode-map (nconc newmap text-mode-map)))) 105 (setq indented-text-mode-map (nconc newmap text-mode-map))))
91 106
92(defun indented-text-mode () 107(defun indented-text-mode ()
93 "Major mode for editing text with indented paragraphs. 108 "Major mode for editing text which is often indented.
94In this mode, paragraphs are delimited only by blank lines. 109This is like Text mode except that TAB runs `indent-relative'.
95You can thus get the benefit of adaptive filling 110\\{text-mode-map}
96 (see the variable `adaptive-fill-mode'). 111Turning on Indented Text mode runs the normal hook `indented-text-mode-hook'."
97\\{indented-text-mode-map}
98Turning on `indented-text-mode' calls the value of the variable
99`text-mode-hook', if that value is non-nil."
100 (interactive) 112 (interactive)
101 (kill-all-local-variables) 113 (text-mode)
102 (use-local-map text-mode-map) 114 (use-local-map indented-text-mode-map)
103 (define-abbrev-table 'text-mode-abbrev-table ())
104 (setq local-abbrev-table text-mode-abbrev-table)
105 (set-syntax-table text-mode-syntax-table)
106 (make-local-variable 'indent-line-function) 115 (make-local-variable 'indent-line-function)
107 (setq indent-line-function 'indent-relative-maybe) 116 (setq indent-line-function 'indent-relative-maybe)
108 (make-local-variable 'paragraph-start)
109 (setq paragraph-start (concat "$\\|" page-delimiter))
110 (make-local-variable 'paragraph-separate)
111 (setq paragraph-separate paragraph-start)
112 (use-local-map indented-text-mode-map)
113 (setq mode-name "Indented Text") 117 (setq mode-name "Indented Text")
114 (setq major-mode 'indented-text-mode) 118 (setq major-mode 'indented-text-mode)
115 (run-hooks 'text-mode-hook 'indented-text-mode-hook)) 119 (run-hooks 'text-mode-hook 'indented-text-mode-hook))