Add facility for commit log messages from Org documents

* lisp/org-compat.el (org-add-log-current-headline): New function.
* lisp/org.el (org-mode): Use new function.
This commit is contained in:
Nicolas Goaziou 2018-06-13 22:15:56 +02:00
parent 3f26c9bd2e
commit f50f373389
2 changed files with 10 additions and 0 deletions

View File

@ -712,6 +712,14 @@ To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
(add-hook 'speedbar-visiting-tag-hook
(lambda () (and (derived-mode-p 'org-mode) (org-show-context 'org-goto))))))
;;;; Add Log
(defun org-add-log-current-headline ()
"Return current headline or nil.
This function ignores inlinetasks. It is meant to be used as
`add-log-current-defun-function' value."
(org-with-limited-levels (org-get-heading t t t t)))
;;;; Flyspell
(defun org--flyspell-object-check-p (element)

View File

@ -5509,6 +5509,8 @@ The following commands are available:
(forward-char -1))))
;; Next error for sparse trees
(setq-local next-error-function 'org-occur-next-match)
;; Make commit log messages from Org documents easier.
(setq-local add-log-current-defun-function #'org-add-log-current-headline)
;; Make sure dependence stuff works reliably, even for users who set it
;; too late :-(
(if org-enforce-todo-dependencies