diff options
| author | Richard M. Stallman | 1997-08-28 02:53:44 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-08-28 02:53:44 +0000 |
| commit | 4c69a3beaf258c287fc3efcc40e3defb1f0e9ec2 (patch) | |
| tree | bfd7a85093644d83cfb3fc49dc38a68037404bef /lisp | |
| parent | 047d1f89b16ed84f9fadbe723660ce7505b15fbf (diff) | |
| download | emacs-4c69a3beaf258c287fc3efcc40e3defb1f0e9ec2.tar.gz emacs-4c69a3beaf258c287fc3efcc40e3defb1f0e9ec2.zip | |
(text-mode-variant): New variable.
(text-mode): Set that variable locally.
(toggle-text-mode-auto-fill): New command.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/textmodes/text-mode.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 02398161691..eb06fdaeb5f 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el | |||
| @@ -31,6 +31,9 @@ | |||
| 31 | (defvar text-mode-hook nil | 31 | (defvar text-mode-hook nil |
| 32 | "Normal hook run when entering Text mode and many related modes.") | 32 | "Normal hook run when entering Text mode and many related modes.") |
| 33 | 33 | ||
| 34 | (defvar text-mode-variant nil | ||
| 35 | "Non-nil if this buffer's major mode is a variant of Text mode.") | ||
| 36 | |||
| 34 | (defvar text-mode-syntax-table nil | 37 | (defvar text-mode-syntax-table nil |
| 35 | "Syntax table used while in text mode.") | 38 | "Syntax table used while in text mode.") |
| 36 | 39 | ||
| @@ -75,6 +78,8 @@ Turning on Text mode runs the normal hook `text-mode-hook'." | |||
| 75 | (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter)) | 78 | (setq paragraph-start (concat "[ \t]*$\\|" page-delimiter)) |
| 76 | (make-local-variable 'paragraph-separate) | 79 | (make-local-variable 'paragraph-separate) |
| 77 | (setq paragraph-separate paragraph-start) | 80 | (setq paragraph-separate paragraph-start) |
| 81 | (make-local-variable 'text-mode-variant) | ||
| 82 | (setq text-mode-variant t) | ||
| 78 | (setq mode-name "Text") | 83 | (setq mode-name "Text") |
| 79 | (setq major-mode 'text-mode) | 84 | (setq major-mode 'text-mode) |
| 80 | (run-hooks 'text-mode-hook)) | 85 | (run-hooks 'text-mode-hook)) |
| @@ -98,6 +103,24 @@ Turning on Paragraph-Indent Text mode runs the normal hooks | |||
| 98 | 103 | ||
| 99 | (defalias 'indented-text-mode 'text-mode) | 104 | (defalias 'indented-text-mode 'text-mode) |
| 100 | 105 | ||
| 106 | (defun toggle-text-mode-auto-fill () | ||
| 107 | "Toggle whether to use Auto Fill in Text mode and related modes. | ||
| 108 | This command affects all buffers that use modes related to Text mode, | ||
| 109 | both existing buffers and buffers that you subsequently create." | ||
| 110 | (interactive) | ||
| 111 | (let ((enable-mode (not (memq 'turn-on-auto-fill text-mode-hook))) | ||
| 112 | (buffers (buffer-list))) | ||
| 113 | (if enable-mode | ||
| 114 | (add-hook 'text-mode-hook 'turn-on-auto-fill) | ||
| 115 | (remove-hook 'text-mode-hook 'turn-on-auto-fill)) | ||
| 116 | (while buffers | ||
| 117 | (with-current-buffer (car buffers) | ||
| 118 | (if text-mode-variant | ||
| 119 | (auto-fill-mode (if enable-mode 1 0)))) | ||
| 120 | (setq buffers (cdr buffers))) | ||
| 121 | (message "Auto Fill %s in Text modes" | ||
| 122 | (if enable-mode "enabled" "disabled")))) | ||
| 123 | |||
| 101 | (defun center-paragraph () | 124 | (defun center-paragraph () |
| 102 | "Center each nonblank line in the paragraph at or after point. | 125 | "Center each nonblank line in the paragraph at or after point. |
| 103 | See `center-line' for more info." | 126 | See `center-line' for more info." |