[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 8d5aa8df4ad: Fix inserting selection data into Mozilla programs
From: |
Po Lu |
Subject: |
emacs-29 8d5aa8df4ad: Fix inserting selection data into Mozilla programs |
Date: |
Wed, 3 May 2023 08:02:22 -0400 (EDT) |
branch: emacs-29
commit 8d5aa8df4ad268c253712efe9ca3b3b158d19433
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix inserting selection data into Mozilla programs
* lisp/select.el (xselect-convert-to-text-uri-list): Don't
return any value when converting non-DND selections to this
drag-and-drop target.
Reported by Tobias Bading <tbading@web.de>.
---
lisp/select.el | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
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 @@ This function returns the string \"emacs\"."
(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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 8d5aa8df4ad: Fix inserting selection data into Mozilla programs,
Po Lu <=