Function: zoxide-open-with

zoxide-open-with is a natively compiled function defined in zoxide.el.

Signature

(zoxide-open-with QUERY CALLBACK &optional NONINTERACTIVE)

Documentation

Search QUERY and run CALLBACK function with a selected path.

If NONINTERACTIVE is non-nil, the callback is always called directly with the selected path as its first argument.

This is a help function to define interactive commands like zoxide-find-file. If you want to do things noninteractive, please use zoxide-query, filter results and pass it to your function manually instead.

Source Code

;; Defined in /nix/store/hrvvrg8iq0dy80la0z05ls131gycsm2z-emacs-packages-deps/share/emacs/site-lisp/elpa/zoxide-20241003.1103/zoxide.el
;;;###autoload
(defun zoxide-open-with (query callback &optional noninteractive)
  "Search QUERY and run CALLBACK function with a selected path.

If NONINTERACTIVE is non-nil, the callback is always called
directly with the selected path as its first argument.

This is a help function to define interactive commands like
`zoxide-find-file'.  If you want to do things noninteractive, please use
`zoxide-query', filter results and pass it to your function manually instead."
  (let* ((results (if query
                      (zoxide-query-with query)
                    (zoxide-query)))
         (default-directory (completing-read "path: " results nil t)))
    (if (and (not noninteractive) (commandp callback))
        (call-interactively callback)
      (funcall callback default-directory))))