bongo-patches
[Top][All Lists]
Advanced

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

[bongo-patches] Fix clipboard code for Microsoft Windows by using `w32-g


From: Daniel Brockman
Subject: [bongo-patches] Fix clipboard code for Microsoft Windows by using `w32-get-clipboard-data' (patch by Daniel Jensen)
Date: Tue, 06 Feb 2007 22:41:07 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.51 (gnu/linux)

Tue Feb  6 22:36:46 CET 2007  Daniel Brockman <address@hidden>

 * Fix clipboard code for Microsoft Windows by using
   `w32-get-clipboard-data' (patch by Daniel Jensen).

diff -rN -u old-bongo/bongo.el new-bongo/bongo.el
--- old-bongo/bongo.el  2007-02-06 22:41:03.000000000 +0100
+++ new-bongo/bongo.el  2007-02-06 22:41:03.000000000 +0100
@@ -6392,18 +6392,25 @@
       (bongo-maybe-join-inserted-tracks beginning (point))))
   (message "Inserting directory tree...done"))
 
+(defun bongo-get-x-selection (&optional type)
+  "Return the value of the X Windows selection TYPE, if it exists.
+If no value exists for the given selection type, return nil.
+TYPE defaults to `PRIMARY'.  Use `CLIPBOARD' on Microsoft Windows."
+  (when (and (fboundp 'x-selection-exists-p)
+             (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
-            (and (fboundp 'x-selection-exists-p)
-                 (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
-- 
Daniel Brockman <address@hidden>

reply via email to

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