aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2012-09-29 23:20:00 -0400
committerStefan Monnier2012-09-29 23:20:00 -0400
commit4ffb41a99e7bbbc83715cab8d7710afcaa571eec (patch)
treef5debbc496480c6ff33d4fe7e5b0824a7871a143 /lisp
parent98a5e33b90b50d363a6243e8be7d0290a69dbc42 (diff)
downloademacs-4ffb41a99e7bbbc83715cab8d7710afcaa571eec.tar.gz
emacs-4ffb41a99e7bbbc83715cab8d7710afcaa571eec.zip
* lisp/textmodes/text-mode.el (paragraph-indent-minor-mode): Make it
a proper minor-mode.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/textmodes/text-mode.el23
2 files changed, 20 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1646d2518dc..4d4312b03be 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12012-09-30 Stefan Monnier <monnier@iro.umontreal.ca> 12012-09-30 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * textmodes/text-mode.el (paragraph-indent-minor-mode): Make it
4 a proper minor-mode.
5
3 * textmodes/tex-mode.el (tex-mode-map): Don't bind paren keys. 6 * textmodes/tex-mode.el (tex-mode-map): Don't bind paren keys.
4 7
52012-09-29 Glenn Morris <rgm@gnu.org> 82012-09-29 Glenn Morris <rgm@gnu.org>
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 30e5390a3e1..301f69f45be 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -80,18 +80,29 @@ Turning on Paragraph-Indent Text mode runs the normal hooks
80 :abbrev-table nil :syntax-table nil 80 :abbrev-table nil :syntax-table nil
81 (paragraph-indent-minor-mode)) 81 (paragraph-indent-minor-mode))
82 82
83(defun paragraph-indent-minor-mode () 83(define-minor-mode paragraph-indent-minor-mode
84 "Minor mode for editing text, with leading spaces starting a paragraph. 84 "Minor mode for editing text, with leading spaces starting a paragraph.
85In this mode, you do not need blank lines between paragraphs when the 85In this mode, you do not need blank lines between paragraphs when the
86first line of the following paragraph starts with whitespace, as with 86first line of the following paragraph starts with whitespace, as with
87`paragraph-indent-text-mode'. 87`paragraph-indent-text-mode'.
88Turning on Paragraph-Indent minor mode runs the normal hook 88Turning on Paragraph-Indent minor mode runs the normal hook
89`paragraph-indent-text-mode-hook'." 89`paragraph-indent-text-mode-hook'."
90 (interactive) 90 :initial-value nil
91 (set (make-local-variable 'paragraph-start) 91 ;; Change the definition of a paragraph start.
92 (concat "[ \t\n\f]\\|" paragraph-start)) 92 (let ((ps-re "[ \t\n\f]\\|"))
93 (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) 93 (if (eq t (compare-strings ps-re nil nil
94 (run-hooks 'paragraph-indent-text-mode-hook)) 94 paragraph-start nil (length ps-re)))
95 (if (not paragraph-indent-minor-mode)
96 (set (make-local-variable 'paragraph-start)
97 (substring paragraph-start (length ps-re))))
98 (if paragraph-indent-minor-mode
99 (set (make-local-variable 'paragraph-start)
100 (concat ps-re paragraph-start)))))
101 ;; Change the indentation function.
102 (if paragraph-indent-minor-mode
103 (set (make-local-variable 'indent-line-function) 'indent-to-left-margin)
104 (if (eq indent-line-function 'indent-to-left-margin)
105 (set (make-local-variable 'indent-line-function) 'indent-region))))
95 106
96(defalias 'indented-text-mode 'text-mode) 107(defalias 'indented-text-mode 'text-mode)
97 108