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: Dieter Deyke
Subject: [bongo-devel] Re: Missing x-get-selection, m3u wish
Date: Mon, 05 Feb 2007 14:11:35 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (windows-nt)

address@hidden (Daniel Jensen) writes:

> 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
> _______________________________________________
> bongo-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/bongo-devel

This patch seems to work nicely: no errors, and the text on the
windows clipboard appears in parenthesis on the text entry line.

Thanks,
-- 
Dieter Deyke

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?





reply via email to

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