0

The Magit user manual says in the description of `w w' (magit-am-apply-patches):

w w (magit-am-apply-patches)
This command applies one or more patches. If the region marks files, then those are applied as patches. [...]

This raises the question:

How do I use the region to select the patch files to be applied? In particular, the region of which buffer is intended to be used for that?

Looking into the sources, I found that the command magit-am-apply-patches uses the function magit-region-values to evaluate the selection. The latter's description explains that the region should constitute a "valid section selection" for this and refers to the description of the function magit-region-sections for details. That in turn states:

When the region is active and constitutes a valid section selection, [...]. 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.

To profit from this description, one should know:

Which sections in which buffer show plain patch files that lie anywhere in the local filesystem?

1 Answer 1

1

How do I use the region to select the patch files to be applied? In particular, the region of which buffer is intended to be used for that?

The Magit status buffer lists untracked files, so if the patches are located within the repository, then you can mark those files in the Untracked files section.

Which sections in which buffer show plain patch files that lie anywhere in the local filesystem?

That isn't supported, but it could probably be supported by using find-file-read-args instead of read-file-name.

1
  • Thank you @tarsius for your prompt answer. I did not think about the untracked files section in the Magit status buffer. Selecting patches from there using the region works perfectly for me. However, I wonder how find-file-read-args brings an advantage over read-file-name with respect to the support of patches in more general locations. It seems to me that the former, as defined in files.el, is just a wrapper to the latter.
    – Jürgen
    Apr 30, 2019 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.