unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6635: mouse-yank-primary/secondary and unicode from other apps.
@ 2010-07-15  0:38 David De La Harpe Golden
  2010-07-15  5:29 ` Kevin Rodgers
  2011-10-06 21:42 ` Glenn Morris
  0 siblings, 2 replies; 5+ messages in thread
From: David De La Harpe Golden @ 2010-07-15  0:38 UTC (permalink / raw)
  To: 6635

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

mouse-yank-primary and mouse-yank-secondary don't like
inserting non-ascii chars from other apps.

They need to use the slightly higher-level
(x-selection-value 'PRIMARY)

or at least give a 'TEXT arg to their
(x-get-selection 'PRIMARY 'TEXT),

so that the proper kinds of selection type are tried
as e.g. attached.







[-- Attachment #2: myp-encode_r1.diff --]
[-- Type: text/x-patch, Size: 1919 bytes --]

=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2010-07-14 18:03:39 +0000
+++ lisp/mouse.el	2010-07-15 00:32:41 +0000
@@ -1277,19 +1277,19 @@
   (interactive "e")
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
   (when select-active-regions
     ;; Without this, confusing things happen upon e.g. inserting into
     ;; the middle of an active region.
     (deactivate-mark))
   (or mouse-yank-at-point (mouse-set-point click))
-  (let ((primary (x-get-selection 'PRIMARY)))
+  (let ((primary (x-selection-value 'PRIMARY)))
     (if primary
-        (insert (x-get-selection 'PRIMARY))
+        (insert (x-selection-value 'PRIMARY))
       (error "No primary selection"))))
 
 (defun mouse-kill-ring-save (click)
   "Copy the region between point and the mouse click in the kill ring.
 This does not delete the region; it acts like \\[kill-ring-save]."
   (interactive "e")
   (mouse-set-mark-fast click)
   (let (this-command last-command)
@@ -1572,19 +1572,19 @@
   "Insert the secondary selection at the position clicked on.
 Move point to the end of the inserted text.
 If `mouse-yank-at-point' is non-nil, insert at point
 regardless of where you click."
   (interactive "e")
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
   (or mouse-yank-at-point (mouse-set-point click))
-  (let ((secondary (x-get-selection 'SECONDARY)))
+  (let ((secondary (x-selection-value 'SECONDARY)))
     (if secondary
-        (insert (x-get-selection 'SECONDARY))
+        (insert (x-selection-value 'SECONDARY))
       (error "No secondary selection"))))
 
 (defun mouse-kill-secondary ()
   "Kill the text in the secondary selection.
 This is intended more as a keyboard command than as a mouse command
 but it can work as either one.
 
 The current buffer (in case of keyboard use), or the buffer clicked on,


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

* bug#6635: mouse-yank-primary/secondary and unicode from other apps.
  2010-07-15  0:38 bug#6635: mouse-yank-primary/secondary and unicode from other apps David De La Harpe Golden
@ 2010-07-15  5:29 ` Kevin Rodgers
  2010-07-18 16:39   ` David De La Harpe Golden
  2011-10-06 21:42 ` Glenn Morris
  1 sibling, 1 reply; 5+ messages in thread
From: Kevin Rodgers @ 2010-07-15  5:29 UTC (permalink / raw)
  To: bug-gnu-emacs

David De La Harpe Golden wrote:
> mouse-yank-primary and mouse-yank-secondary don't like
> inserting non-ascii chars from other apps.
> 
> They need to use the slightly higher-level
> (x-selection-value 'PRIMARY)
> 
> or at least give a 'TEXT arg to their
> (x-get-selection 'PRIMARY 'TEXT),
> 
> so that the proper kinds of selection type are tried
> as e.g. attached.
...
-  (let ((primary (x-get-selection 'PRIMARY)))
+  (let ((primary (x-selection-value 'PRIMARY)))
      (if primary
-        (insert (x-get-selection 'PRIMARY))
+        (insert (x-selection-value 'PRIMARY))
        (error "No primary selection"))))
...
-  (let ((secondary (x-get-selection 'SECONDARY)))
+  (let ((secondary (x-selection-value 'SECONDARY)))
      (if secondary
-        (insert (x-get-selection 'SECONDARY))
+        (insert (x-selection-value 'SECONDARY))
        (error "No secondary selection"))))

Can someone explain why the result of x-get-selection/x-selection-value
is bound to a variable, but instead of referencing the variable in the
insert function call the expression is evaluated again?  I.e. why not
change it to:

  (let ((primary (x-selection-value 'PRIMARY)))
    (if primary
        (insert primary)
      (error "No primary selection"))))
...
  (let ((secondary (x-selection-value 'SECONDARY)))
    (if secondary
        (insert secondary)
      (error "No secondary selection"))))

Thanks,

-- 
Kevin Rodgers
Denver, Colorado, USA






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

* bug#6635: mouse-yank-primary/secondary and unicode from other apps.
  2010-07-15  5:29 ` Kevin Rodgers
@ 2010-07-18 16:39   ` David De La Harpe Golden
  0 siblings, 0 replies; 5+ messages in thread
From: David De La Harpe Golden @ 2010-07-18 16:39 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: bug-gnu-emacs

On 15/07/10 06:29, Kevin Rodgers wrote:

> Can someone explain why the result of x-get-selection/x-selection-value
> is bound to a variable, but instead of referencing the variable in the
> insert function call the expression is evaluated again? I.e. why not
> change it to:
>

I don't know anyway; you're likely quite right - in fact wouldn't there 
be a race the other way? I think the selection could (at least in 
principle) vanish in between the two calls if another app owns it...

> (let ((primary (x-selection-value 'PRIMARY)))
> (if primary
> (insert primary)
> (error "No primary selection"))))
> ...
> (let ((secondary (x-selection-value 'SECONDARY)))
> (if secondary
> (insert secondary)
> (error "No secondary selection"))))
>
> Thanks,
>






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

* bug#6635: mouse-yank-primary/secondary and unicode from other apps.
  2010-07-15  0:38 bug#6635: mouse-yank-primary/secondary and unicode from other apps David De La Harpe Golden
  2010-07-15  5:29 ` Kevin Rodgers
@ 2011-10-06 21:42 ` Glenn Morris
  2011-10-06 23:17   ` David De La Harpe Golden
  1 sibling, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2011-10-06 21:42 UTC (permalink / raw)
  To: David De La Harpe Golden; +Cc: 6635

David De La Harpe Golden wrote:

> mouse-yank-primary and mouse-yank-secondary don't like
> inserting non-ascii chars from other apps.

Is this still an issue?

I copied some non-ASCII chars in firefox and pasted them to the current
Emacs trunk with no problem.





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

* bug#6635: mouse-yank-primary/secondary and unicode from other apps.
  2011-10-06 21:42 ` Glenn Morris
@ 2011-10-06 23:17   ` David De La Harpe Golden
  0 siblings, 0 replies; 5+ messages in thread
From: David De La Harpe Golden @ 2011-10-06 23:17 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 6635

On 06/10/11 22:42, Glenn Morris wrote:
> David De La Harpe Golden wrote:
>
>> mouse-yank-primary and mouse-yank-secondary don't like
>> inserting non-ascii chars from other apps.
>
> Is this still an issue?
>
> I copied some non-ASCII chars in firefox and pasted them to the current
> Emacs trunk with no problem.

I think this got fixed in trunk by Jan D. under #6802 and closing this 
report was overlooked. And it appears to be fixed for both primary and 
secondary, just tested in case.

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6802#40






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

end of thread, other threads:[~2011-10-06 23:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-15  0:38 bug#6635: mouse-yank-primary/secondary and unicode from other apps David De La Harpe Golden
2010-07-15  5:29 ` Kevin Rodgers
2010-07-18 16:39   ` David De La Harpe Golden
2011-10-06 21:42 ` Glenn Morris
2011-10-06 23:17   ` David De La Harpe Golden

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