summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-03-14 12:53:52 (GMT)
committer Bastien Guerry <bzg@altern.org>2013-03-14 12:53:52 (GMT)
commite0e699ab3dd208baf2ebc700c5b2c037de20f4d7 (patch)
treeca0a174591b0942849c86bb3225272672b447bc6
parent8481088c4a854474d2e7c4bb7480d432c1781e52 (diff)
downloadorg-mode-e0e699ab3dd208baf2ebc700c5b2c037de20f4d7.zip
org-mode-e0e699ab3dd208baf2ebc700c5b2c037de20f4d7.tar.gz
org-compat.el: New compatibility function `org-defvaralias'
* org-compat.el (org-defvaralias): Newcompatibility function. * org.el: * org-agenda.el: * org-list.el: * org-gnus.el: * org-clock.el: Use it.
-rw-r--r--lisp/org-agenda.el21
-rw-r--r--lisp/org-clock.el2
-rw-r--r--lisp/org-compat.el10
-rw-r--r--lisp/org-gnus.el3
-rw-r--r--lisp/org-list.el9
-rw-r--r--lisp/org.el36
6 files changed, 38 insertions, 43 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 6a2bfc5..1755a0c 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -259,9 +259,8 @@ you can \"misuse\" it to also add other text to the header."
;; Keep custom values for `org-agenda-filter-preset' compatible with
;; the new variable `org-agenda-tag-filter-preset'.
-(if (fboundp 'defvaralias)
- (defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset)
- (defvaralias 'org-agenda-filter 'org-agenda-tag-filter))
+(org-defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset)
+(org-defvaralias 'org-agenda-filter 'org-agenda-tag-filter)
(defconst org-agenda-custom-commands-local-options
`(repeat :tag "Local settings for this command. Remember to quote values"
@@ -1356,9 +1355,8 @@ boolean search."
:version "24.1"
:type 'boolean)
-(if (fboundp 'defvaralias)
- (defvaralias 'org-agenda-search-view-search-words-only
- 'org-agenda-search-view-always-boolean))
+(org-defvaralias 'org-agenda-search-view-search-words-only
+ 'org-agenda-search-view-always-boolean)
(defcustom org-agenda-search-view-force-full-words nil
"Non-nil means, search words must be matches as complete words.
@@ -1803,9 +1801,8 @@ When this is the symbol `prefix', only remove tags when
(const :tag "Never" nil)
(const :tag "When prefix format contains %T" prefix)))
-(if (fboundp 'defvaralias)
- (defvaralias 'org-agenda-remove-tags-when-in-prefix
- 'org-agenda-remove-tags))
+(org-defvaralias 'org-agenda-remove-tags-when-in-prefix
+ 'org-agenda-remove-tags)
(defcustom org-agenda-tags-column (if (featurep 'xemacs) -79 -80)
"Shift tags in agenda items to this column.
@@ -1815,8 +1812,7 @@ it means that the tags should be flushright to that column. For example,
:group 'org-agenda-line-format
:type 'integer)
-(if (fboundp 'defvaralias)
- (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column))
+(org-defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)
(defcustom org-agenda-fontify-priorities 'cookies
"Non-nil means highlight low and high priorities in agenda.
@@ -1974,8 +1970,7 @@ works you probably want to add it to `org-agenda-custom-commands' for good."
(defvar org-agenda-mode-map (make-sparse-keymap)
"Keymap for `org-agenda-mode'.")
-(if (fboundp 'defvaralias)
- (defvaralias 'org-agenda-keymap 'org-agenda-mode-map))
+(org-defvaralias 'org-agenda-keymap 'org-agenda-mode-map)
(defvar org-agenda-menu) ; defined later in this file.
(defvar org-agenda-restrict nil) ; defined later in this file.
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index f5b1079..912f0f3 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -244,7 +244,7 @@ auto Automatically, either `all', or `repeat' for repeating tasks"
(const :tag "All task time" all)
(const :tag "Automatically, `all' or since `repeat'" auto)))
-(defvaralias 'org-task-overrun-text 'org-clock-task-overrun-text)
+(org-defvaralias 'org-task-overrun-text 'org-clock-task-overrun-text)
(defcustom org-clock-task-overrun-text nil
"Extra mode line text to indicate that the clock is overrun.
The can be nil to indicate that instead of adding text, the clock time
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 19992ab..88177c2 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -113,10 +113,18 @@ any other entries, and any resulting duplicates will be removed entirely."
;;;; Emacs/XEmacs compatibility
+(defun org-defvaralias (new-alias base-variable &optional docstring)
+ "Compatibility function for defvaralias.
+Don't do the aliasing when `defvaralias' is not bound."
+ (declare ((indent 1)))
+ (when (fboundp 'defvaralias)
+ (defvaralias new-alias base-variable docstring)))
+(put 'org-defvaralias 'lisp-indent-function 1)
+
(eval-and-compile
(when (and (not (boundp 'user-emacs-directory))
(boundp 'user-init-directory))
- (defvaralias 'user-emacs-directory 'user-init-directory)))
+ (org-defvaralias 'user-emacs-directory 'user-init-directory)))
;; Keys
(defconst org-xemacs-key-equivalents
diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index 6ddfafd..e368a14 100644
--- a/lisp/org-gnus.el
+++ b/lisp/org-gnus.el
@@ -43,8 +43,7 @@
(declare-function gnus-summary-last-subject "gnus-sum" nil)
;; Customization variables
-(when (fboundp 'defvaralias)
- (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links))
+(org-defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links)
(defcustom org-gnus-prefer-web-links nil
"If non-nil, `org-store-link' creates web links to Google groups or Gmane.
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 246bdc7..04ba709 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -217,8 +217,7 @@ Valid values are ?. and ?\). To get both terminators, use t."
(const :tag "paren like in \"2)\"" ?\))
(const :tag "both" t)))
-(defvaralias 'org-alphabetical-lists
- 'org-list-allow-alphabetical) ;; Since 8.0
+(org-defvaralias 'org-alphabetical-lists 'org-list-allow-alphabetical) ;; Since 8.0
(defcustom org-list-allow-alphabetical nil
"Non-nil means single character alphabetical bullets are allowed.
Both uppercase and lowercase are handled. Lists with more than
@@ -240,7 +239,7 @@ spaces instead of one after the bullet in each item of the list."
(const :tag "never" nil)
(regexp)))
-(defvaralias 'org-empty-line-terminates-plain-lists
+(org-defvaralias 'org-empty-line-terminates-plain-lists
'org-list-empty-line-terminates-plain-lists) ;; Since 8.0
(defcustom org-list-empty-line-terminates-plain-lists nil
"Non-nil means an empty line ends all plain list levels.
@@ -294,7 +293,7 @@ This hook runs even if checkbox rule in
implement alternative ways of collecting statistics
information.")
-(defvaralias 'org-hierarchical-checkbox-statistics
+(org-defvaralias 'org-hierarchical-checkbox-statistics
'org-checkbox-hierarchical-statistics) ;; Since 8.0
(defcustom org-checkbox-hierarchical-statistics t
"Non-nil means checkbox statistics counts only the state of direct children.
@@ -304,7 +303,7 @@ with the word \"recursive\" in the value."
:group 'org-plain-lists
:type 'boolean)
-(defvaralias 'org-description-max-indent
+(org-defvaralias 'org-description-max-indent
'org-list-description-max-indent) ;; Since 8.0
(defcustom org-list-description-max-indent 20
"Maximum indentation for the second line of a description list.
diff --git a/lisp/org.el b/lisp/org.el
index 2e52f87..66c79f5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -103,15 +103,14 @@ sure that we are at the beginning of the line.")
Stars are put in group 1 and the trimmed body in group 2.")
;; Emacs 22 calendar compatibility: Make sure the new variables are available
-(when (fboundp 'defvaralias)
- (unless (boundp 'calendar-view-holidays-initially-flag)
- (defvaralias 'calendar-view-holidays-initially-flag
- 'view-calendar-holidays-initially))
- (unless (boundp 'calendar-view-diary-initially-flag)
- (defvaralias 'calendar-view-diary-initially-flag
- 'view-diary-entries-initially))
- (unless (boundp 'diary-fancy-buffer)
- (defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)))
+(unless (boundp 'calendar-view-holidays-initially-flag)
+ (org-defvaralias 'calendar-view-holidays-initially-flag
+ 'view-calendar-holidays-initially))
+(unless (boundp 'calendar-view-diary-initially-flag)
+ (org-defvaralias 'calendar-view-diary-initially-flag
+ 'view-diary-entries-initially))
+(unless (boundp 'diary-fancy-buffer)
+ (org-defvaralias 'diary-fancy-buffer 'fancy-diary-buffer))
(declare-function org-inlinetask-at-task-p "org-inlinetask" ())
(declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
@@ -731,8 +730,7 @@ it work for ESC."
:group 'org-startup
:type 'boolean)
-(if (fboundp 'defvaralias)
- (defvaralias 'org-CUA-compatible 'org-replace-disputed-keys))
+(org-defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
(defcustom org-disputed-keys
'(([(shift up)] . [(meta p)])
@@ -1213,8 +1211,7 @@ This may also be a cons cell where the behavior for `C-a' and
(const :tag "off" nil)
(const :tag "on: before tags first" t)
(const :tag "reversed: after tags first" reversed)))))
-(if (fboundp 'defvaralias)
- (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e))
+(org-defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
(defcustom org-special-ctrl-k nil
"Non-nil means `C-k' will behave specially in headlines.
@@ -2639,8 +2636,7 @@ a subtree."
(const :tag "LOGBOOK" t)
(string :tag "Other")))
-(if (fboundp 'defvaralias)
- (defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer))
+(org-defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)
(defun org-log-into-drawer ()
"Return the value of `org-log-into-drawer', but let properties overrule.
@@ -3088,9 +3084,8 @@ minibuffer will also be active, and you can simply enter the date as well.
When nil, only the minibuffer will be available."
:group 'org-time
:type 'boolean)
-(if (fboundp 'defvaralias)
- (defvaralias 'org-popup-calendar-for-date-prompt
- 'org-read-date-popup-calendar))
+(org-defvaralias 'org-popup-calendar-for-date-prompt
+ 'org-read-date-popup-calendar)
(make-obsolete-variable
'org-read-date-minibuffer-setup-hook
@@ -3559,9 +3554,8 @@ scope."
(const :tag "Agenda Archives" agenda-archives)
(repeat :inline t (file))))
-(if (fboundp 'defvaralias)
- (defvaralias 'org-agenda-multi-occur-extra-files
- 'org-agenda-text-search-extra-files))
+(org-defvaralias 'org-agenda-multi-occur-extra-files
+ 'org-agenda-text-search-extra-files)
(defcustom org-agenda-skip-unavailable-files nil
"Non-nil means to just skip non-reachable files in `org-agenda-files'.