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 &optional condition multiple

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 the same section or in that of a sibling section. If optional MULTIPLE is non-nil, then the region cannot begin and end in the same section.

When the selection is not valid, then return nil. In this case, most commands that can act on the selected sections will instead act on the section at point.

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 face. 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.

If optional CONDITION is non-nil, then the selection not only has to be valid; all selected sections additionally have to match CONDITION, or nil is returned. See magit-section-match for the forms CONDITION can take.

Function: magit-region-values &optional condition multiple

Return a list of the values of the selected sections.

Return the values that themselves would be returned by magit-region-sections (which see).


Next: Matching Sections, Previous: Creating Sections, Up: Section Plumbing   [Contents][Index]