bongo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bongo-devel] Re: Missing x-get-selection, m3u wish


From: Daniel Jensen
Subject: [bongo-devel] Re: Missing x-get-selection, m3u wish
Date: Mon, 05 Feb 2007 21:29:33 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.92 (gnu/linux)

Thank you for testing this. I don't have access to a Windows machine,
so I'm pretty much writing code in the dark here. I have a new patch
for you to try out. Please see if this will finally give Bongo access
to the Windows clipboard.

I'm also wondering how this plays with the kill ring. I haven't
noticed anything strange with Emacs on GNU/Linux.

diff -Naur bongo-old/bongo.el bongo-new/bongo.el
--- bongo-old/bongo.el  2007-02-05 19:27:53.000000000 +0100
+++ bongo-new/bongo.el  2007-02-05 21:22:48.000000000 +0100
@@ -6405,17 +6405,23 @@
       (bongo-maybe-join-inserted-tracks beginning (point))))
   (message "Inserting directory tree...done"))
 
+(defun bongo-get-x-selection (&optional type)
+  "Return X selection for TYPE when it exists, nil otherwise.
+Default selection type is `PRIMARY'.  Use `CLIPBOARD' for MS Windows."
+  (when (x-selection-exists-p type)
+    (if (eq window-system 'w32)
+        (w32-get-clipboard-data)
+      (x-get-selection type))))
+
 (defun bongo-insert-uri (uri &optional title)
   "Insert a new track line corresponding to URI.
 Optional argument TITLE specifies a custom title for the URI."
   (interactive
    (let* ((default-uri
-            (or (and (x-selection-exists-p)
-                     (let ((primary (x-get-selection)))
-                       (and (bongo-uri-p primary) primary)))
-                (and (x-selection-exists-p 'CLIPBOARD)
-                     (let ((clipboard (x-get-selection 'CLIPBOARD)))
-                       (and (bongo-uri-p clipboard) clipboard)))))
+            (or (let ((primary (bongo-get-x-selection)))
+                  (and (bongo-uri-p primary) primary))
+                (let ((clipboard (bongo-get-x-selection 'CLIPBOARD)))
+                  (and (bongo-uri-p clipboard) clipboard))))
           (uri
            (read-string (concat "Insert URI"
                                 (when default-uri

reply via email to

[Prev in Thread] Current Thread [Next in Thread]