From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#37395: [PATCH v3] diff-mode.el: take into account patch separators Date: Tue, 08 Oct 2019 02:04:22 +0300 Message-ID: <1570489462.135652.1@yandex.ru> References: <1568323985.28657.0@yandex.ru> <20190916202643.27946-1-Hi-Angel@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="101335"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 37395@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 08 01:05:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iHc40-000QD3-S9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Oct 2019 01:05:12 +0200 Original-Received: from localhost ([::1]:50038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHc3y-00012Z-PV for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Oct 2019 19:05:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58497) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHc3s-00012H-38 for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2019 19:05:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHc3q-0002d3-TA for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2019 19:05:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40432) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iHc3q-0002cr-PT for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2019 19:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iHc3q-000207-HW for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2019 19:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Oct 2019 23:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37395 X-GNU-PR-Package: emacs Original-Received: via spool by 37395-submit@debbugs.gnu.org id=B37395.15704894757647 (code B ref 37395); Mon, 07 Oct 2019 23:05:02 +0000 Original-Received: (at 37395) by debbugs.gnu.org; 7 Oct 2019 23:04:35 +0000 Original-Received: from localhost ([127.0.0.1]:49253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHc3P-0001zH-4v for submit@debbugs.gnu.org; Mon, 07 Oct 2019 19:04:35 -0400 Original-Received: from forward105p.mail.yandex.net ([77.88.28.108]:51833) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHc3L-0001yz-5t for 37395@debbugs.gnu.org; Mon, 07 Oct 2019 19:04:33 -0400 Original-Received: from mxback28o.mail.yandex.net (mxback28o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::79]) by forward105p.mail.yandex.net (Yandex) with ESMTP id DF7E44D40140; Tue, 8 Oct 2019 02:04:23 +0300 (MSK) Original-Received: from iva1-dacac67eb28c.qloud-c.yandex.net (iva1-dacac67eb28c.qloud-c.yandex.net [2a02:6b8:c0c:789:0:640:daca:c67e]) by mxback28o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id RFQgHEyJSO-4N9iIQiX; Tue, 08 Oct 2019 02:04:23 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1570489463; bh=U65q+HFVRQMBHpBIrZr8Ps4ROzEUQjExCmL4FXqruF0=; h=In-Reply-To:Cc:To:Subject:From:References:Date:Message-Id; b=gZck18BUezyoynHaK9LgVVS29AY9v0XRj4aOg2OWljICHLoCTTJra0N6h68VF89yl 655/Gx4BmjrnvMu+zDmvo+78oR4UfofkV90Es9RvwKWmnASZfANWY8Yr5x5hRp0QDK IiL5cv/pF+asRQZWd8TY8huMwj9aJrhuAi/v9W2c= Authentication-Results: mxback28o.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by iva1-dacac67eb28c.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id glbeUbQbWU-4MqiAmj4; Tue, 08 Oct 2019 02:04:23 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) In-Reply-To: <874l0l9njn.fsf@gnus.org> X-Mailer: geary/3.35.0 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: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:168592 Archived-At: On =CF=ED, =EE=EA=F2 7, 2019 at 06:39, Lars Ingebrigtsen =20 wrote: > (Some minor comments.) Thanks! > Konstantin Kharlamov writes: >=20 >> +(defsubst diff-prev-line-if-patch-separator () >> + "Return previous line if it has patch separator produced by >> +git-format-patch." >=20 > I don't think this needs to be a defsubst -- a defun is fine here. Will do. > And the first doc string line should be a complete sentence. Sorry, I'm not sure I get it: do you want me to keep the=20 "git-format-patch." text on the first line, with the rest of the=20 sentence? >> +(setq-local diff-buffer-type nil) >=20 > This should probably be a defvar and then a setq-local in `diff-mode'. Will do. >> + (save-excursion >> + (if (re-search-forward "^diff --git" nil t) >> + (setq diff-buffer-type 'git) >> + (setq diff-buffer-type nil)))) >=20 > Hm... are we really guaranteed that all git diffs have that string in > it somewhere? Well, according to #git channel on Freenode and this answer=20 https://stackoverflow.com/questions/39834729/what-does-the-diff-git-output-= in-git-diff-refer-to=20 apparently, it's there unless someone explicitly changed config for it=20 to not be there. But any other ideas to detect git format are welcome. I personally=20 would prefer to not do detection at all, because I'm sure the case=20 where we could misdetect text and miscalculate the diff header is too=20 statistically insignificant. Too many things need to happen at once =97=20 and it doesn't seem that diff-mode being used by a lot of people too,=20 since pretty major problem that I fix here went unnoticed for so long. =