From: Michael Heerdegen <michael_heerdegen@web.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to apply (multi file) patches conveniently
Date: Tue, 07 Feb 2017 21:22:30 +0100 [thread overview]
Message-ID: <874m05ycmx.fsf@drachen> (raw)
In-Reply-To: <83fujp6a6b.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 07 Feb 2017 22:03:08 +0200")
Eli Zaretskii <eliz@gnu.org> writes:
> It depends on what is at the beginning of the buffer, and what is
> after the patch itself. With some text there, Patch could become
> utterly confused. It does know about a typical beginning of an email
> message, but buffer contents could be anything...
>
> So I really recommend to mark the patch.
Ok, but can in real-life situations happen things worse then "patch"
saying it could not apply the patch? Did it ever happen to you that it
applied something wrong?
FWIW, I wrote this:
#+begin_src emacs-lisp
(defun my-gnus-patch-from-article ()
(interactive)
(with-current-buffer gnus-article-buffer
(shell-command-on-region
(if (use-region-p) (region-beginning) (point-min))
(if (use-region-p) (region-end) (point-max))
(format "patch -d '%s' -p1"
(let* ((insert-default-directory nil)
(input (read-directory-name (format "Dir (default %s): "
(or source-directory default-directory)))))
(if (string= input "")
(expand-file-name (or source-directory
default-directory)) input))))))
(define-key gnus-article-mode-map [?P] #'my-gnus-patch-from-article)
(define-key gnus-summary-mode-map [?P] #'my-gnus-patch-from-article)
#+end_src
so I can mark a region, but don't have to.
Thanks,
Michael.
next prev parent reply other threads:[~2017-02-07 20:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 12:13 How to apply (multi file) patches conveniently Michael Heerdegen
2017-02-06 15:49 ` Eli Zaretskii
2017-02-07 16:48 ` Michael Heerdegen
2017-02-07 17:19 ` Nick Dokos
2017-02-07 17:52 ` Michael Heerdegen
2017-02-07 19:45 ` Nick Dokos
2017-02-07 22:42 ` Robert Thorpe
2017-02-07 20:23 ` tomas
2017-02-07 20:42 ` Michael Heerdegen
2017-02-07 21:57 ` tomas
2017-02-07 19:31 ` Michael Heerdegen
2017-02-07 20:03 ` Eli Zaretskii
2017-02-07 20:22 ` Michael Heerdegen [this message]
2017-02-07 20:42 ` Eli Zaretskii
2017-02-07 20:50 ` Michael Heerdegen
2017-02-08 9:48 ` Thien-Thi Nguyen
2017-02-08 22:34 ` Michael Heerdegen
2017-02-09 17:49 ` Thien-Thi Nguyen
2017-02-07 14:25 ` Stefan Monnier
2017-02-07 16:51 ` Michael Heerdegen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874m05ycmx.fsf@drachen \
--to=michael_heerdegen@web.de \
--cc=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).