Next: , Previous: , Up: Section Plumbing   [Contents][Index]


10.2.2 Section Selection

Function: magit-current-section

Return the section at point.

Function: magit-region-sections

Return a list of the selected sections.

When the region is active and constitutes a valid section selection, then return a list of all selected sections. This is the case when the region begins in the heading of a section and ends in the heading of a sibling of that first section. When the selection is not valid then return nil. Most commands that can act on the selected sections, then instead just act on the current section, the one point is in.

When the region looks like it would in any other buffer then the selection is invalid. When the selection is valid then the region uses the magit-section-highlight. This does not apply to diffs where things get a bit more complicated, but even here if the region looks like it usually does, then that’s not a valid selection as far as this function is concerned.

Function: magit-region-values &rest types

Return a list of the values of the selected sections.

Also see magit-region-sections whose doc-string explains when a region is a valid section selection. If the region is not active or is not a valid section selection, then return nil. If optional TYPES is non-nil then the selection not only has to be valid; the types of all selected sections additionally have to match one of TYPES, or nil is returned.