From: James TD Smith <ahktenzero@mohorovi.cc>
To: emacs-orgmode@gnu.org
Subject: [PATCH 2/9] Fix X clipboard handling in emacs21
Date: Sat, 20 Sep 2008 22:08:51 +0100 [thread overview]
Message-ID: <20080920210851.19759.1786.stgit@nyarlathotep.internal.mohorovi.cc> (raw)
In-Reply-To: <20080920210101.19759.15959.stgit@nyarlathotep.internal.mohorovi.cc>
Add a new function to org-compat to fetch clipboard values in emacs21 and
xemacs.
Use this function to fetch the clipboard when x-selection-value is unavailable.
---
lisp/ChangeLog | 9 +++++++++
lisp/org-compat.el | 13 ++++++++++++-
lisp/org-remember.el | 12 ++++++------
lisp/org.el | 2 +-
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5eb535f..bcefdab 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,14 @@
2008-09-20 James TD Smith <ahktenzero@mohorovi.cc>
+ * org-compat.el (org-get-x-clipboard-compat): Add a compat
+ function for fetching the X clipboard on XEmacs and GNU Emacs 21.
+
+ * org-remember.el (org-get-x-clipboard): Use the compat
+ function to get clipboard values when x-selection-value is
+ unavailable. Use substring-no-properties instead of
+ set-text-properties to remove text properties from the clipboard
+ value.
+
* lisp/org-clock.el (org-update-mode-line): Support limiting the
modeline clock string, and display the full todo value in the
tooltip. Set a local keymap so mouse-3 on the clock string goes to
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 1f38b52..24693c8 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -245,7 +245,18 @@ that can be added."
(set-extent-property (car ext-inv-spec) 'invisible
(cadr ext-inv-spec))))
(move-to-column column force)))
-
+
+(defun org-get-x-clipboard-compat (value)
+ "Get the clipboard value on XEmacs or Emacs 21"
+ (cond (org-xemacs-p (org-no-warnings (get-selection-no-error value)))
+ ((fboundp 'x-get-selection)
+ (condition-case nil
+ (or (x-get-selection value 'UTF8_STRING)
+ (x-get-selection value 'COMPOUND_TEXT)
+ (x-get-selection value 'STRING)
+ (x-get-selection value 'TEXT))
+ (error nil)))))
+
(provide 'org-compat)
;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index e056123..c1828e6 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -301,13 +301,13 @@ RET at beg-of-buf -> Append to file as level 2 headline
(cddr (assoc char templates)))))
(defun org-get-x-clipboard (value)
- "Get the value of the x clibboard, in a way that also works with XEmacs."
+ "Get the value of the x clibboard, in a way that works on XEmacs, and GNU
+Emacs 21"
(if (eq window-system 'x)
- (let ((x (if org-xemacs-p
- (org-no-warnings (get-selection-no-error value))
- (and (fboundp 'x-selection-value)
- (x-selection-value value)))))
- (and (> (length x) 0) (set-text-properties 0 (length x) nil x) x))))
+ (let ((x ;;(if (fboundp 'x-selection-value)
+ ;; (x-selection-value value)
+ (org-get-x-clipboard-compat value)));)
+ (if x (substring-no-properties x)))))
;;;###autoload
(defun org-remember-apply-template (&optional use-char skip-interactive)
diff --git a/lisp/org.el b/lisp/org.el
index 297a410..cdbe7bb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7016,7 +7016,7 @@ If `org-make-link-description-function' is non-nil, this function will be
called with the link target, and the result will be the default
link description.
-If the LINK-LOCATION parameter is non-nil, this value will be
+If the `LINK-LOCATION' parameter is non-nil, this value will be
used as the link location instead of reading one interactively."
(interactive "P")
(let* ((wcf (current-window-configuration))
next prev parent reply other threads:[~2008-09-20 21:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
2008-09-20 21:08 ` [PATCH 1/9] Some improvements to the modeline clock display James TD Smith
2008-09-20 21:08 ` James TD Smith [this message]
2008-09-20 21:08 ` [PATCH 3/9] Show durations of clocked times in timeline James TD Smith
2008-09-20 21:09 ` [PATCH 4/9] Fix link display in imenus and the refile interface James TD Smith
2008-09-21 6:25 ` Carsten Dominik
2008-09-21 14:31 ` [PATCH] " James TD Smith
2008-09-21 19:40 ` Carsten Dominik
2008-09-20 21:09 ` [PATCH 5/9] Fix note insertion in entries with drawers James TD Smith
2008-10-16 4:50 ` Carsten Dominik
2008-09-20 21:09 ` [PATCH 6/9] Add some functions for handling checklists James TD Smith
2008-09-20 21:09 ` [PATCH 7/9] Add some new interaction between remember and clocked tasks James TD Smith
2008-09-20 21:09 ` [PATCH 8/9] Add a % expansion for inserting properties in remember buffers James TD Smith
2008-09-20 21:09 ` [PATCH 9/9] Some bugfixes for org-plot James TD Smith
2008-09-21 4:48 ` [PATCH 0/9] Update my last patchset Carsten Dominik
2008-09-21 12:21 ` James TD Smith
2008-09-21 12:43 ` Carsten Dominik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080920210851.19759.1786.stgit@nyarlathotep.internal.mohorovi.cc \
--to=ahktenzero@mohorovi.cc \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).