From c9bf924246329dd841485d6eff5d407ea4469659 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 21 Sep 2008 07:35:39 +0200 Subject: [PATCH] Get x-clipboard in a way that is compatible with Emacs 21. --- ORGWEBPAGE/Changes.org | 5 +++++ lisp/ChangeLog | 25 ++++++++++++++++++++++++- lisp/org-compat.el | 16 ++++++++++++++++ lisp/org-remember.el | 9 +++------ 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/ORGWEBPAGE/Changes.org b/ORGWEBPAGE/Changes.org index d75840bfd..55be5a834 100644 --- a/ORGWEBPAGE/Changes.org +++ b/ORGWEBPAGE/Changes.org @@ -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 diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ced9633e4..c6862eaaf 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,26 @@ +2008-09-20 James TD Smith + + * 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 + + * org-compat.el (org-propertize): New function. + 2008-09-20 Bastien Guerry * 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 +2008-07-20 Juri Linkov * org.el (narrow-map): Bind `org-narrow-to-subtree' to "s" on the new keymap `narrow-map' instead of binding "\C-xns". diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 1f38b5254..c1dac90c3 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -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) diff --git a/lisp/org-remember.el b/lisp/org-remember.el index e0561239b..6d82dc34b 100644 --- a/lisp/org-remember.el +++ b/lisp/org-remember.el @@ -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)