Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
Thanks, I will try and see if it can be improved. Regards, Alex On Fri, Nov 22, 2013 at 3:54 AM, Bastien b...@gnu.org wrote: Hi Alexander, Alexander Vorobiev alexander.vorob...@gmail.com writes: The patch doesn't work unfortunately. I stepped through x-get-selection-value in w32-common-fns.el and the correct value from the clipboard gets assigned to x-last-selected-text but then the function just returns nil (line 120). I would say x-last-selected text needs to be used somehow. Okay. I applied your previous patch. Let's keep this under the radar and see if there is a way to improve clipboard handling for Windows. Thanks! -- Bastien
Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
Hi Alexander, Alexander Vorobiev alexander.vorob...@gmail.com writes: The patch doesn't work unfortunately. I stepped through x-get-selection-value in w32-common-fns.el and the correct value from the clipboard gets assigned to x-last-selected-text but then the function just returns nil (line 120). I would say x-last-selected text needs to be used somehow. Okay. I applied your previous patch. Let's keep this under the radar and see if there is a way to improve clipboard handling for Windows. Thanks! -- Bastien
Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
Hi Bastien, The patch doesn't work unfortunately. I stepped through x-get-selection-value in w32-common-fns.el and the correct value from the clipboard gets assigned to x-last-selected-text but then the function just returns nil (line 120). I would say x-last-selected text needs to be used somehow. Thanks, Alex On Tue, Nov 19, 2013 at 3:40 AM, Bastien b...@gnu.org wrote: Hi Alexander, can you test the attached patch and let me know if it works for you? Thanks, -- Bastien
Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
Hi Alexander, can you test the attached patch and let me know if it works for you? Thanks, diff --git a/lisp/org-compat.el b/lisp/org-compat.el index b714f13..2eea724 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -350,7 +350,8 @@ Works on both Emacs and XEmacs. (or (x-get-selection value 'UTF8_STRING) (x-get-selection value 'COMPOUND_TEXT) (x-get-selection value 'STRING) - (x-get-selection value 'TEXT)) + (x-get-selection value 'TEXT) + (x-get-selection-value)) (error nil) (defun org-propertize (string rest properties) -- Bastien
Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
Hi Alexander, Alexander Vorobiev alexander.vorob...@gmail.com writes: Sorry for the mis-formatting. Here is the patch as an attachment. Thanks -- digging into this again, maybe we need to fix `org-get-x-clipboard-compat' directly? I'm not using Windows so I can't test the patch. Can a Windows user help here? -- Bastien
Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
Yes, you could lift the patch up to `org-get-x-clipboard-compat', but this way, òrg-no-properties' would be applied to the w32 data too. Is that relevant? I don't know if w32 clipboard data can have text properties. Fabrice 2013/11/18 Bastien b...@gnu.org Hi Alexander, Alexander Vorobiev alexander.vorob...@gmail.com writes: Sorry for the mis-formatting. Here is the patch as an attachment. Thanks -- digging into this again, maybe we need to fix `org-get-x-clipboard-compat' directly? I'm not using Windows so I can't test the patch. Can a Windows user help here? -- Bastien -- Fabrice Popineau - SUPELEC Département Informatique 3, rue Joliot Curie 91192 Gif/Yvette Cedex Tel direct : +33 (0) 169851950 Standard : +33 (0) 169851212 --
Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
I too was thinking of making the change to org-get-x-clipboard-compat instead, but somehow decided not to. It calls x-get-selection and the latter, while it does have w32-specific flavor (in w32-common-fns.el), doesn't seem to support clipboard and its primary purpose is stated as Fix interface to (X-specific) mouse.el. As far as org-no-properties goes, I don't think it will make any difference on Windows because it looks like only plain text is supported (see e.g. http://www.mail-archive.com/help-emacs-windows@gnu.org/msg03026.html and the code in http://git.savannah.gnu.org/cgit/emacs.git/tree/src/w32select.c) anyway. So it is hard to say where the patch clearly belongs (w32-common-fns.el (x-get-selection) perhaps?). I can move it to org-get-x-clipboard-compat of course but some change would still need to be done to org-get-x-clipboard because it checks for (eq window-system 'x) explicitly. Let me know what works better. Thanks Alex On Mon, Nov 18, 2013 at 5:34 AM, Fabrice Popineau fabrice.popin...@supelec.fr wrote: Yes, you could lift the patch up to `org-get-x-clipboard-compat', but this way, òrg-no-properties' would be applied to the w32 data too. Is that relevant? I don't know if w32 clipboard data can have text properties. Fabrice 2013/11/18 Bastien b...@gnu.org Hi Alexander, Alexander Vorobiev alexander.vorob...@gmail.com writes: Sorry for the mis-formatting. Here is the patch as an attachment. Thanks -- digging into this again, maybe we need to fix `org-get-x-clipboard-compat' directly? I'm not using Windows so I can't test the patch. Can a Windows user help here? -- Bastien -- Fabrice Popineau - SUPELEC Département Informatique 3, rue Joliot Curie 91192 Gif/Yvette Cedex Tel direct : +33 (0) 169851950 Standard : +33 (0) 169851212 --
Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
Hi Alexander, Alexander Vorobiev alexander.vorob...@gmail.com writes: I noticed that %x capture template doesn't work under Windows which made my templates non-portable, so I made this small change to org-get-x-clipboard to fix that. This is my very first patch, please let me know if it is acceptable. The patch looks good but it got mangled by the HTML format of the email. Can you resend it as an attachement? Thanks! -- Bastien
Re: [O] [PATCH] org-compat: Support for getting data from Windows clipboard
Hi Bastien, Sorry for the mis-formatting. Here is the patch as an attachment. Thanks, Alex On Sun, Nov 17, 2013 at 2:20 AM, Bastien b...@gnu.org wrote: Hi Alexander, Alexander Vorobiev alexander.vorob...@gmail.com writes: I noticed that %x capture template doesn't work under Windows which made my templates non-portable, so I made this small change to org-get-x-clipboard to fix that. This is my very first patch, please let me know if it is acceptable. The patch looks good but it got mangled by the HTML format of the email. Can you resend it as an attachement? Thanks! -- Bastien 0001-org-compat-Support-for-getting-data-from-Windows-cli.patch Description: Binary data
[O] [PATCH] org-compat: Support for getting data from Windows clipboard
I noticed that %x capture template doesn't work under Windows which made my templates non-portable, so I made this small change to org-get-x-clipboard to fix that. This is my very first patch, please let me know if it is acceptable. Thanks, Alex * lisp/org-compat.el (org-get-x-clipboard): Use w32-get-clipboard-data to get the clipboard data under Windows. TINYCHANGE --- lisp/org-compat.el | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index b714f13..a3eb960 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -190,10 +190,12 @@ If DELETE is non-nil, delete all those overlays. found)) (defun org-get-x-clipboard (value) - Get the value of the x clipboard, compatible with XEmacs, and GNU Emacs 21. - (if (eq window-system 'x) - (let ((x (org-get-x-clipboard-compat value))) - (if x (org-no-properties x) + Get the value of the x or Windows clipboard, compatible with XEmacs, and GNU Emacs 21. + (cond ((eq window-system 'x) + (let ((x (org-get-x-clipboard-compat value))) + (if x (org-no-properties x + ((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data)) + (w32-get-clipboard-data (defsubst org-decompose-region (beg end) Decompose from BEG to END. --