mirror of
https://github.com/protesilaos/denote.git
synced 2026-09-10 07:16:20 -04:00
Fix denote--define-retrieve-front-matter not reusing opened buffer
In earlier commits, `denote-rename-buffer' could open the same file multiple times when retrieving front matter, as described in https://github.com/protesilaos/denote/issues/652 . This occurred because the subroutine `denote--file-with-temp-buffer-subr', used in the definition of `denote--define-retrieve-front-matter', contained incorrect conditional logic. As a result, files were reopened instead of reusing already opened buffers. Fixes: https://github.com/protesilaos/denote/issues/652 * (denote--file-with-temp-buffer-subr):
This commit is contained in:
parent
47207e9cb2
commit
8a88fcde81
13
denote.el
13
denote.el
|
|
@ -2645,14 +2645,13 @@ Subroutine of `denote--file-with-temp-buffer'."
|
||||||
(file-exists (file-exists-p file))
|
(file-exists (file-exists-p file))
|
||||||
(buffer-modified (buffer-modified-p buffer)))
|
(buffer-modified (buffer-modified-p buffer)))
|
||||||
(cond
|
(cond
|
||||||
((or (and file-exists
|
((and file-exists
|
||||||
buffer
|
buffer
|
||||||
(not buffer-modified)
|
(not buffer-modified))
|
||||||
(not (eq buffer-modified 'autosaved)))
|
|
||||||
(and file-exists (not buffer)))
|
|
||||||
(cons #'insert-file-contents file))
|
|
||||||
(buffer
|
|
||||||
(cons #'insert-buffer buffer))
|
(cons #'insert-buffer buffer))
|
||||||
|
((and file-exists
|
||||||
|
(or (null buffer) buffer-modified))
|
||||||
|
(cons #'insert-file-contents file))
|
||||||
;; (t
|
;; (t
|
||||||
;; (error "Cannot find anything about file `%s'" file))
|
;; (error "Cannot find anything about file `%s'" file))
|
||||||
)))
|
)))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue