all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Tobias Bading <tbading@web.de>
Cc: emacs-devel@gnu.org,
	 Pedro Andres Aranda Gutierrez <paaguti@gmail.com>,
	Gregor Zattler <telegraph@gmx.net>
Subject: Re: Copy and paste from Emacs 29 to Thunderbird doesn’t work
Date: Wed, 03 May 2023 13:57:18 +0800	[thread overview]
Message-ID: <87ttwuarep.fsf@yahoo.com> (raw)
In-Reply-To: <42f09837-3d25-e5ca-6203-246fe0e28914@web.de> (Tobias Bading's message of "Wed, 3 May 2023 07:41:27 +0200")

Tobias Bading <tbading@web.de> writes:

> On 03.05.23 07:20, Po Lu wrote:
>> OK, would you please run:
>>
>>   M-x trace-function RET x-dnd-convert-to-text-uri-list RET
>>
>> copy something to Firefox, and show what trace output is printed?
>
> Sorry, there’s no x-dnd-convert-to-text-uri-list, only Zuul. ;-)
>
> (trace-function 'xselect-convert-to-text-uri-list), selecting
> “nopers” in Emacs 29 and then a paste in Thunderbird’s mail composition area
> produces
>
> 1 -> (xselect-convert-to-text-uri-list CLIPBOARD text/uri-list "nopers")
> 1 <- xselect-convert-to-text-uri-list: (text/uri-list . "nopers\n")

Thanks.  Would you please try this change?

diff --git a/lisp/select.el b/lisp/select.el
index 7f089c62dd5..09c678867d0 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -807,19 +807,24 @@ xselect-convert-to-save-targets
 (defun xselect-convert-to-username (_selection _type _value)
   (user-real-login-name))
 
-(defun xselect-convert-to-text-uri-list (_selection _type value)
-  (let ((string
-         (if (stringp value)
-             (xselect--encode-string 'TEXT
-                                     (concat (url-encode-url value) "\n"))
-           (when (vectorp value)
-             (with-temp-buffer
-               (cl-loop for tem across value
-                        do (progn
-                             (insert (url-encode-url tem))
-                             (insert "\n")))
-               (xselect--encode-string 'TEXT (buffer-string)))))))
-    (cons 'text/uri-list (cdr string))))
+(defun xselect-convert-to-text-uri-list (selection _type value)
+  ;; While `xselect-uri-list-available-p' ensures that this target
+  ;; will not be reported in the TARGETS of non-drag-and-drop
+  ;; selections, Firefox stupidly converts to it anyway.  Check that
+  ;; the conversion request is being made for the correct selection.
+  (and (eq selection 'XdndSelection)
+       (let ((string
+              (if (stringp value)
+                  (xselect--encode-string 'TEXT
+                                          (concat (url-encode-url value) "\n"))
+                (when (vectorp value)
+                  (with-temp-buffer
+                    (cl-loop for tem across value
+                             do (progn
+                                  (insert (url-encode-url tem))
+                                  (insert "\n")))
+                    (xselect--encode-string 'TEXT (buffer-string)))))))
+         (cons 'text/uri-list (cdr string)))))
 
 (defun xselect-convert-to-xm-file (selection _type value)
   (when (and (stringp value)



  reply	other threads:[~2023-05-03  5:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02  7:25 Re: Copy and paste from Emacs 29 to Thunderbird doesn’t work Pedro Andres Aranda Gutierrez
2023-05-02  8:10 ` Po Lu
2023-05-02 17:22   ` Gregor Zattler
2023-05-02 23:33     ` Po Lu
2023-05-04 18:22       ` Gregor Zattler
2023-05-05  0:16         ` Po Lu
2023-05-05  5:45           ` Gregor Zattler
2023-05-05  6:16             ` Po Lu
2023-05-03  5:11   ` Tobias Bading
2023-05-03  5:20     ` Po Lu
2023-05-03  5:41       ` Tobias Bading
2023-05-03  5:57         ` Po Lu [this message]
2023-05-03  6:05           ` Tobias Bading
2023-05-03  6:54             ` Po Lu
2023-05-03 11:19               ` Eli Zaretskii
2023-05-03 12:00                 ` Po Lu
  -- strict thread matches above, loose matches on Subject: below --
2023-04-30 13:01 Tobias Bading
2023-05-01  0:02 ` Po Lu

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttwuarep.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    --cc=paaguti@gmail.com \
    --cc=tbading@web.de \
    --cc=telegraph@gmx.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.