Subject: bug#17271: closed (Re: bug#17271: 24.4.50; mouse-yank-primary can insert read-only attributes)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 02 Jul 2014 14:45:04 +0000

Your bug report

#17271: 24.4.50; mouse-yank-primary can insert read-only attributes

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].

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

Subject: Re: bug#17271: 24.4.50; mouse-yank-primary can insert read-only attributes
From: Stefan Monnier <[email-masked]>
To: Jorgen Schaefer <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Wed, 02 Jul 2014 10:43:46 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Version:24.4

> Then select the "foo" and immediately yank it somewhere using the middle
> mouse button. The inserted text retains the read-only property.
>
> It probably would be a good idea for `mouse-yank-primary' to use
> `insert-for-yank' instead of `insert'.

Indeed, thanks.  I installed the patch below into the `emacs-24' branch.

        Stefan

=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2014-06-20 18:35:04 +0000
+++ lisp/mouse.el	2014-07-02 14:37:36 +0000
@@ -1101,7 +1101,7 @@
     (unless primary
       (error "No selection is available"))
     (push-mark (point))
-    (insert primary)))
+    (insert-for-yank primary)))
 
 (defun mouse-kill-ring-save (click)
   "Copy the region between point and the mouse click in the kill ring.
@@ -1383,7 +1383,7 @@
   (or mouse-yank-at-point (mouse-set-point click))
   (let ((secondary (x-get-selection 'SECONDARY)))
     (if secondary
-        (insert secondary)
+        (insert-for-yank secondary)
       (error "No secondary selection"))))
 
 (defun mouse-kill-secondary ()

Subject: 24.4.50; mouse-yank-primary can insert read-only attributes
From: Jorgen Schaefer <[email-masked]>
To: [email-masked]
Date: Tue, 15 Apr 2014 20:33:25 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi!
We have witnessed some strange behavior when users of the IRC client
Circe copied text from a channel buffer elsewhere. The copied text
remained read-only, as the channel buffer is, but only when copied using
the mouse, not when copied using the keyboard.

Reproduction:

(setq select-active-regions t)
(insert (propertize "foo" 'read-only t))

Then select the "foo" and immediately yank it somewhere using the middle
mouse button. The inserted text retains the read-only property.

It probably would be a good idea for `mouse-yank-primary' to use
`insert-for-yank' instead of `insert'.