From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#25524: 26.0.50; diff-mode is broken Date: Thu, 26 Jan 2017 13:29:59 +0900 Message-ID: <87k29ie94o.fsf@gmail.com> References: <874m0nwshr.fsf@secretsauce.net> <87tw8ncd6v.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1485405091 22062 195.159.176.226 (26 Jan 2017 04:31:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 26 Jan 2017 04:31:31 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 25524@debbugs.gnu.org, Dima Kogan , tino.calancha@gmail.com To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 26 05:31:21 2017 Return-path: Envelope-to: geb-bug-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 1cWbiI-0003tv-Cf for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Jan 2017 05:31:10 +0100 Original-Received: from localhost ([::1]:36093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWbiN-0004ij-M5 for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Jan 2017 23:31:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWbiD-0004fs-Uf for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 23:31:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWbiA-0004Ty-Os for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 23:31:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45816) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cWbiA-0004Tq-LV for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 23:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cWbiA-0007qk-Fi for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2017 23:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2017 04:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25524 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25524-submit@debbugs.gnu.org id=B25524.148540501230119 (code B ref 25524); Thu, 26 Jan 2017 04:31:02 +0000 Original-Received: (at 25524) by debbugs.gnu.org; 26 Jan 2017 04:30:12 +0000 Original-Received: from localhost ([127.0.0.1]:44015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWbhL-0007pj-QC for submit@debbugs.gnu.org; Wed, 25 Jan 2017 23:30:12 -0500 Original-Received: from mail-pf0-f196.google.com ([209.85.192.196]:36251) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWbhK-0007ot-K8 for 25524@debbugs.gnu.org; Wed, 25 Jan 2017 23:30:11 -0500 Original-Received: by mail-pf0-f196.google.com with SMTP id 19so15691284pfo.3 for <25524@debbugs.gnu.org>; Wed, 25 Jan 2017 20:30:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=fWjP+EZPySifgwmbAbMEIiMzL9/bjsL2gWq4syBF3t0=; b=g7jak23tdXyP63IOC/j5bGvqHxw/oWfdRz7i9QSySBPQyw92M/jQLii9q1ZHzm02H6 LKG66ptLtS8QNMkQ7WXX5ZHrjuCGZlDDmzkgupoc1wKjQ+fY/Px5u+m27wO7o/f5oe8t M5reg1qg1WHB+AoyKqyi4urB5Ul0naNBcixIN2NLMVvUHJ7/vWiniFM1HvcqIMb5Gjvk C3yH4Xp9EU6Wcp7u4DytjvK+Rzx+soW3u5V6z+elvI3CyFl4Nx2MkXRw7Wd7kESvmV01 UGsc8rwiy6OTeYLLEuncsBxg9VS8pM6yUovD49MhIM6LiGAyxwBdWMWitAIsd+5lcCjW gVtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=fWjP+EZPySifgwmbAbMEIiMzL9/bjsL2gWq4syBF3t0=; b=BIYq8QRDS003Ez7VLFrNJbY7Q0b5W2A0raHhHPNfYo8OKN9w2vfRdAPcSRucKRfpn7 bsNRW2QvqC2MT4BQC7sDz8bjJ64ObbcVm0/J5Aq0DL9kJOuW2/9zsNDqPmN3fqp7cVfa ExbgK1acwFBdYbs6tqKpPsh7EKuBUHEdi+6W7S+vGiwoQN4rSlmdf2/Y+yILDEvK4m4x TT5BfZhPBb0paaJfepCcPKMD9n+NmSq1dbhQHV8ntmqK3oRwdZFCZt2ea53mholV6DQX FI/k21Mnx/EktUyjFQQJ+O2LvbFVdj49Td6xisMsLG9uWC0oVaY/MimeUWU39b2ZZGJ+ BUPQ== X-Gm-Message-State: AIkVDXJslNwuDsZdEt6eTjwQoPWlZCMAq0bUwpNOjQkEHNi+P/u/SKbMvN6gxm61RPZaLw== X-Received: by 10.98.86.203 with SMTP id h72mr988068pfj.108.1485405004729; Wed, 25 Jan 2017 20:30:04 -0800 (PST) Original-Received: from calancha-pc (33.94.100.220.dy.bbexcite.jp. [220.100.94.33]) by smtp.gmail.com with ESMTPSA id p14sm562218pfl.75.2017.01.25.20.30.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Jan 2017 20:30:04 -0800 (PST) In-Reply-To: (Noam Postavsky's message of "Wed, 25 Jan 2017 15:47:53 -0500") 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" Xref: news.gmane.org gmane.emacs.bugs:128522 Archived-At: Noam Postavsky writes: > On Wed, Jan 25, 2017 at 11:32 AM, Tino Calancha wrote: >> ;; "index ", "old mode", "new mode", "new file mode" and >> -;; "deleted file mode" are output by git-diff. >> +;; "deleted file mode" are output by git-diff; "Index: " and >> +;; "========..." by SVN. >> (defconst diff-file-junk-re >> - "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file") >> + (concat "Index: \\|" (make-string 67 ?=) "\\|" >> + "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file")) > > Is it safe to assume exactly 67 "="? Maybe it would be better to use > something like "=\\{20,\\}", i.e. a sequence of 20 or more "=". Humm probably 20 is OK, but i am not using SVN in a while: i ignore if such '====...' might be coustomizable. Updated the patch to use >=20 ?=. Dima Kogan writes: > More broadly, are we sure we need to be touching this? The previous > approach and the one before that worked with the stock regexes. 1) The previous approach touch more things that just and already existant regexp: it caused several problems already well discussed in Bug#25105. 2) In the original approach, the mere existance of 'diff-file-junk-re' as it is, it looks weird. The file want to support all kind VCS, not just Git, so it's unnatural that the regexp just contains words from Git diff headers. Indeed, you can see that there are some hardcoded "^Index: " around the file to handle SVN. IMO, it's more readable adding the necessary stuff to `diff-file-junk-re' and perform such operations uniformly just with same function and regexp. Then, if later turns out that we need more keyword to handle other VCS we just need to change on line of code, i.e., add those words into `diff-file-junk-re'. That said, you are very welcome to improve current implementation so that any `diff-file-junk-re' is required at all, without changing other desirable functionality of the file. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From c3788c73140af02d6fc2b414ddcdbaf273890cdf Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Thu, 26 Jan 2017 13:22:46 +0900 Subject: [PATCH] Fix Bug#25524 * lisp/vc/diff-mode.el (diff-beginning-of-hunk): Return pos at beginning of hunk. (diff-file-junk-re): Add SVN keywords. --- lisp/vc/diff-mode.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index b7ad8e8ebd..e609ca9f94 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -501,7 +501,8 @@ diff-end-of-hunk ;; "index ", "old mode", "new mode", "new file mode" and ;; "deleted file mode" are output by git-diff. (defconst diff-file-junk-re - "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file") + (concat "Index: \\|=\\{20,\\}\\|" ; SVN + "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file")) ;; If point is in a diff header, then return beginning ;; of hunk position otherwise return nil. @@ -545,7 +546,8 @@ diff-beginning-of-hunk (error "Can't find the beginning of the hunk"))) ((re-search-backward regexp nil t)) ; In the middle of a hunk. ((re-search-forward regexp nil t) ; At first hunk header. - (forward-line 0)) + (forward-line 0) + (point)) (t (error "Can't find the beginning of the hunk")))))) (defun diff-unified-hunk-p () -- 2.11.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.6) of 2017-01-26 built Repository revision: 44765de2005fb56c5930383d6bd1e959a0102a45