From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Vorobiev Subject: [PATCH] org-compat: Support for getting data from Windows clipboard Date: Sat, 16 Nov 2013 18:42:48 -0600 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b6da2f614cf9e04eb54b778 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhqSH-00015B-Fe for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 19:43:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VhqSD-0002Yw-6t for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 19:43:13 -0500 Received: from mail-qa0-x235.google.com ([2607:f8b0:400d:c00::235]:44378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhqSD-0002Yk-2k for emacs-orgmode@gnu.org; Sat, 16 Nov 2013 19:43:09 -0500 Received: by mail-qa0-f53.google.com with SMTP id k4so1430591qaq.19 for ; Sat, 16 Nov 2013 16:43:08 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode --047d7b6da2f614cf9e04eb54b778 Content-Type: text/plain; charset=ISO-8859-1 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." -- --047d7b6da2f614cf9e04eb54b778 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I noticed that %x capture template doesn't work u= nder Windows which made my templates non-portable, so I made this small cha= nge 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
t= o get the clipboard data under Windows.

TINYCHANGE=
---
=A0lisp/org-compat.el | 10 ++++++----
=A01 fil= e changed, 6 insertions(+), 4 deletions(-)

diff --= git a/lisp/org-compat.el b/lisp/org-compat.el
index b714f13..a3eb= 960 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
= @@ -190,10 +190,12 @@ If DELETE is non-nil, delete all those overlays."= ;
=A0 =A0 =A0found))
=A0
=A0(defun org-get-x-= clipboard (value)
- =A0"Get the value of the x clipboard, compatible with XEmacs, a= nd GNU Emacs 21."
- =A0(if (eq window-system 'x)
- =A0 =A0 =A0(let ((x (org-get-x-clipboard-compat value)))
- (if x (org-no-properties x= )))))
+ =A0"Get the value of the x or Windows clipboard, compatible wit= h XEmacs, and GNU Emacs 21."
+ =A0(cond ((eq window-system &= #39;x)
+ (let = ((x (org-get-x-clipboard-compat value)))
+ =A0 (if x (org-no= -properties x))))
+ ((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data= ))
+ (w32-get-clipboar= d-data))))
=A0
=A0(defsubst org-decompose-region (beg e= nd)
=A0 =A0"Decompose from BEG to END."
--=A0=
--047d7b6da2f614cf9e04eb54b778--