[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110262: * lisp/textmodes/text-mode.e
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110262: * lisp/textmodes/text-mode.el (paragraph-indent-minor-mode): Make it |
Date: |
Sat, 29 Sep 2012 23:20:00 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110262
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sat 2012-09-29 23:20:00 -0400
message:
* lisp/textmodes/text-mode.el (paragraph-indent-minor-mode): Make it
a proper minor-mode.
modified:
lisp/ChangeLog
lisp/textmodes/text-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-09-30 03:10:13 +0000
+++ b/lisp/ChangeLog 2012-09-30 03:20:00 +0000
@@ -1,5 +1,8 @@
2012-09-30 Stefan Monnier <address@hidden>
+ * textmodes/text-mode.el (paragraph-indent-minor-mode): Make it
+ a proper minor-mode.
+
* textmodes/tex-mode.el (tex-mode-map): Don't bind paren keys.
2012-09-29 Glenn Morris <address@hidden>
=== modified file 'lisp/textmodes/text-mode.el'
--- a/lisp/textmodes/text-mode.el 2012-01-28 03:49:22 +0000
+++ b/lisp/textmodes/text-mode.el 2012-09-30 03:20:00 +0000
@@ -80,18 +80,29 @@
:abbrev-table nil :syntax-table nil
(paragraph-indent-minor-mode))
-(defun paragraph-indent-minor-mode ()
+(define-minor-mode paragraph-indent-minor-mode
"Minor mode for editing text, with leading spaces starting a paragraph.
In this mode, you do not need blank lines between paragraphs when the
first line of the following paragraph starts with whitespace, as with
`paragraph-indent-text-mode'.
Turning on Paragraph-Indent minor mode runs the normal hook
`paragraph-indent-text-mode-hook'."
- (interactive)
- (set (make-local-variable 'paragraph-start)
- (concat "[ \t\n\f]\\|" paragraph-start))
- (set (make-local-variable 'indent-line-function) 'indent-to-left-margin)
- (run-hooks 'paragraph-indent-text-mode-hook))
+ :initial-value nil
+ ;; Change the definition of a paragraph start.
+ (let ((ps-re "[ \t\n\f]\\|"))
+ (if (eq t (compare-strings ps-re nil nil
+ paragraph-start nil (length ps-re)))
+ (if (not paragraph-indent-minor-mode)
+ (set (make-local-variable 'paragraph-start)
+ (substring paragraph-start (length ps-re))))
+ (if paragraph-indent-minor-mode
+ (set (make-local-variable 'paragraph-start)
+ (concat ps-re paragraph-start)))))
+ ;; Change the indentation function.
+ (if paragraph-indent-minor-mode
+ (set (make-local-variable 'indent-line-function) 'indent-to-left-margin)
+ (if (eq indent-line-function 'indent-to-left-margin)
+ (set (make-local-variable 'indent-line-function) 'indent-region))))
(defalias 'indented-text-mode 'text-mode)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110262: * lisp/textmodes/text-mode.el (paragraph-indent-minor-mode): Make it,
Stefan Monnier <=