Function: magit-apply--get-selection

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

Signature

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

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260822.1158/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"))))))