summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-04-04 08:51:20 +0200
committerBastien Guerry <bzg@altern.org>2012-04-04 08:51:20 +0200
commit187f77a20afde642687de6ec032bbdf19c22473a (patch)
tree51aed25b71ec2586537a05f6405194838391f09d
parentce06791334c3690f74b4e33665108f1f266f9ce6 (diff)
downloadorg-mode-187f77a20afde642687de6ec032bbdf19c22473a.tar.gz
org.el: Leave scheduled/deadline lines untouched when filling an adjacent paragraph.
* org.el (org-fill-paragraph): Leave scheduled/deadline lines untouched when filling an adjacent paragraph. Thanks to Stuart McLean for suggesting this.
-rw-r--r--lisp/org.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el
index b83700f..a11d734 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20521,6 +20521,14 @@ the functionality can be provided as a fall-back.")
(save-excursion (forward-paragraph 1)
(point)))
(fill-paragraph justify) t)))
+ ;; Don't fill schedule/deadline line before a paragraph
+ ((save-excursion (forward-paragraph -1)
+ (or (looking-at (concat "^[^\n]*" org-scheduled-regexp ".*$"))
+ (looking-at (concat "^[^\n]*" org-deadline-regexp ".*$"))))
+ (save-restriction
+ (narrow-to-region (1+ (match-end 0))
+ (save-excursion (forward-paragraph 1) (point)))
+ (fill-paragraph justify) t))
;; Else simply call `fill-paragraph'.
(t nil))))