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#25570: 24.5; diff-hunk-kill: Show more clear error messages Date: Sun, 29 Jan 2017 20:36:41 +0900 (JST) Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1485689842 30577 195.159.176.226 (29 Jan 2017 11:37:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2017 11:37:22 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) To: 25570@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 29 12:37:18 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 1cXnn8-0006as-5B for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Jan 2017 12:37:06 +0100 Original-Received: from localhost ([::1]:54893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXnnD-0000SC-Mr for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Jan 2017 06:37:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXnn7-0000Rw-Om for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2017 06:37:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXnn4-0007aj-LL for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2017 06:37:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51529) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXnn4-0007af-Hh for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2017 06:37:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cXnn4-0004b2-9S for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2017 06:37: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: Sun, 29 Jan 2017 11:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25570 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148568981817655 (code B ref -1); Sun, 29 Jan 2017 11:37:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Jan 2017 11:36:58 +0000 Original-Received: from localhost ([127.0.0.1]:49728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXnn0-0004ah-AJ for submit@debbugs.gnu.org; Sun, 29 Jan 2017 06:36:58 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43521) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXnmy-0004aU-Gv for submit@debbugs.gnu.org; Sun, 29 Jan 2017 06:36:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXnms-0007a0-6z for submit@debbugs.gnu.org; Sun, 29 Jan 2017 06:36:51 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:39703) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cXnms-0007Zv-3C for submit@debbugs.gnu.org; Sun, 29 Jan 2017 06:36:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXnmq-0000Qm-Pm for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2017 06:36:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXnmn-0007Zb-Lv for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2017 06:36:48 -0500 Original-Received: from mail-pg0-x22e.google.com ([2607:f8b0:400e:c05::22e]:35655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXnmn-0007ZV-Fp for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2017 06:36:45 -0500 Original-Received: by mail-pg0-x22e.google.com with SMTP id 194so93573288pgd.2 for ; Sun, 29 Jan 2017 03:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:subject:message-id:user-agent:mime-version; bh=IMgkvhCinGpZksFxw5bXp8jbGHtwhhZPBieKAF0TfUs=; b=ZKgBq8og5wFIcWcwnX7nWQkKHoGkhu2Xxl1sAMtZ/yxELIzzK4bTsjF7Hl4s89kPNX /kMfi1JBDsL387OLy8RBgEGwdc/2bAA+1eIwAN7lOT4IelEI+B7NUizSmVIUDZH4UgN5 HBIsoWVNjQC9lVmntuDcd24xcsIjZCpBY8flATt4tdSylUYO2AoTtsZ6H6fAOiJ6uS0d MNVsci4UnLXshGCd3DLx9PSmwdq+UEiS+VVrxcxdbfsBjJYWKixTmYjEWpseJPw3w/k/ A3pIa0sWNKJHWQpJhO9UkfZSssAkZM4PUmBG0n9D/rtxkD7bXxbgUzc8AXGF8uTSb3zI 5HuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:subject:message-id:user-agent :mime-version; bh=IMgkvhCinGpZksFxw5bXp8jbGHtwhhZPBieKAF0TfUs=; b=eJerTG1tVA3rGITPmuXOtF0AWI9GIASKAriK14dp5NUSOGdFIZxGxH5V+P/MopiTDv Hbjp7kOkEs0OPRF/8qDn30NZGxoAvSsB1xBpqnyiDpbODgCtzw4i9XcF9yayc5rpYhCd a8eZTp5TBVcy0HVhxKunCZ+rDT34qda26eDshPewsaUi0rzHEYSX5HK2ioTseAgrKAgo +bw7H05/edlDufTfMi/c25XTgDrp6h+zzVGV41S4yY/WfEJaAqBwVrrZ6RhzHRjdHPv5 H6L0oT4p2YKScU1r1nkQYvBODFTzdkriVjpW8DhbtctWGrYTdZWqO9QSOBeIRQ1iEcm0 aJYQ== X-Gm-Message-State: AIkVDXLtg27F51iDMwjrUNW988IXNDvxqj5KNtVDHis8O4fn1AKkbe8yYOXh6WPh88Ixug== X-Received: by 10.99.154.9 with SMTP id o9mr18689864pge.69.1485689804240; Sun, 29 Jan 2017 03:36:44 -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 q22sm24313752pfj.77.2017.01.29.03.36.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Jan 2017 03:36:43 -0800 (PST) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:128749 Archived-At: emacs -Q: ; Put following content in a buffer in diff-mode: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; START diff --git a/a b/a index 184cbf6..d2d9a24 100644 --- a/a +++ b/a @@ -1,2 +1,2 @@ -I have a foo in my bar. +I have a qux in my bar. Me too. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; END < ; Go to beginning of buffer M-k ; Signal error: Can't find the beginning of the file. M-K ; Same. M-n M-k ; Delete hunk OK, but it shows previous error in echo area. I propose the following patch: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 10af5a6466328acff37485364f8332a8043872e8 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sun, 29 Jan 2017 20:17:09 +0900 Subject: [PATCH] Ignore error after kill last file or hunk * lisp/vc/diff-mode.el (diff-hunk-kill): Ignore error after kill last hunk. (diff-file-kill): Idem. Go to beginning of hunk before kill (Bug#25570). --- lisp/vc/diff-mode.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index e609ca9f94..3f3ade799b 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -668,7 +668,7 @@ diff-hunk-kill (inhibit-read-only t)) (apply 'kill-region bounds) (goto-char (car bounds)) - (diff-beginning-of-hunk t))) + (ignore-errors (diff-beginning-of-hunk t)))) (defun diff-beginning-of-file-and-junk () "Go to the beginning of file-related diff-info. @@ -720,9 +720,10 @@ diff-beginning-of-file-and-junk (defun diff-file-kill () "Kill current file's hunks." (interactive) + (diff-beginning-of-hunk t) (let ((inhibit-read-only t)) (apply 'kill-region (diff-bounds-of-file))) - (diff-beginning-of-hunk t)) + (ignore-errors (diff-beginning-of-hunk t))) (defun diff-kill-junk () "Kill spurious empty diffs." -- 2.11.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.6) of 2017-01-29 Repository revision: 0073223c23749ffd6bd3f882bc30a82cc37efd2a