]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-compat.el
Install org-mode version 7.3
[gnu-emacs] / lisp / org / org-compat.el
index 1b96b8d05356df36378de33eb9362a70aae5c2b4..324464803f26ad9b9fb18a3f8e9e16457fab38b5 100644 (file)
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 7.01
+;; Version: 7.3
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -162,6 +162,15 @@ If DELETE is non-nil, delete all those overlays."
       (let ((x (org-get-x-clipboard-compat value)))
        (if x (org-no-properties x)))))
 
+(defsubst org-decompose-region (beg end)
+  "Decompose from BEG to END."
+  (if (featurep 'xemacs)
+      (let ((modified-p (buffer-modified-p))
+           (buffer-read-only nil))
+       (remove-text-properties beg end '(composition nil))
+       (set-buffer-modified-p modified-p))
+    (decompose-region beg end)))
+
 ;; Miscellaneous functions
 
 (defun org-add-hook (hook function &optional append local)
@@ -197,6 +206,26 @@ ignored in this case."
         (shrink-window-if-larger-than-buffer window)))
   (or window (selected-window)))
 
+(defun org-number-sequence (from &optional to inc)
+  "Call `number-sequence or emulate it."
+  (if (fboundp 'number-sequence)
+      (number-sequence from to inc)
+    (if (or (not to) (= from to))
+       (list from)
+      (or inc (setq inc 1))
+      (when (zerop inc) (error "The increment can not be zero"))
+      (let (seq (n 0) (next from))
+       (if (> inc 0)
+           (while (<= next to)
+             (setq seq (cons next seq)
+                   n (1+ n)
+                   next (+ from (* n inc))))
+         (while (>= next to)
+           (setq seq (cons next seq)
+                 n (1+ n)
+                 next (+ from (* n inc)))))
+       (nreverse seq)))))
+
 ;; Region compatibility
 
 (defvar org-ignore-region nil
@@ -353,7 +382,7 @@ TIME defaults to the current time."
   (if (fboundp 'looking-at-p)
       (apply 'looking-at-p args)
     (save-match-data
-      (apply 'looking-at-p args))))
+      (apply 'looking-at args))))
 
 ; XEmacs does not have `looking-back'.
 (if (fboundp 'looking-back)