Add original value as default when changing Org item headlines

This allows to make simple changes to the original headline of an item.
This commit is contained in:
Daniel - 2022-01-08 15:42:40 +01:00
parent d23a8dc817
commit efb7500202
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 9 additions and 1 deletions

View File

@ -691,7 +691,15 @@ Interactively query for HEADLINE when not provided."
(user-error "Neither in an Org mode nor Org agenda buffer, aborting"))
(unless new-headline
(setq new-headline (read-string "New Headline: ")))
(let ((default-value (cond
((derived-mode-p 'org-mode)
(org-entry-get (point) "ITEM"))
((derived-mode-p 'org-agenda-mode)
(org-agenda-with-point-at-orig-entry
nil (org-entry-get (point) "ITEM"))))))
(setq new-headline (read-string "New Headline: "
nil nil
default-value))))
(unless (stringp new-headline)
(user-error "New headline must be string"))