From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#18236: diff-apply-hunk interacts poorly with line endings Date: Sat, 20 Feb 2016 14:50:47 +0200 Message-ID: <83ziuvo89k.fsf@gnu.org> References: <87oabfz6xj.fsf@mbork.pl> <83twl7uw8l.fsf@gnu.org> <838u2jumb7.fsf@gnu.org> <834md3poft.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1455972742 802 80.91.229.3 (20 Feb 2016 12:52:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Feb 2016 12:52:22 +0000 (UTC) Cc: mbork@mbork.pl, 18236@debbugs.gnu.org To: Reuben Thomas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 20 13:52:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aX718-0007IN-T4 for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Feb 2016 13:52:11 +0100 Original-Received: from localhost ([::1]:60639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX718-00032E-45 for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Feb 2016 07:52:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX713-0002yD-TF for bug-gnu-emacs@gnu.org; Sat, 20 Feb 2016 07:52:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aX710-0001xF-Nu for bug-gnu-emacs@gnu.org; Sat, 20 Feb 2016 07:52:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX710-0001xB-K8 for bug-gnu-emacs@gnu.org; Sat, 20 Feb 2016 07:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aX710-0004wE-Cs for bug-gnu-emacs@gnu.org; Sat, 20 Feb 2016 07:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Feb 2016 12:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18236 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18236-submit@debbugs.gnu.org id=B18236.145597267318924 (code B ref 18236); Sat, 20 Feb 2016 12:52:02 +0000 Original-Received: (at 18236) by debbugs.gnu.org; 20 Feb 2016 12:51:13 +0000 Original-Received: from localhost ([127.0.0.1]:34672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aX70D-0004v9-CW for submit@debbugs.gnu.org; Sat, 20 Feb 2016 07:51:13 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49319) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aX70B-0004uw-MP for 18236@debbugs.gnu.org; Sat, 20 Feb 2016 07:51:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aX703-0001ne-5a for 18236@debbugs.gnu.org; Sat, 20 Feb 2016 07:51:06 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aX703-0001na-29; Sat, 20 Feb 2016 07:51:03 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1519 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aX702-0001L2-6H; Sat, 20 Feb 2016 07:51:02 -0500 In-reply-to: (message from Reuben Thomas on Sat, 20 Feb 2016 12:32:03 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113360 Archived-At: > Date: Sat, 20 Feb 2016 12:32:03 +0000 > From: Reuben Thomas > Cc: Marcin Borkowski , 18236@debbugs.gnu.org > > The most we can do is display a warning and ask for confirmation when > the values of buffer-file-coding-system differ between the patch > file's buffer and the buffer of file to be patched. Will that be > sufficient? > > Thanks for your analysis. ​This solution sounds fine to me: ​as you say, in general it's impossible to tell exactly > what went wrong, but we can warn the user so that the unfortunate result I described is not obtained silently. Marcin, would you like to work on a change along these lines? The function to use for comparing 2 coding-systems is `coding-system-equal'. The idea is to see if the values of `buffer-file-coding-system' in the patch-file buffer (where the command is invoked) and in the buffer that visits the file to be patched (after `find-file-noselect' call in `diff-find-source-location' returns) are different, and if so, ask the user for confirmation. Ideally, the confirmation should only be requested once, when applying the 1st hunk from the patch file. Thanks.