From unknown Sat Sep 13 13:15:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12584: refine diff-hunk broken for unified diff with "\ No newline at end of file" meta text Resent-From: Le Wang Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Oct 2012 15:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12584 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 12584@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.134953622523368 (code B ref -1); Sat, 06 Oct 2012 15:11:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Oct 2012 15:10:25 +0000 Received: from localhost ([127.0.0.1]:58336 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKW1I-00064q-OK for submit@debbugs.gnu.org; Sat, 06 Oct 2012 11:10:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45974) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKW1G-00064c-29 for submit@debbugs.gnu.org; Sat, 06 Oct 2012 11:10:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKW0t-0007Lp-86 for submit@debbugs.gnu.org; Sat, 06 Oct 2012 11:09:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, URIBL_SBL autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:33109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKW0t-0007Ll-52 for submit@debbugs.gnu.org; Sat, 06 Oct 2012 11:09:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKW0s-00021Z-4d for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 11:09:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKW0r-0007LW-28 for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 11:09:58 -0400 Received: from mail-qc0-f169.google.com ([209.85.216.169]:58336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKW0q-0007LQ-TQ for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 11:09:56 -0400 Received: by mail-qc0-f169.google.com with SMTP id t2so2717443qcq.0 for ; Sat, 06 Oct 2012 08:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ml4z/p74V3M1/jpeHbZDxqEsbnqL8gEEh5bk/pMHBrI=; b=uZEt/DaWb8DtyKtJOWwxttx7J8DgH1cZBFFPM+7dAiK1lGmKh6lJP4O9T8UMoJ4FKQ sq54988s5DzkecwdSYQm78WaTsvjbtsYzyUsOyY6l3MJ38L/NlpU4E1J1kUZx8KChWDb qyEDi+ghAKvkBpOxtLXICyLTxssHYoyUZLJFWH10ByTI268OuCZDBI6PuamLIxTdfvrT 1nEq17yEu7NYKUZSN3LR8MPWS+6vLC4yGIGCYB+BrYVPde7Yx3n7H0kLL5g7tuC7HrMp pW+EK/zemLaZuPLv3gJsIuyK/47RBK1+64WZYApFb9vhXLqFoMxXIg/LOJq0uXm6vu8d iKVA== MIME-Version: 1.0 Received: by 10.224.39.147 with SMTP id g19mr22211002qae.46.1349536196541; Sat, 06 Oct 2012 08:09:56 -0700 (PDT) Received: by 10.49.50.7 with HTTP; Sat, 6 Oct 2012 08:09:56 -0700 (PDT) Date: Sat, 6 Oct 2012 23:09:56 +0800 Message-ID: From: Le Wang Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.8 (-) Here is refine working with "diff -c" http://puu.sh/1bXRG Here is refein not working with "diff -u" because of the aforementioned meta text http://puu.sh/1bXPJ -- Le From unknown Sat Sep 13 13:15:24 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Le Wang Subject: bug#12584: closed (Re: bug#12584: refine diff-hunk broken for unified diff with "\ No newline at end of file" meta text) Message-ID: References: X-Gnu-PR-Message: they-closed 12584 X-Gnu-PR-Package: emacs Reply-To: 12584@debbugs.gnu.org Date: Fri, 26 Oct 2012 15:55:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1351266902-19947-1" This is a multi-part message in MIME format... ------------=_1351266902-19947-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #12584: refine diff-hunk broken for unified diff with "\ No newline at end = of file" meta text which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 12584@debbugs.gnu.org. --=20 12584: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D12584 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1351266902-19947-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 12584-done) by debbugs.gnu.org; 26 Oct 2012 15:54:02 +0000 Received: from localhost ([127.0.0.1]:34921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TRmET-0005A4-GJ for submit@debbugs.gnu.org; Fri, 26 Oct 2012 11:54:02 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:62368) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TRmES-00059x-0z for 12584-done@debbugs.gnu.org; Fri, 26 Oct 2012 11:54:00 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu0/O+LFW/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLDiYHCxQYDSSIHAW6CZBEA6AVAYMdgViDBQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="202918287" Received: from 206-248-177-86.dsl.teksavvy.com (HELO pastel.home) ([206.248.177.86]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 26 Oct 2012 11:51:49 -0400 Received: by pastel.home (Postfix, from userid 20848) id 8F29A59347; Fri, 26 Oct 2012 11:51:48 -0400 (EDT) From: Stefan Monnier To: Le Wang Subject: Re: bug#12584: refine diff-hunk broken for unified diff with "\ No newline at end of file" meta text Message-ID: References: Date: Fri, 26 Oct 2012 11:51:48 -0400 In-Reply-To: (Le Wang's message of "Sat, 6 Oct 2012 23:09:56 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12584-done Cc: 12584-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > Here is refine working with "diff -c" > http://puu.sh/1bXRG > Here is refein not working with "diff -u" because of the > aforementioned meta text > http://puu.sh/1bXPJ Thank you. I've installed the patch below which should fix this problem. Stefan === modified file 'lisp/vc/diff-mode.el' --- lisp/vc/diff-mode.el 2012-10-23 18:40:23 +0000 +++ lisp/vc/diff-mode.el 2012-10-26 15:50:33 +0000 @@ -482,7 +482,9 @@ (re-search-forward (if diff-valid-unified-empty-line "^[- \n]" "^[- ]") nil t nold) - (line-beginning-position 2))) + (line-beginning-position + ;; Skip potential "\ No newline at end of file". + (if (looking-at ".*\n\\\\") 3 2)))) (endnew ;; The hunk may end with a bunch of "+" lines, so the `end' is ;; then further than computed above. @@ -490,7 +492,9 @@ (re-search-forward (if diff-valid-unified-empty-line "^[+ \n]" "^[+ ]") nil t nnew) - (line-beginning-position 2)))) + (line-beginning-position + ;; Skip potential "\ No newline at end of file". + (if (looking-at ".*\n\\\\") 3 2))))) (setq end (max endold endnew))))) ;; We may have a first evaluation of `end' thanks to the hunk header. (unless end @@ -1972,7 +1976,12 @@ (goto-char beg) (pcase style (`unified - (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+" + (while (re-search-forward + (eval-when-compile + (let ((no-LF-at-eol-re "\\(?:\\\\.*\n\\)?")) + (concat "^\\(?:-.*\n\\)+" no-LF-at-eol-re + "\\(\\)" + "\\(?:\\+.*\n\\)+" no-LF-at-eol-re))) end t) (smerge-refine-subst (match-beginning 0) (match-end 1) (match-end 1) (match-end 0) ------------=_1351266902-19947-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 6 Oct 2012 15:10:25 +0000 Received: from localhost ([127.0.0.1]:58336 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKW1I-00064q-OK for submit@debbugs.gnu.org; Sat, 06 Oct 2012 11:10:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45974) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKW1G-00064c-29 for submit@debbugs.gnu.org; Sat, 06 Oct 2012 11:10:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKW0t-0007Lp-86 for submit@debbugs.gnu.org; Sat, 06 Oct 2012 11:09:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, URIBL_SBL autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:33109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKW0t-0007Ll-52 for submit@debbugs.gnu.org; Sat, 06 Oct 2012 11:09:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKW0s-00021Z-4d for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 11:09:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKW0r-0007LW-28 for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 11:09:58 -0400 Received: from mail-qc0-f169.google.com ([209.85.216.169]:58336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKW0q-0007LQ-TQ for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 11:09:56 -0400 Received: by mail-qc0-f169.google.com with SMTP id t2so2717443qcq.0 for ; Sat, 06 Oct 2012 08:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ml4z/p74V3M1/jpeHbZDxqEsbnqL8gEEh5bk/pMHBrI=; b=uZEt/DaWb8DtyKtJOWwxttx7J8DgH1cZBFFPM+7dAiK1lGmKh6lJP4O9T8UMoJ4FKQ sq54988s5DzkecwdSYQm78WaTsvjbtsYzyUsOyY6l3MJ38L/NlpU4E1J1kUZx8KChWDb qyEDi+ghAKvkBpOxtLXICyLTxssHYoyUZLJFWH10ByTI268OuCZDBI6PuamLIxTdfvrT 1nEq17yEu7NYKUZSN3LR8MPWS+6vLC4yGIGCYB+BrYVPde7Yx3n7H0kLL5g7tuC7HrMp pW+EK/zemLaZuPLv3gJsIuyK/47RBK1+64WZYApFb9vhXLqFoMxXIg/LOJq0uXm6vu8d iKVA== MIME-Version: 1.0 Received: by 10.224.39.147 with SMTP id g19mr22211002qae.46.1349536196541; Sat, 06 Oct 2012 08:09:56 -0700 (PDT) Received: by 10.49.50.7 with HTTP; Sat, 6 Oct 2012 08:09:56 -0700 (PDT) Date: Sat, 6 Oct 2012 23:09:56 +0800 Message-ID: Subject: refine diff-hunk broken for unified diff with "\ No newline at end of file" meta text From: Le Wang To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.8 (-) Here is refine working with "diff -c" http://puu.sh/1bXRG Here is refein not working with "diff -u" because of the aforementioned meta text http://puu.sh/1bXPJ -- Le ------------=_1351266902-19947-1--