Function: dirvish-define-preview
dirvish-define-preview is a macro defined in dirvish.el.
Signature
(dirvish-define-preview NAME &optional ARGLIST DOCSTRING &rest BODY)
Documentation
Define a Dirvish preview dispatcher NAME.
A dirvish preview dispatcher is a function consumed by
dirvish-preview-dispatch which takes file (filename under
the cursor) and preview-window as ARGLIST. DOCSTRING and BODY
is the docstring and body for this function.
Source Code
;; Defined in /nix/store/1gijwny2yx4fggrsb9l110h1ybs1gdk5-emacs-packages-deps/share/emacs/site-lisp/elpa/dirvish-20260725.1520/dirvish.el
;;;; Preview
(cl-defmacro dirvish-define-preview (name &optional arglist docstring &rest body)
"Define a Dirvish preview dispatcher NAME.
A dirvish preview dispatcher is a function consumed by
`dirvish-preview-dispatch' which takes `file' (filename under
the cursor) and `preview-window' as ARGLIST. DOCSTRING and BODY
is the docstring and body for this function."
(declare (indent defun) (doc-string 3))
(let* ((dp-name (intern (format "dirvish-%s-dp" name)))
(default-arglist '(file ext preview-window dv))
(ignore-list (cl-set-difference default-arglist arglist))
(keywords `(:doc ,docstring)))
(while (keywordp (car body)) (dotimes (_ 2) (push (pop body) keywords)))
`(progn
(add-to-list
'dirvish--available-preview-dispatchers (cons ',name ',keywords))
(defun ,dp-name ,default-arglist (ignore ,@ignore-list) ,@body))))