]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-compat.el
Simplify use of current-time and friends.
[gnu-emacs] / lisp / org / org-compat.el
index 90380a8806ca6fa1c963eeb82d36b6c53df381c1..122658970f5d3c605a3406cfb4a895d40cd18487 100644 (file)
@@ -295,7 +295,7 @@ Works on both Emacs and XEmacs."
       (setq mark-active t)
       (when (and (boundp 'transient-mark-mode)
                 (not transient-mark-mode))
-       (setq transient-mark-mode 'lambda))
+       (set (make-local-variable 'transient-mark-mode) 'lambda))
       (when (boundp 'zmacs-regions)
        (setq zmacs-regions t)))))
 
@@ -411,12 +411,10 @@ Pass BUFFER to the XEmacs version of `move-to-column'."
         (when focus-follows-mouse
           (set-mouse-position frame (1- (frame-width frame)) 0)))))
 
-(defun org-float-time (&optional time)
+(defalias 'org-float-time
+  (if (featurep 'xemacs) 'time-to-seconds 'float-time)
   "Convert time value TIME to a floating point number.
-TIME defaults to the current time."
-  (if (featurep 'xemacs)
-      (time-to-seconds (or time (current-time)))
-    (float-time time)))
+TIME defaults to the current time.")
 
 ;; `user-error' is only available from 24.2.50 on
 (unless (fboundp 'user-error)
@@ -478,6 +476,11 @@ LIMIT."
              (looking-at (concat "\\(?:"  regexp "\\)\\'")))))
       (not (null pos)))))
 
+(defalias 'org-font-lock-ensure
+  (if (fboundp 'org-font-lock-ensure)
+      #'font-lock-ensure
+    (lambda (_beg _end) (font-lock-fontify-buffer))))
+
 (defun org-floor* (x &optional y)
   "Return a list of the floor of X and the fractional part of X.
 With two arguments, return floor and remainder of their quotient."