From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: How to apply (multi file) patches conveniently Date: Tue, 07 Feb 2017 21:22:30 +0100 Message-ID: <874m05ycmx.fsf@drachen> References: <87efzb5xgl.fsf@drachen> <83fujr7216.fsf@gnu.org> <871sv9u79z.fsf@drachen> <83fujp6a6b.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486499010 14390 195.159.176.226 (7 Feb 2017 20:23:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Feb 2017 20:23:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 07 21:23:24 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbCIO-0003La-6E for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Feb 2017 21:23:24 +0100 Original-Received: from localhost ([::1]:56231 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbCIS-0002t7-5p for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Feb 2017 15:23:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbCHd-0002bW-MO for help-gnu-emacs@gnu.org; Tue, 07 Feb 2017 15:22:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbCHZ-00041a-NA for help-gnu-emacs@gnu.org; Tue, 07 Feb 2017 15:22:37 -0500 Original-Received: from mout.web.de ([212.227.17.12]:63184) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cbCHZ-0003zv-DC; Tue, 07 Feb 2017 15:22:33 -0500 Original-Received: from drachen.dragon ([88.67.111.141]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Mg7I1-1cpr1P3rdd-00NUw6; Tue, 07 Feb 2017 21:22:31 +0100 In-Reply-To: <83fujp6a6b.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 07 Feb 2017 22:03:08 +0200") X-Provags-ID: V03:K0:HNH66pArjfZSDYpoBwgtXOK5h+0dyh7wobxKiZmACXUrQlTNttc 7aRVer4fKNLDG6yz1hxe2gXTmeWLfZFiRMkJxEgITnsjms0WdQJOkAbOrymoBN+SUIhgiOH SGda1aWhlDHDNMuqfR9rX0ozs6Y6y7Xs/tdI3t7C8gsfeSCa5F6+0RDM+ao9uaR6kpuFlXa gFwjQF/Q2NfrMn5SxSelg== X-UI-Out-Filterresults: notjunk:1;V01:K0:unNl9AlPIzs=:hiwIYouUbFzO+zLYaueK8f 1yNoC5ajvrxUowILOxNPxvd0uDxtoSIgHQrYWAeKO5KB0jXOlI+oXBvXTnGrz4t0zCLZncuau MPnwS8rNtZ629jgRJJUh8nF2PyOnuLhb9+XwQScL7Qd2nYKMPCj2J2LZqr2n/d3bwyuIRZOGI RYtgBNUhGbb4sD9ttmwWWLt+N3AslmOmzzw8Gccac49YsxmllomvIERHcdzQYy41YMjdtIAsY 8mX72ksWXch48wdctUhgd2TOL28/Je9wOcRYLG4Yt2D+qu4bIj73vqa4cwNj2qud8OTSHXMB/ VA8irfpKFxcZHA+PmrQ8VjEBrf/ZhMQokWO6vwjPqqxG8gaz1EQZaUpFs5gzGF6eA2X0AkpFv hBwfvEiN2OSlOPJc2qsiDs9FzHrrT6q7OCUry3AWPqo6F72EjtHWCdTkFQNfL4I6z1S4jYuxo YOg2iZcyuuvuyvIto801JYTqg2q1Ve75bWymMyV1FCv4PRHSt2gd0a3HNkt5KSq5xx5bDG3S6 z+w4kGXdYkfMIoHTlTPy0aRKGrKeAAN8+q5/sm3Bqb1/M1unzeY678GAehBcSm3DgBOqOIWmW 7TpJRhoQn5SU8vg7+qSlIJINc/J63IJSYUVCzcw9yGxVrgwqy2ggRJunSlxMaoC5SNfWU72Jl /zBxQp7xpblpkZ+mm+78wOY4epEBdK55+Fm1cFCHmgE69soeOvJm9P4uK2EEmooy+7X+AFh7H ceoNbKn60tITldtKQeUpZDwWKWvtmWyFpoLWy3qC7IYVmuup5gEdDMcFVafvllWQz+gRuAd8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112276 Archived-At: Eli Zaretskii 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.