Mercurial > emacs
comparison lisp/textmodes/text-mode.el @ 40481:7b44c3509111
(paragraph-indent-minor-mode): Don't set paragraph-separate.
Set paragraph-start more carefully. Set indent-line-function.
(paragraph-indent-text-mode): Use it and define-derived-mode.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 30 Oct 2001 05:26:44 +0000 |
parents | 04be247dd745 |
children | 2e6c799155b3 |
comparison
equal
deleted
inserted
replaced
40480:5ebd79883369 | 40481:7b44c3509111 |
---|---|
80 (make-local-variable 'paragraph-separate) | 80 (make-local-variable 'paragraph-separate) |
81 (setq paragraph-separate paragraph-start) | 81 (setq paragraph-separate paragraph-start) |
82 (make-local-variable 'indent-line-function) | 82 (make-local-variable 'indent-line-function) |
83 (setq indent-line-function 'indent-relative-maybe)) | 83 (setq indent-line-function 'indent-relative-maybe)) |
84 | 84 |
85 (defun paragraph-indent-text-mode () | 85 (define-derived-mode paragraph-indent-text-mode text-mode "Parindent" |
86 "Major mode for editing text, with leading spaces starting a paragraph. | 86 "Major mode for editing text, with leading spaces starting a paragraph. |
87 In this mode, you do not need blank lines between paragraphs | 87 In this mode, you do not need blank lines between paragraphs |
88 when the first line of the following paragraph starts with whitespace. | 88 when the first line of the following paragraph starts with whitespace. |
89 `paragraph-indent-minor-mode' provides a similar facility as a minor mode. | 89 `paragraph-indent-minor-mode' provides a similar facility as a minor mode. |
90 Special commands: | 90 Special commands: |
91 \\{text-mode-map} | 91 \\{text-mode-map} |
92 Turning on Paragraph-Indent Text mode runs the normal hooks | 92 Turning on Paragraph-Indent Text mode runs the normal hooks |
93 `text-mode-hook' and `paragraph-indent-text-mode-hook'." | 93 `text-mode-hook' and `paragraph-indent-text-mode-hook'." |
94 (interactive) | 94 (paragraph-indent-minor-mode) |
95 (kill-all-local-variables) | |
96 (use-local-map text-mode-map) | |
97 (setq mode-name "Parindent") | |
98 (setq major-mode 'paragraph-indent-text-mode) | |
99 (setq local-abbrev-table text-mode-abbrev-table) | |
100 (set-syntax-table text-mode-syntax-table) | |
101 (run-hooks 'text-mode-hook 'paragraph-indent-text-mode-hook)) | 95 (run-hooks 'text-mode-hook 'paragraph-indent-text-mode-hook)) |
102 | 96 |
103 (defun paragraph-indent-minor-mode () | 97 (defun paragraph-indent-minor-mode () |
104 "Minor mode for editing text, with leading spaces starting a paragraph. | 98 "Minor mode for editing text, with leading spaces starting a paragraph. |
105 In this mode, you do not need blank lines between paragraphs when the | 99 In this mode, you do not need blank lines between paragraphs when the |
107 `paragraph-indent-mode'. | 101 `paragraph-indent-mode'. |
108 Turning on Paragraph-Indent minor mode runs the normal hook | 102 Turning on Paragraph-Indent minor mode runs the normal hook |
109 `paragraph-indent-text-mode-hook'." | 103 `paragraph-indent-text-mode-hook'." |
110 (interactive) | 104 (interactive) |
111 (set (make-local-variable 'paragraph-start) | 105 (set (make-local-variable 'paragraph-start) |
112 (default-value 'paragraph-start)) | 106 (concat "[ \t\n\f]\\|" paragraph-start)) |
113 (set (make-local-variable 'paragraph-separate) paragraph-start) | 107 (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) |
114 (run-hooks 'paragraph-indent-text-mode-hook)) | 108 (run-hooks 'paragraph-indent-text-mode-hook)) |
115 | 109 |
116 (defalias 'indented-text-mode 'text-mode) | 110 (defalias 'indented-text-mode 'text-mode) |
117 | 111 |
118 (defun text-mode-hook-identify () | 112 (defun text-mode-hook-identify () |