First check for major mode when update Org item headline
This commit is contained in:
parent
5c36dba12c
commit
159c8c0eb6
|
@ -620,15 +620,20 @@ query for it."
|
|||
(insert body)
|
||||
(org-update-statistics-cookies nil)))
|
||||
|
||||
(defun db/org-update-headline-log-note (new-headline)
|
||||
(defun db/org-update-headline-log-note (&optional new-headline)
|
||||
"Replace headline of item at point with NEW-HEADLINE.
|
||||
Interactively query for HEADLINE when not provided."
|
||||
(interactive "sNew Headline: ")
|
||||
(interactive)
|
||||
|
||||
;; We should check this before asking the user for the new headline, but how?
|
||||
(unless (derived-mode-p 'org-mode 'org-agenda-mode)
|
||||
(user-error "Neither in an Org mode nor Org agenda buffer, aborting"))
|
||||
|
||||
(unless new-headline
|
||||
(setq new-headline (read-string "New Headline: ")))
|
||||
|
||||
(unless (stringp new-headline)
|
||||
(user-error "New headline must be string"))
|
||||
|
||||
(when (string-match-p "\n" new-headline)
|
||||
(user-error "New headline contains newlines, aborting"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue