Get x-clipboard in a way that is compatible with Emacs 21.

This commit is contained in:
Carsten Dominik 2008-09-21 07:35:39 +02:00
parent e6630ed359
commit c9bf924246
4 changed files with 48 additions and 7 deletions

View File

@ -10,6 +10,11 @@
#+LINK_UP: index.html
#+LINK_HOME: http://orgmode.org
* Version 6.08 (in preparation)
*** Clicking with mouse-2 on clock info in mode-line visits the clock.
Thanks to James TD Smith for a patch to this effect.
* Version 6.07
:PROPERTIES:
:VISIBILITY: content

View File

@ -1,3 +1,26 @@
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
the currently clocked task.
(org-clock-string-limit): Add a custom value for the maximum
length of the clock string in the modeline.
(org-clock-mode-map): Add a keymap for the modeline string
2008-09-21 Carsten Dominik <dominik@science.uva.nl>
* org-compat.el (org-propertize): New function.
2008-09-20 Bastien Guerry <bzg@altern.org>
* org-export-latex.el (org-export-latex-tables): protect exported
@ -250,7 +273,7 @@
* org-agenda.el (org-batch-store-agenda-views): Fix parsing bug.
2008-07-20 Juri Linkov <juri@jurta.org>
2008-07-20 Juri Linkov <juri@jurta.org>
* org.el (narrow-map): Bind `org-narrow-to-subtree' to "s" on the
new keymap `narrow-map' instead of binding "\C-xns".

View File

@ -245,6 +245,22 @@ 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)))))
(defun org-propertize (string &rest properties)
(if (featurep 'xemacs)
(add-text-properties 0 (length string) properties string)
(apply 'propertize string properties)))
(provide 'org-compat)

View File

@ -301,13 +301,10 @@ 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, compatible with 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 (org-get-x-clipboard-compat value)))
(if x (org-no-properties x)))))
;;;###autoload
(defun org-remember-apply-template (&optional use-char skip-interactive)