Clear refile cache when updating the headline of an org mode item

This commit is contained in:
Daniel - 2022-04-02 08:56:18 +02:00
parent 3f01c6fecb
commit fdc32eaa6d
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 6 additions and 1 deletions

View File

@ -691,7 +691,9 @@ it. Adds newline before and after the template."
(defun db/org-update-headline-log-note (&optional new-headline) (defun db/org-update-headline-log-note (&optional new-headline)
"Replace headline of item at point with NEW-HEADLINE. "Replace headline of item at point with NEW-HEADLINE.
Interactively query for HEADLINE when not provided."
Interactively query for HEADLINE when not provided. Clear refile
cache if that's in use."
(interactive) (interactive)
(unless (derived-mode-p 'org-mode 'org-agenda-mode) (unless (derived-mode-p 'org-mode 'org-agenda-mode)
@ -735,6 +737,9 @@ Interactively query for HEADLINE when not provided."
(indent-according-to-mode) (indent-according-to-mode)
(insert (format " Changed headline from: %s\n" old-headline))))) (insert (format " Changed headline from: %s\n" old-headline)))))
(when org-refile-use-cache
(org-refile-cache-clear))
(when (derived-mode-p 'org-agenda-mode) (when (derived-mode-p 'org-agenda-mode)
(org-agenda-redo))) (org-agenda-redo)))