Function: magit-apply--get-selection

magit-apply--get-selection is a natively compiled function defined in magit-apply.el.

Signature

(magit-apply--get-selection &optional NOERROR)

Source Code

;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/magit-apply.el
(defun magit-apply--get-selection (&optional noerror)
  (or (magit-region-sections '(hunk file module) t)
      (let ((section (magit-current-section)))
        (pcase (oref section type)
          ((or 'hunk 'file 'module) section)
          ((or 'staged 'unstaged
               'stashed-index 'stashed-worktree 'stashed-untracked)
           (oref section children))
          ('untracked t)
          ((guard noerror) nil)
          (_ (user-error "Cannot apply this, it's not a change"))))))