unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17271: 24.4.50; mouse-yank-primary can insert read-only attributes
@ 2014-04-15 18:33 Jorgen Schaefer
  2014-07-02 14:43 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Jorgen Schaefer @ 2014-04-15 18:33 UTC (permalink / raw)
  To: 17271

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#17271: 24.4.50; mouse-yank-primary can insert read-only attributes
  2014-04-15 18:33 bug#17271: 24.4.50; mouse-yank-primary can insert read-only attributes Jorgen Schaefer
@ 2014-07-02 14:43 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-07-02 14:43 UTC (permalink / raw)
  To: Jorgen Schaefer; +Cc: 17271-done, xani666

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 ()








^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-02 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 18:33 bug#17271: 24.4.50; mouse-yank-primary can insert read-only attributes Jorgen Schaefer
2014-07-02 14:43 ` Stefan Monnier

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