branch: master
commit 02ce5ea7a990b383fa5d20f202eb402dbfed6764
Author: Stefan Monnier <[email protected]>
Commit: Stefan Monnier <[email protected]>
* adaptive-wrap.el (adaptive-wrap-fill-context-prefix): Ignore
paragraph-start
(and rename 'en' to 'end').
Reported by Dmitry Safronov <[email protected]>
---
packages/adaptive-wrap/adaptive-wrap.el | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/packages/adaptive-wrap/adaptive-wrap.el
b/packages/adaptive-wrap/adaptive-wrap.el
index 6237924..f8d89ac 100644
--- a/packages/adaptive-wrap/adaptive-wrap.el
+++ b/packages/adaptive-wrap/adaptive-wrap.el
@@ -4,7 +4,7 @@
;; Author: Stephen Berman <[email protected]>
;; Stefan Monnier <[email protected]>
-;; Version: 0.6
+;; Version: 0.7
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -59,11 +59,20 @@ extra indent = 2
:group 'visual-line)
(make-variable-buffer-local 'adaptive-wrap-extra-indent)
-(defun adaptive-wrap-fill-context-prefix (beg en)
+(defun adaptive-wrap-fill-context-prefix (beg end)
"Like `fill-context-prefix', but with length adjusted by
`adaptive-wrap-extra-indent'."
- ;; Note: fill-context-prefix may return nil; See:
- ;; http://article.gmane.org/gmane.emacs.devel/156285
- (let* ((fcp (or (fill-context-prefix beg en) ""))
+ (let* ((fcp
+ ;; `fill-context-prefix' ignores prefixes that look like paragraph
+ ;; starts, in order to avoid inadvertently creating a new paragraph
+ ;; while filling, but here we're only dealing with single-line
+ ;; "paragraphs" and we don't actually modify the buffer, so this
+ ;; restriction doesn't make much sense (and is positively harmful in
+ ;; taskpaper-mode where paragraph-start matches everything).
+ (or (let ((paragraph-start "\\`\\'a"))
+ (fill-context-prefix beg end))
+ ;; Note: fill-context-prefix may return nil; See:
+ ;; http://article.gmane.org/gmane.emacs.devel/156285
+ ""))
(fcp-len (string-width fcp))
(fill-char (if (< 0 fcp-len)
(string-to-char (substring fcp -1))