История изменений
Исправление theNamelessOne, (текущая версия) :
Ну вот такой костыль:
(defconst planning-info-regex "\s+\\<\\(DEADLINE\\|SCHEDULED\\)\\>")
(defun advance-planning-info (&optional boundary)
(re-search-forward planning-info-regex boundary t))
(defun beginning-of-line-text? ()
(save-excursion
(or (= (point) (line-beginning-position))
(let ((pos (point)))
(beginning-of-line-text)
(= pos (point))))))
(defun add-planning-info-separate-line (what &rest _args)
(when (memq what '(scheduled deadline))
(save-excursion
(let ((boundary (save-excursion
(outline-next-heading)
(point))))
(org-back-to-heading t)
(when (and (advance-planning-info boundary)
(advance-planning-info boundary))
(goto-char (match-beginning 1))
(unless (beginning-of-line-text?)
(newline-and-indent)))))))
(advice-add 'org-add-planning-info :after
#'add-planning-info-separate-line)
Исходная версия theNamelessOne, :
Ну вот такой костыль:
(defconst planning-info-regex "\s+\\<\\(DEADLINE\\|SCHEDULED\\)")
(defun advance-planning-info (&optional boundary)
(re-search-forward planning-info-regex boundary t))
(defun beginning-of-line-text? ()
(save-excursion
(or (= (point) (line-beginning-position))
(let ((pos (point)))
(beginning-of-line-text)
(= pos (point))))))
(defun add-planning-info-separate-line (what &rest _args)
(when (memq what '(scheduled deadline))
(save-excursion
(let ((boundary (save-excursion
(outline-next-heading)
(point))))
(org-back-to-heading t)
(when (and (advance-planning-info boundary)
(advance-planning-info boundary))
(goto-char (match-beginning 1))
(unless (beginning-of-line-text?)
(newline-and-indent)))))))
(advice-add 'org-add-planning-info :after
#'add-planning-info-separate-line)