branch: externals/denote commit f7406ef47596a404929578c45aa18b626e973d9d Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Refine conditionality of denote--file-with-temp-buffer-1 --- denote.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/denote.el b/denote.el index 642e9b7e31..3d3bddf373 100644 --- a/denote.el +++ b/denote.el @@ -1390,11 +1390,15 @@ Run `denote-desluggify' on title if the extraction is sucessful." "Return path to FILE or its buffer together with the appropriate function. Subroutine of `denote--file-with-temp-buffer'." (when file - (let ((buffer (get-file-buffer file)) - (file-exists (file-exists-p file))) + (let* ((buffer (get-file-buffer file)) + (file-exists (file-exists-p file)) + (buffer-modified (buffer-modified-p buffer))) (cond - ((or (and file-exists buffer (not (buffer-modified-p buffer))) - file-exists) + ((or (and file-exists + buffer + (not buffer-modified) + (not (eq buffer-modified 'autosaved))) + (and file-exists (not buffer))) (cons #'insert-file-contents file)) (buffer (cons #'insert-buffer buffer))