From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: Compatibility tests Date: Sun, 06 Jan 2013 18:40:50 +0100 Message-ID: <87obh2ciql.fsf@Rainer.invalid> References: <8738yfqtd1.fsf@Rainer.invalid> <87ehhyyfdf.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TruDs-000094-Aj for emacs-orgmode@gnu.org; Sun, 06 Jan 2013 12:41:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TruDp-0006kR-Sb for emacs-orgmode@gnu.org; Sun, 06 Jan 2013 12:41:24 -0500 Received: from plane.gmane.org ([80.91.229.3]:39987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TruDp-0006kE-G3 for emacs-orgmode@gnu.org; Sun, 06 Jan 2013 12:41:21 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TruDy-0002Q3-QC for emacs-orgmode@gnu.org; Sun, 06 Jan 2013 18:41:30 +0100 Received: from pd9eb4844.dip.t-dialin.net ([217.235.72.68]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Jan 2013 18:41:30 +0100 Received: from Stromeko by pd9eb4844.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Jan 2013 18:41:30 +0100 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@gnu.org --=-=-= Content-Type: text/plain Bastien writes: > As for XEmacs and Emacs 22, I'm fine with anything that > helps supporting these emacsen, unless it adds too much > extra complexity. First three patchs apply against maint: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-Compatibility-Use-org-no-warnings.patch Content-Transfer-Encoding: 8bit >From 4e2f6d7d8f870f834079ce010eb2049d61bb5576 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sun, 6 Jan 2013 18:28:06 +0100 Subject: [PATCH 1/3] Compatibility: Use org-no-warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * contrib/lisp/org-e-odt.el (org-e-odt-htmlfontify-string): Use compatibility alias `org-no-warnings´. --- contrib/lisp/org-e-odt.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/lisp/org-e-odt.el b/contrib/lisp/org-e-odt.el index 346b029..5953cc6 100644 --- a/contrib/lisp/org-e-odt.el +++ b/contrib/lisp/org-e-odt.el @@ -2886,7 +2886,7 @@ (defun org-e-odt-htmlfontify-string (line) (lambda (style text-block text-id text-begins-block-p) (insert (format "" style)))) (hfy-end-span-handler (lambda nil (insert "")))) - (with-no-warnings (htmlfontify-string line)))) + (org-no-warnings (htmlfontify-string line)))) (defun org-e-odt-do-format-code (code &optional lang refs retain-labels num-start) -- 1.8.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-Compatibility-Define-face-alias-mode-line-for-XEmacs.patch >From d524e7d6112cda2b53e3e0822609fa81b2dd6ee9 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sun, 6 Jan 2013 17:48:39 +0100 Subject: [PATCH 2/3] Compatibility: Define face alias mode-line for XEmacs * lisp/org-faces.el: Define face alias mode-line for XEmacs (it's called modeline there). --- lisp/org-faces.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/org-faces.el b/lisp/org-faces.el index 80e8134..606db08 100644 --- a/lisp/org-faces.el +++ b/lisp/org-faces.el @@ -44,6 +44,9 @@ (defun org-copy-face (old-face new-face docstring &rest attributes) (set-face-doc-string new-face docstring))))) (put 'org-copy-face 'lisp-indent-function 2) +(when (featurep 'xemacs) + (put 'mode-line 'face-alias 'modeline)) + (defgroup org-faces nil "Faces in Org-mode." :tag "Org Faces" -- 1.8.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0003-Compatibility-Use-org-define-obsolete-function-varia.patch Content-Transfer-Encoding: 8bit >From 305f29776fba57cdd1566071e0e8a75270d095c6 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sun, 6 Jan 2013 18:29:05 +0100 Subject: [PATCH 3/3] Compatibility: Use org-define-obsolete-{function,variable}-alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org-compat.el (org-define-obsolete-function-alias, org-define-obsolete-variable-alias): Introduce new compatibility macros to obsolete functions and variables. * lisp/org-agenda.el, lisp/org-clock.el, lisp/org-id.el, lisp/org-lparse.el, lisp/org-protocol.el lisp/org.el: Use `org-define-obsolete-{function,variable}-alias´instead of `define-obsolate{function,variable}-alias´. --- lisp/org-agenda.el | 6 +++--- lisp/org-clock.el | 2 +- lisp/org-compat.el | 18 ++++++++++++++++++ lisp/org-id.el | 2 +- lisp/org-lparse.el | 4 ++-- lisp/org-protocol.el | 6 +++--- lisp/org.el | 13 ++++--------- 7 files changed, 32 insertions(+), 19 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 1b2337c..b4c21fc 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -890,7 +890,7 @@ (defcustom org-agenda-menu-show-matcher t :version "24.1" :type 'boolean) -(define-obsolete-variable-alias 'org-agenda-menu-two-column 'org-agenda-menu-two-columns "24.3") +(org-define-obsolete-variable-alias 'org-agenda-menu-two-column 'org-agenda-menu-two-columns "24.3") (defcustom org-agenda-menu-two-columns nil "Non-nil means, use two columns to show custom commands in the dispatcher. @@ -900,7 +900,7 @@ (defcustom org-agenda-menu-two-columns nil :version "24.1" :type 'boolean) -(define-obsolete-variable-alias 'org-finalize-agenda-hook 'org-agenda-finalize-hook "24.3") +(org-define-obsolete-variable-alias 'org-finalize-agenda-hook 'org-agenda-finalize-hook "24.3") (defcustom org-agenda-finalize-hook nil "Hook run just before displaying an agenda buffer. The buffer is still writable when the hook is called. @@ -7681,7 +7681,7 @@ (defun org-agenda-set-mode-name () ""))) (force-mode-line-update)) -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-agenda-post-command-hook 'org-agenda-update-agenda-type "24.3") (defun org-agenda-update-agenda-type () diff --git a/lisp/org-clock.el b/lisp/org-clock.el index a481ac5..e3048e5 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -204,7 +204,7 @@ (defcustom org-clock-sound nil (const :tag "Standard beep" t) (file :tag "Play sound file"))) -(define-obsolete-variable-alias 'org-clock-modeline-total +(org-define-obsolete-variable-alias 'org-clock-modeline-total 'org-clock-mode-line-total "24.3") (defcustom org-clock-mode-line-total 'auto diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 8f21321..8150875 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -169,6 +169,24 @@ (defsubst org-decompose-region (beg end) (set-buffer-modified-p modified-p)) (decompose-region beg end))) +(defmacro org-define-obsolete-function-alias (o-name c-name when &optional doc) + "Reconcile the two-argument form of +`define-obsolete-function-alias' in XEmacs/Emacs 22 with the 3-4 +argument form in Emacs 23 and later." + (if (or (featurep 'xemacs) + (< emacs-major-version 23)) + `(define-obsolete-function-alias ,o-name ,c-name) + `(define-obsolete-function-alias ,o-name ,c-name ,when ,doc))) + +(defmacro org-define-obsolete-variable-alias (o-name c-name when &optional doc) + "Reconcile the two-argument form of +`define-obsolete-variable-alias' in XEmacs/Emacs 22 with the 3-4 +argument form in Emacs 23 and later." + (if (or (featurep 'xemacs) + (< emacs-major-version 23)) + `(define-obsolete-variable-alias ,o-name ,c-name) + `(define-obsolete-variable-alias ,o-name ,c-name ,when ,doc))) + ;; Miscellaneous functions (defun org-add-hook (hook function &optional append local) diff --git a/lisp/org-id.el b/lisp/org-id.el index 6e865b5..5d8e5b0 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -83,7 +83,7 @@ (defgroup org-id nil :tag "Org ID" :group 'org) -(define-obsolete-variable-alias +(org-define-obsolete-variable-alias 'org-link-to-org-use-id 'org-id-link-to-org-use-id "24.3") (defcustom org-id-link-to-org-use-id nil "Non-nil means storing a link to an Org file will use entry IDs. diff --git a/lisp/org-lparse.el b/lisp/org-lparse.el index 1171135..e9fbbea 100644 --- a/lisp/org-lparse.el +++ b/lisp/org-lparse.el @@ -1718,7 +1718,7 @@ (defun org-lparse-end-list-item-1 (&optional type) (org-lparse-end-paragraph) (org-lparse-end-list-item (or type "u"))) -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-lparse-preprocess-after-blockquote-hook 'org-lparse-preprocess-after-blockquote "24.3") @@ -1736,7 +1736,7 @@ (defun org-lparse-preprocess-after-blockquote () (format "ORG-%s-END %s" (upcase (match-string 2)) (match-string 3))) t t)))) -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-lparse-strip-experimental-blocks-maybe-hook 'org-lparse-strip-experimental-blocks-maybe "24.3") diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 9eaf642..0925964 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -128,15 +128,15 @@ (filename &optional up)) (declare-function server-edit "server" (&optional arg)) -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-protocol-unhex-compound 'org-link-unescape-compound "2011-02-17") -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-protocol-unhex-string 'org-link-unescape "2011-02-17") -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-protocol-unhex-single-byte-sequence 'org-link-unescape-single-byte-sequence "2011-02-17") diff --git a/lisp/org.el b/lisp/org.el index 644b760..ea19f97 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7402,12 +7402,7 @@ (defun org-get-valid-level (level &optional change) ((< change 0) (max 1 (1+ (* 2 (/ (+ level (* 2 change)) 2)))))) (max 1 (+ level (or change 0))))) -(if (boundp 'define-obsolete-function-alias) - (if (or (featurep 'xemacs) (< emacs-major-version 23)) - (define-obsolete-function-alias 'org-get-legal-level - 'org-get-valid-level) - (define-obsolete-function-alias 'org-get-legal-level - 'org-get-valid-level "23.1"))) +(org-define-obsolete-function-alias 'org-get-legal-level 'org-get-valid-level "23.1") (defvar org-called-with-limited-levels nil) ;; Dynamically bound in ;; ̀org-with-limited-levels' @@ -17789,7 +17784,7 @@ (defun org-display-inline-images (&optional include-linked refresh beg end) (list 'org-display-inline-remove-overlay)) (push ov org-inline-image-overlays))))))))) -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-display-inline-modification-hook 'org-display-inline-remove-overlay "24.3") (defun org-display-inline-remove-overlay (ov after beg end &optional len) @@ -18169,7 +18164,7 @@ (defvar org-self-insert-command-undo-counter 0) (defvar org-table-auto-blank-field) ; defined in org-table.el (defvar org-speed-command nil) -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-speed-command-default-hook 'org-speed-command-activate "24.3") (defun org-speed-command-activate (keys) @@ -18182,7 +18177,7 @@ (defun org-speed-command-activate (keys) (cdr (assoc keys (append org-speed-commands-user org-speed-commands-default))))) -(define-obsolete-function-alias +(org-define-obsolete-function-alias 'org-babel-speed-command-hook 'org-babel-speed-command-activate "24.3") (defun org-babel-speed-command-activate (keys) -- 1.8.1 --=-=-= Content-Type: text/plain Then merge into master and apply these two on top: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-Compatibility-Use-org-define-obsolete-function-varia.patch Content-Transfer-Encoding: 8bit >From 8fcdb5179bbe172b52dd80101efe247de9fe1ac2 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sun, 6 Jan 2013 18:26:42 +0100 Subject: [PATCH 1/2] Compatibility: Use org-define-obsolete-{function,variable}-alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org.el: Use `org-define-obsolete-{function,variable}-alias´instead of `define-obsolate{function,variable}-alias´. --- lisp/org.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 4ced7e2..28f075a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16142,7 +16142,8 @@ (defun org-fix-decoded-time (time) (let ((n 0)) (mapcar (lambda (x) (if (< (setq n (1+ n)) 7) (or x 0) x)) time))) -(define-obsolete-function-alias 'org-days-to-time 'org-time-stamp-to-now "24.3") +(org-define-obsolete-function-alias + 'org-days-to-time 'org-time-stamp-to-now "24.3") (defun org-time-stamp-to-now (timestamp-string &optional seconds) "Difference between TIMESTAMP-STRING and now in days. -- 1.8.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0002-Compatibility-Use-org-load-noerror-mustsuffix.patch Content-Transfer-Encoding: 8bit >From 5484a33b8d1382958095922bc9bc2bd6f1d9ffc6 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sun, 6 Jan 2013 18:24:56 +0100 Subject: [PATCH 2/2] Compatibility: Use org-load-noerror-mustsuffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org-macs.el: New macro to allow the 5-argument form of load to be used where possible without breaking compatibility with XEmacs. * lisp/org.el (org-version, org-reload): Use `org-load-noerror-mustsuffix´ instead of adding a fifth argument to load directly. Guard against undefined variable load-suffixes, which doesn't exist in XEmacs. Since load-suffixes doesn't exist in XEmacs, (org-reload 'uncompiled) will not work. If it doesn't complicate the compatibility macro too much this can be added later. --- lisp/org-macs.el | 6 ++++++ lisp/org.el | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index a44bdbe..e5d6100 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -426,6 +426,12 @@ (defun org-make-parameter-alist (flat) (cons (list (car flat) (cadr flat)) (org-make-parameter-alist (cddr flat))))) +(defmacro org-load-noerror-mustsuffix (file) + "Load FILE with optional arguments NOERROR and MUSTSUFFIX. Drop the MUSTSUFFIX argument for XEmacs, which doesn't recognize it." + (if (featurep 'xemacs) + `(load ,file 'noerror) + `(load ,file 'noerror nil nil 'mustsuffix))) + (provide 'org-macs) ;;; org-macs.el ends here diff --git a/lisp/org.el b/lisp/org.el index 28f075a..a446d76 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -78,8 +78,11 @@ (defvar org-table-formula-constants-local nil (require 'find-func) (require 'format-spec) +(require 'org-macs) +(require 'org-compat) + (let ((load-suffixes (list ".el"))) - (load "org-loaddefs" 'noerror nil nil 'mustsuffix)) + (org-load-noerror-mustsuffix "org-loaddefs")) ;; `org-outline-regexp' ought to be a defconst but is let-binding in ;; some places -- e.g. see the macro org-with-limited-levels. @@ -238,7 +241,6 @@ (defcustom org-clone-delete-id nil :group 'org-id) ;;; Version -(require 'org-compat) (org-check-version) ;;;###autoload @@ -249,13 +251,12 @@ (defun org-version (&optional here full message) When MESSAGE is non-nil, display a message with the version." (interactive "P") (let* ((org-dir (ignore-errors (org-find-library-dir "org"))) - (save-load-suffixes load-suffixes) + (save-load-suffixes (when (boundp 'load-suffixes) load-suffixes)) (load-suffixes (list ".el")) (org-install-dir (ignore-errors (org-find-library-dir "org-loaddefs"))) (org-trash (or (and (fboundp 'org-release) (fboundp 'org-git-version)) - (load (concat org-dir "org-version") - 'noerror 'nomessage nil 'mustsuffix))) + (org-load-noerror-mustsuffix (concat org-dir "org-version")))) (load-suffixes save-load-suffixes) (org-version (org-release)) (git-version (org-git-version)) @@ -4973,7 +4974,7 @@ (defvar buffer-face-mode-face) (require 'easymenu) (require 'overlay) -(require 'org-macs) +;; (require 'org-macs) moved higher up in the file before it is first used (require 'org-entities) ;; (require 'org-compat) moved higher up in the file before it is first used (require 'org-faces) @@ -20349,15 +20350,16 @@ (defun org-reload (&optional uncompiled) feats))) 'string-lessp) (list "org-version" "org"))) + (load-suffixes (when (boundp 'load-suffixes) load-suffixes)) (load-suffixes (if uncompiled (reverse load-suffixes) load-suffixes)) load-uncore load-misses) (setq load-misses (delq 't (mapcar (lambda (f) - (or (load (concat org-dir f) 'noerror nil nil 'mustsuffix) + (or (org-load-noerror-mustsuffix (concat org-dir f)) (and (string= org-dir contrib-dir) - (load (concat contrib-dir f) 'noerror nil nil 'mustsuffix)) - (and (load (concat (org-find-library-dir f) f) 'noerror nil nil 'mustsuffix) + (org-load-noerror-mustsuffix (concat contrib-dir f))) + (and (org-load-noerror-mustsuffix (concat (org-find-library-dir f) f)) (add-to-list 'load-uncore f 'append) 't) f)) -- 1.8.1 --=-=-= Content-Type: text/plain Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Wavetables for the Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables --=-=-=--