From 187f77a20afde642687de6ec032bbdf19c22473a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 4 Apr 2012 08:51:20 +0200 Subject: [PATCH] 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. --- lisp/org.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index b83700fdc..a11d7345a 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)))) -- 2.11.4.GIT