Function: majutsu-read-revision

majutsu-read-revision is a natively compiled function defined in majutsu-jj.el.

Signature

(majutsu-read-revision PROMPT &key DEFAULT INITIAL-INPUT HISTORY COMPLETION-ARGS ALLOW-EMPTY)

Documentation

Read one revision selector with PROMPT.

DEFAULT, INITIAL-INPUT, HISTORY, and COMPLETION-ARGS configure the minibuffer consistently with majutsu-read-revset. When ALLOW-EMPTY is non-nil, empty input returns nil. Otherwise DEFAULT falls back to the revision at point and then @.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-jj.el
(cl-defun majutsu-read-revision
    (prompt &key default initial-input history completion-args allow-empty)
  "Read one revision selector with PROMPT.

DEFAULT, INITIAL-INPUT, HISTORY, and COMPLETION-ARGS configure the
minibuffer consistently with `majutsu-read-revset'.  When ALLOW-EMPTY
is non-nil, empty input returns nil.  Otherwise DEFAULT falls back to
the revision at point and then `@'."
  (setq default
        (or default
            (and (not allow-empty)
                 (or (majutsu-revision-at-point) "@"))))
  (let* ((table (if completion-args
                    (majutsu-jj--completion-table completion-args
                                                  'majutsu-revision)
                  (majutsu-completion-payload-table
                   (majutsu-jj-revset-candidate-data)
                   'majutsu-revision)))
         (value (completing-read
                 (format-prompt prompt default)
                 table nil nil initial-input
                 (or history 'majutsu-read-revset-history)
                 (and (not allow-empty) default))))
    (cond
     ((not (string-empty-p value)) value)
     (allow-empty nil)
     ((and default (not (string-empty-p default))) default)
     (t (user-error "Need non-empty input")))))