Subject: bug#13169: closed (Re: bug#13169: [PATCH] kill-region fails to deactivate mark after cutting empty region)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 21 Dec 2012 03:51:02 +0000

Your bug report

#13169: [PATCH] kill-region fails to deactivate mark after cutting empty region

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 [email-masked].

-- 
13169: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13169
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#13169: [PATCH] kill-region fails to deactivate mark after cutting empty region
From: Chong Yidong <[email-masked]>
To: Kelly Dean <[email-masked]>
Cc: [email-masked]
Date: Fri, 21 Dec 2012 11:49:54 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Kelly Dean <[email-masked]> writes:

> C-SPC C-w C-p
> kill-region cut an empty region, which is correct, but the mark is
> still active, which is incorrect. When the buffer and text aren't
> read-only, kill-region relies on the command loop to deactivate the
> mark after the buffer is modified, but when cutting an empty region,
> the buffer isn't modified, so the mark is never deactivated.
> The attached killregionbug.patch fixes it.

Committed to trunk, thanks.

Subject: [PATCH] kill-region fails to deactivate mark after cutting empty region
From: Kelly Dean <[email-masked]>
To: [email-masked]
Date: Thu, 13 Dec 2012 00:19:16 -0800 (PST)
List-Id: <debbugs-submit.debbugs.gnu.org>

On 24.2, emacs -Q
C-SPC M-w C-p
kill-ring-save copied an empty region, and deactivated the mark. This is correct. But now do
C-SPC C-w C-p
kill-region cut an empty region, which is correct, but the mark is still active, which is incorrect. When the buffer and text aren't read-only, kill-region relies on the command loop to deactivate the mark after the buffer is modified, but when cutting an empty region, the buffer isn't modified, so the mark is never deactivated.
The attached killregionbug.patch fixes it.

--- emacs-24.2/lisp/simple.el	2012-08-22 22:33:42.000000000 -0700
+++ emacs-24.2/lisp/simple.el.new2	2012-12-12 22:52:46.258462306 -0800
@@ -3233,6 +3233,7 @@
 	    (kill-new string nil yank-handler)))
 	(when (or string (eq last-command 'kill-region))
 	  (setq this-command 'kill-region))
+	(setq deactivate-mark t)
 	nil)
     ((buffer-read-only text-read-only)
      ;; The code above failed because the buffer, or some of the characters