Function: denote--display-buffer-from-xref-alist
denote--display-buffer-from-xref-alist is a byte-compiled function
defined in denote.el.
Signature
(denote--display-buffer-from-xref-alist XREF-ALIST BUFFER-NAME DISPLAY-BUFFER-ACTION)
Documentation
Create buffer called BUFFER-NAME for XREF-ALIST.
DISPLAY-BUFFER-ACTION is a display-buffer action and concomitant
alist, such as denote-backlinks-display-buffer-action.
Source Code
;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defun denote--display-buffer-from-xref-alist (xref-alist buffer-name display-buffer-action)
"Create buffer called BUFFER-NAME for XREF-ALIST.
DISPLAY-BUFFER-ACTION is a `display-buffer' action and concomitant
alist, such as `denote-backlinks-display-buffer-action'."
(let* ((inhibit-read-only t)
(file buffer-file-name)
(dirs (denote-directories)))
(unless xref-alist
(error "No results to display"))
;; Update group of each item in xref-alist
(dolist (x xref-alist)
(let* ((file-xref (car x)))
(setf (car x) (funcall denote-query-format-heading-function file-xref))))
(with-current-buffer (get-buffer-create buffer-name)
(erase-buffer)
(denote-query-mode)
;; In the links' buffer, the values of variables set in a
;; `.dir-locals.el` do not apply. We need to set
;; `denote-directory' here because the buttons depend on it.
;; Moreover, its value is overwritten after enabling the major
;; mode, so it needs to be set after.
(setq-local denote-directory dirs)
(setq overlay-arrow-position nil)
(goto-char (point-min))
(xref--insert-xrefs xref-alist)
(goto-char (point-min))
(setq-local revert-buffer-function
(lambda (_ignore-auto _noconfirm)
(when-let* ((buffer-file-name file))
(denote--display-buffer-from-xref-alist xref-alist buffer-name display-buffer-action)))))
(display-buffer buffer-name display-buffer-action)))