help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to apply (multi file) patches conveniently


From: Eli Zaretskii
Subject: Re: How to apply (multi file) patches conveniently
Date: Tue, 07 Feb 2017 22:42:23 +0200

> From: Michael Heerdegen <address@hidden>
> Cc: address@hidden
> Date: Tue, 07 Feb 2017 21:22:30 +0100
> 
> Eli Zaretskii <address@hidden> 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?

No, that is unlikely (and never happened to me).  But I thought the
failure to apply was the original motivation for the question, no?

> 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"
                         ^^^^
Never quote command arguments by hand, always use
shell-quote-argument.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]