From: Tino Calancha <tino.calancha@gmail.com>
To: 25570@debbugs.gnu.org
Subject: bug#25570: 24.5; diff-hunk-kill: Show more clear error messages
Date: Sun, 29 Jan 2017 20:36:41 +0900 (JST) [thread overview]
Message-ID: <alpine.DEB.2.20.1701292036010.6886@calancha-pc> (raw)
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 <tino.calancha@gmail.com>
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
next reply other threads:[~2017-01-29 11:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-29 11:36 Tino Calancha [this message]
2017-02-02 13:33 ` bug#25570: 24.5; diff-hunk-kill: Show more clear error messages Tino Calancha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1701292036010.6886@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=25570@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).