;;; org-compat.el --- Compatibility code for Org-mode
-;; Copyright (C) 2004-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2014 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
next (+ from (* n inc)))))
(nreverse seq)))))
+;; `set-transient-map' is only in Emacs >= 24.4
+(defalias 'org-set-transient-map
+ (if (fboundp 'set-transient-map)
+ 'set-transient-map
+ 'set-temporary-overlay-map))
+
;; Region compatibility
(defvar org-ignore-region nil
(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)))))
(org-xemacs-without-invisibility (indent-line-to column))
(indent-line-to column)))
-(defun org-move-to-column (column &optional force buffer ignore-invisible)
- (let ((buffer-invisibility-spec ignore-invisible))
+(defun org-move-to-column (column &optional force buffer)
+ "Move to column COLUMN.
+Pass COLUMN and FORCE to `move-to-column'.
+Pass BUFFER to the XEmacs version of `move-to-column'."
+ (let* ((with-bracket-link
+ (save-excursion
+ (forward-line 0)
+ (looking-at (concat "^.*" org-bracket-link-regexp))))
+ (buffer-invisibility-spec
+ (cond
+ ((or (not (derived-mode-p 'org-mode))
+ (and with-bracket-link (org-invisible-p2)))
+ (remove '(org-link) buffer-invisibility-spec))
+ (with-bracket-link
+ (remove t buffer-invisibility-spec))
+ (t buffer-invisibility-spec))))
(if (featurep 'xemacs)
- (org-xemacs-without-invisibility (move-to-column column force buffer))
+ (org-xemacs-without-invisibility
+ (move-to-column column force buffer))
(move-to-column column force))))
(defun org-get-x-clipboard-compat (value)
(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."