Function: combobulate-envelope-render-choice-preview

combobulate-envelope-render-choice-preview is a natively compiled function defined in combobulate-envelope.el.

Signature

(combobulate-envelope-render-choice-preview ACTION)

Documentation

Render a preview of the envelope at INDEX.

Unlike most proffer preview functions, this one assumes that accept-action passed to combobulate-proffer-choices is commit and not its usual value of rollback.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-envelope.el
(defun combobulate-envelope-render-choice-preview (action)
  "Render a preview of the envelope at INDEX.

Unlike most proffer preview functions, this one assumes that
`accept-action' passed to `combobulate-proffer-choices' is
`commit' and not its usual value of `rollback'."
  (with-slots (index current-node proxy-nodes refactor-id) action
    (combobulate-refactor (:id refactor-id)
      (let ((pt)
            (combobulate-envelope-static t)
            (combobulate-envelope--undo-on-quit nil))
        (dolist (node proxy-nodes)
          (let ((expand-envelope) (is-current-node))
            (pcase-let ((`(,missing .  ,rest-envelope) (combobulate-proxy-node-extra node)))
              (combobulate-move-to-node node)
              (cond ((equal node current-node)
                     (setq expand-envelope rest-envelope
                           is-current-node t
                           pt (point)))
                    (t (setq expand-envelope missing)))
              (pcase-let (((cl-struct combobulate-envelope-context
                                      (start start)
                                      (end end)
                                      (user-actions user-actions))
                           (combobulate-refactor (:id refactor-id)
                             (combobulate-envelope-expand-instructions-1
                              ;; Normally we'd just use `(b ...)' but we
                              ;; want the points calculated also, if
                              ;; there are any in the envelope, so we
                              ;; can pull out the `selected-point' and
                              ;; use it to set `pt' later.
                              `((b* (repeat choice prompt point) ,@expand-envelope))))))
                (mark-range-deleted start end)
                (when is-current-node
                  (pcase user-actions
                    (`((selected-point . ,selected-pt))
                     (setq pt selected-pt)))
                  (mark-range-highlighted start end))))))
        (when pt (goto-char pt))))))