org-compat.el 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. ;;; org-compat.el --- Compatibility code for Org-mode
  2. ;; Copyright (C) 2004-2014 Free Software Foundation, Inc.
  3. ;; Author: Carsten Dominik <carsten at orgmode dot org>
  4. ;; Keywords: outlines, hypermedia, calendar, wp
  5. ;; Homepage: http://orgmode.org
  6. ;;
  7. ;; This file is part of GNU Emacs.
  8. ;;
  9. ;; GNU Emacs is free software: you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation, either version 3 of the License, or
  12. ;; (at your option) any later version.
  13. ;; GNU Emacs is distributed in the hope that it will be useful,
  14. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;; GNU General Public License for more details.
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  19. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  20. ;;
  21. ;;; Commentary:
  22. ;; This file contains code needed for compatibility with XEmacs and older
  23. ;; versions of GNU Emacs.
  24. ;;; Code:
  25. (eval-when-compile
  26. (require 'cl))
  27. (require 'org-macs)
  28. (declare-function w32-focus-frame "term/w32-win" (frame))
  29. ;; The following constant is for backward compatibility. We do not use
  30. ;; it in org-mode, because the Byte compiler evaluates (featurep 'xemacs)
  31. ;; at compilation time and can therefore optimize code better.
  32. (defconst org-xemacs-p (featurep 'xemacs))
  33. (defconst org-format-transports-properties-p
  34. (let ((x "a"))
  35. (add-text-properties 0 1 '(test t) x)
  36. (get-text-property 0 'test (format "%s" x)))
  37. "Does format transport text properties?")
  38. (defun org-compatible-face (inherits specs)
  39. "Make a compatible face specification.
  40. If INHERITS is an existing face and if the Emacs version supports it,
  41. just inherit the face. If INHERITS is set and the Emacs version does
  42. not support it, copy the face specification from the inheritance face.
  43. If INHERITS is not given and SPECS is, use SPECS to define the face.
  44. XEmacs and Emacs 21 do not know about the `min-colors' attribute.
  45. For them we convert a (min-colors 8) entry to a `tty' entry and move it
  46. to the top of the list. The `min-colors' attribute will be removed from
  47. any other entries, and any resulting duplicates will be removed entirely."
  48. (when (and inherits (facep inherits) (not specs))
  49. (setq specs (or specs
  50. (get inherits 'saved-face)
  51. (get inherits 'face-defface-spec))))
  52. (cond
  53. ((and inherits (facep inherits)
  54. (not (featurep 'xemacs))
  55. (>= emacs-major-version 22)
  56. ;; do not inherit outline faces before Emacs 23
  57. (or (>= emacs-major-version 23)
  58. (not (string-match "\\`outline-[0-9]+"
  59. (symbol-name inherits)))))
  60. (list (list t :inherit inherits)))
  61. ((or (featurep 'xemacs) (< emacs-major-version 22))
  62. ;; These do not understand the `min-colors' attribute.
  63. (let (r e a)
  64. (while (setq e (pop specs))
  65. (cond
  66. ((memq (car e) '(t default)) (push e r))
  67. ((setq a (member '(min-colors 8) (car e)))
  68. (nconc r (list (cons (cons '(type tty) (delq (car a) (car e)))
  69. (cdr e)))))
  70. ((setq a (assq 'min-colors (car e)))
  71. (setq e (cons (delq a (car e)) (cdr e)))
  72. (or (assoc (car e) r) (push e r)))
  73. (t (or (assoc (car e) r) (push e r)))))
  74. (nreverse r)))
  75. (t specs)))
  76. (put 'org-compatible-face 'lisp-indent-function 1)
  77. (defun org-version-check (version feature level)
  78. (let* ((v1 (mapcar 'string-to-number (split-string version "[.]")))
  79. (v2 (mapcar 'string-to-number (split-string emacs-version "[.]")))
  80. (rmaj (or (nth 0 v1) 99))
  81. (rmin (or (nth 1 v1) 99))
  82. (rbld (or (nth 2 v1) 99))
  83. (maj (or (nth 0 v2) 0))
  84. (min (or (nth 1 v2) 0))
  85. (bld (or (nth 2 v2) 0)))
  86. (if (or (< maj rmaj)
  87. (and (= maj rmaj)
  88. (< min rmin))
  89. (and (= maj rmaj)
  90. (= min rmin)
  91. (< bld rbld)))
  92. (if (eq level :predicate)
  93. ;; just return if we have the version
  94. nil
  95. (let ((msg (format "Emacs %s or greater is recommended for %s"
  96. version feature)))
  97. (display-warning 'org msg level)
  98. t))
  99. t)))
  100. ;;;; Emacs/XEmacs compatibility
  101. (eval-and-compile
  102. (defun org-defvaralias (new-alias base-variable &optional docstring)
  103. "Compatibility function for defvaralias.
  104. Don't do the aliasing when `defvaralias' is not bound."
  105. (declare (indent 1))
  106. (when (fboundp 'defvaralias)
  107. (defvaralias new-alias base-variable docstring)))
  108. (when (and (not (boundp 'user-emacs-directory))
  109. (boundp 'user-init-directory))
  110. (org-defvaralias 'user-emacs-directory 'user-init-directory)))
  111. (when (featurep 'xemacs)
  112. (defadvice custom-handle-keyword
  113. (around org-custom-handle-keyword
  114. activate preactivate)
  115. "Remove custom keywords not recognized to avoid producing an error."
  116. (cond
  117. ((eq (ad-get-arg 1) :package-version))
  118. (t ad-do-it)))
  119. (defadvice define-obsolete-variable-alias
  120. (around org-define-obsolete-variable-alias
  121. (obsolete-name current-name &optional when docstring)
  122. activate preactivate)
  123. "Declare arguments defined in later versions of Emacs."
  124. ad-do-it)
  125. (defadvice define-obsolete-function-alias
  126. (around org-define-obsolete-function-alias
  127. (obsolete-name current-name &optional when docstring)
  128. activate preactivate)
  129. "Declare arguments defined in later versions of Emacs."
  130. ad-do-it)
  131. (defvar customize-package-emacs-version-alist nil)
  132. (defvar temporary-file-directory (temp-directory)))
  133. ;; Keys
  134. (defconst org-xemacs-key-equivalents
  135. '(([mouse-1] . [button1])
  136. ([mouse-2] . [button2])
  137. ([mouse-3] . [button3])
  138. ([C-mouse-4] . [(control mouse-4)])
  139. ([C-mouse-5] . [(control mouse-5)]))
  140. "Translation alist for a couple of keys.")
  141. ;; Overlay compatibility functions
  142. (defun org-detach-overlay (ovl)
  143. (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl)))
  144. (defun org-overlay-display (ovl text &optional face evap)
  145. "Make overlay OVL display TEXT with face FACE."
  146. (if (featurep 'xemacs)
  147. (let ((gl (make-glyph text)))
  148. (and face (set-glyph-face gl face))
  149. (set-extent-property ovl 'invisible t)
  150. (set-extent-property ovl 'end-glyph gl))
  151. (overlay-put ovl 'display text)
  152. (if face (overlay-put ovl 'face face))
  153. (if evap (overlay-put ovl 'evaporate t))))
  154. (defun org-overlay-before-string (ovl text &optional face evap)
  155. "Make overlay OVL display TEXT with face FACE."
  156. (if (featurep 'xemacs)
  157. (let ((gl (make-glyph text)))
  158. (and face (set-glyph-face gl face))
  159. (set-extent-property ovl 'begin-glyph gl))
  160. (if face (org-add-props text nil 'face face))
  161. (overlay-put ovl 'before-string text)
  162. (if evap (overlay-put ovl 'evaporate t))))
  163. (defun org-find-overlays (prop &optional pos delete)
  164. "Find all overlays specifying PROP at POS or point.
  165. If DELETE is non-nil, delete all those overlays."
  166. (let ((overlays (overlays-at (or pos (point))))
  167. ov found)
  168. (while (setq ov (pop overlays))
  169. (if (overlay-get ov prop)
  170. (if delete (delete-overlay ov) (push ov found))))
  171. found))
  172. (defun org-get-x-clipboard (value)
  173. "Get the value of the x or Windows clipboard, compatible with XEmacs, and GNU Emacs 21."
  174. (cond ((eq window-system 'x)
  175. (let ((x (org-get-x-clipboard-compat value)))
  176. (if x (org-no-properties x))))
  177. ((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data))
  178. (w32-get-clipboard-data))))
  179. (defsubst org-decompose-region (beg end)
  180. "Decompose from BEG to END."
  181. (if (featurep 'xemacs)
  182. (let ((modified-p (buffer-modified-p))
  183. (buffer-read-only nil))
  184. (remove-text-properties beg end '(composition nil))
  185. (set-buffer-modified-p modified-p))
  186. (decompose-region beg end)))
  187. ;; Miscellaneous functions
  188. (defun org-add-hook (hook function &optional append local)
  189. "Add-hook, compatible with both Emacsen."
  190. (if (and local (featurep 'xemacs))
  191. (add-local-hook hook function append)
  192. (add-hook hook function append local)))
  193. (defun org-add-props (string plist &rest props)
  194. "Add text properties to entire string, from beginning to end.
  195. PLIST may be a list of properties, PROPS are individual properties and values
  196. that will be added to PLIST. Returns the string that was modified."
  197. (add-text-properties
  198. 0 (length string) (if props (append plist props) plist) string)
  199. string)
  200. (put 'org-add-props 'lisp-indent-function 2)
  201. (defun org-fit-window-to-buffer (&optional window max-height min-height
  202. shrink-only)
  203. "Fit WINDOW to the buffer, but only if it is not a side-by-side window.
  204. WINDOW defaults to the selected window. MAX-HEIGHT and MIN-HEIGHT are
  205. passed through to `fit-window-to-buffer'. If SHRINK-ONLY is set, call
  206. `shrink-window-if-larger-than-buffer' instead, the height limit is
  207. ignored in this case."
  208. (cond ((if (fboundp 'window-full-width-p)
  209. (not (window-full-width-p window))
  210. ;; do nothing if another window would suffer
  211. (> (frame-width) (window-width window))))
  212. ((and (fboundp 'fit-window-to-buffer) (not shrink-only))
  213. (fit-window-to-buffer window max-height min-height))
  214. ((fboundp 'shrink-window-if-larger-than-buffer)
  215. (shrink-window-if-larger-than-buffer window)))
  216. (or window (selected-window)))
  217. (defun org-number-sequence (from &optional to inc)
  218. "Call `number-sequence or emulate it."
  219. (if (fboundp 'number-sequence)
  220. (number-sequence from to inc)
  221. (if (or (not to) (= from to))
  222. (list from)
  223. (or inc (setq inc 1))
  224. (when (zerop inc) (error "The increment can not be zero"))
  225. (let (seq (n 0) (next from))
  226. (if (> inc 0)
  227. (while (<= next to)
  228. (setq seq (cons next seq)
  229. n (1+ n)
  230. next (+ from (* n inc))))
  231. (while (>= next to)
  232. (setq seq (cons next seq)
  233. n (1+ n)
  234. next (+ from (* n inc)))))
  235. (nreverse seq)))))
  236. ;; Region compatibility
  237. (defvar org-ignore-region nil
  238. "Non-nil means temporarily disable the active region.")
  239. (defun org-region-active-p ()
  240. "Is `transient-mark-mode' on and the region active?
  241. Works on both Emacs and XEmacs."
  242. (if org-ignore-region
  243. nil
  244. (if (featurep 'xemacs)
  245. (and zmacs-regions (region-active-p))
  246. (if (fboundp 'use-region-p)
  247. (use-region-p)
  248. (and transient-mark-mode mark-active))))) ; Emacs 22 and before
  249. (defun org-cursor-to-region-beginning ()
  250. (when (and (org-region-active-p)
  251. (> (point) (region-beginning)))
  252. (exchange-point-and-mark)))
  253. ;; Emacs 22 misses `activate-mark'
  254. (if (fboundp 'activate-mark)
  255. (defalias 'org-activate-mark 'activate-mark)
  256. (defun org-activate-mark ()
  257. (when (mark t)
  258. (setq mark-active t)
  259. (when (and (boundp 'transient-mark-mode)
  260. (not transient-mark-mode))
  261. (setq transient-mark-mode 'lambda))
  262. (when (boundp 'zmacs-regions)
  263. (setq zmacs-regions t)))))
  264. ;; Invisibility compatibility
  265. (defun org-remove-from-invisibility-spec (arg)
  266. "Remove elements from `buffer-invisibility-spec'."
  267. (if (fboundp 'remove-from-invisibility-spec)
  268. (remove-from-invisibility-spec arg)
  269. (if (consp buffer-invisibility-spec)
  270. (setq buffer-invisibility-spec
  271. (delete arg buffer-invisibility-spec)))))
  272. (defun org-in-invisibility-spec-p (arg)
  273. "Is ARG a member of `buffer-invisibility-spec'?"
  274. (if (consp buffer-invisibility-spec)
  275. (member arg buffer-invisibility-spec)
  276. nil))
  277. (defmacro org-xemacs-without-invisibility (&rest body)
  278. "Turn off extents with invisibility while executing BODY."
  279. `(let ((ext-inv (extent-list nil (point-at-bol) (point-at-eol)
  280. 'all-extents-closed-open 'invisible))
  281. ext-inv-specs)
  282. (dolist (ext ext-inv)
  283. (when (extent-property ext 'invisible)
  284. (add-to-list 'ext-inv-specs (list ext (extent-property
  285. ext 'invisible)))
  286. (set-extent-property ext 'invisible nil)))
  287. ,@body
  288. (dolist (ext-inv-spec ext-inv-specs)
  289. (set-extent-property (car ext-inv-spec) 'invisible
  290. (cadr ext-inv-spec)))))
  291. (def-edebug-spec org-xemacs-without-invisibility (body))
  292. (defun org-indent-to-column (column &optional minimum buffer)
  293. "Work around a bug with extents with invisibility in XEmacs."
  294. (if (featurep 'xemacs)
  295. (org-xemacs-without-invisibility (indent-to-column column minimum buffer))
  296. (indent-to-column column minimum)))
  297. (defun org-indent-line-to (column)
  298. "Work around a bug with extents with invisibility in XEmacs."
  299. (if (featurep 'xemacs)
  300. (org-xemacs-without-invisibility (indent-line-to column))
  301. (indent-line-to column)))
  302. (defun org-move-to-column (column &optional force buffer ignore-invisible)
  303. (let ((buffer-invisibility-spec ignore-invisible))
  304. (if (featurep 'xemacs)
  305. (org-xemacs-without-invisibility (move-to-column column force buffer))
  306. (move-to-column column force))))
  307. (defun org-get-x-clipboard-compat (value)
  308. "Get the clipboard value on XEmacs or Emacs 21."
  309. (cond ((featurep 'xemacs)
  310. (org-no-warnings (get-selection-no-error value)))
  311. ((fboundp 'x-get-selection)
  312. (condition-case nil
  313. (or (x-get-selection value 'UTF8_STRING)
  314. (x-get-selection value 'COMPOUND_TEXT)
  315. (x-get-selection value 'STRING)
  316. (x-get-selection value 'TEXT))
  317. (error nil)))))
  318. (defun org-propertize (string &rest properties)
  319. (if (featurep 'xemacs)
  320. (progn
  321. (add-text-properties 0 (length string) properties string)
  322. string)
  323. (apply 'propertize string properties)))
  324. (defmacro org-find-library-dir (library)
  325. `(file-name-directory (or (locate-library ,library) "")))
  326. (defun org-count-lines (s)
  327. "How many lines in string S?"
  328. (let ((start 0) (n 1))
  329. (while (string-match "\n" s start)
  330. (setq start (match-end 0) n (1+ n)))
  331. (if (and (> (length s) 0) (= (aref s (1- (length s))) ?\n))
  332. (setq n (1- n)))
  333. n))
  334. (defun org-kill-new (string &rest args)
  335. (remove-text-properties 0 (length string) '(line-prefix t wrap-prefix t)
  336. string)
  337. (apply 'kill-new string args))
  338. (defun org-select-frame-set-input-focus (frame)
  339. "Select FRAME, raise it, and set input focus, if possible."
  340. (cond ((featurep 'xemacs)
  341. (if (fboundp 'select-frame-set-input-focus)
  342. (select-frame-set-input-focus frame)
  343. (raise-frame frame)
  344. (select-frame frame)
  345. (focus-frame frame)))
  346. ;; `select-frame-set-input-focus' defined in Emacs 21 will not
  347. ;; set the input focus.
  348. ((>= emacs-major-version 22)
  349. (select-frame-set-input-focus frame))
  350. (t
  351. (raise-frame frame)
  352. (select-frame frame)
  353. (cond ((memq window-system '(x ns mac))
  354. (x-focus-frame frame))
  355. ((eq window-system 'w32)
  356. (w32-focus-frame frame)))
  357. (when focus-follows-mouse
  358. (set-mouse-position frame (1- (frame-width frame)) 0)))))
  359. (defun org-float-time (&optional time)
  360. "Convert time value TIME to a floating point number.
  361. TIME defaults to the current time."
  362. (if (featurep 'xemacs)
  363. (time-to-seconds (or time (current-time)))
  364. (float-time time)))
  365. ;; `user-error' is only available from 24.2.50 on
  366. (unless (fboundp 'user-error)
  367. (defalias 'user-error 'error))
  368. (defmacro org-no-popups (&rest body)
  369. "Suppress popup windows.
  370. Let-bind some variables to nil around BODY to achieve the desired
  371. effect, which variables to use depends on the Emacs version."
  372. (if (org-version-check "24.2.50" "" :predicate)
  373. `(let (pop-up-frames display-buffer-alist)
  374. ,@body)
  375. `(let (pop-up-frames special-display-buffer-names special-display-regexps special-display-function)
  376. ,@body)))
  377. (if (fboundp 'string-match-p)
  378. (defalias 'org-string-match-p 'string-match-p)
  379. (defun org-string-match-p (regexp string &optional start)
  380. (save-match-data
  381. (funcall 'string-match regexp string start))))
  382. (if (fboundp 'looking-at-p)
  383. (defalias 'org-looking-at-p 'looking-at-p)
  384. (defun org-looking-at-p (&rest args)
  385. (save-match-data
  386. (apply 'looking-at args))))
  387. ;; XEmacs does not have `looking-back'.
  388. (if (fboundp 'looking-back)
  389. (defalias 'org-looking-back 'looking-back)
  390. (defun org-looking-back (regexp &optional limit greedy)
  391. "Return non-nil if text before point matches regular expression REGEXP.
  392. Like `looking-at' except matches before point, and is slower.
  393. LIMIT if non-nil speeds up the search by specifying a minimum
  394. starting position, to avoid checking matches that would start
  395. before LIMIT.
  396. If GREEDY is non-nil, extend the match backwards as far as
  397. possible, stopping when a single additional previous character
  398. cannot be part of a match for REGEXP. When the match is
  399. extended, its starting position is allowed to occur before
  400. LIMIT."
  401. (let ((start (point))
  402. (pos
  403. (save-excursion
  404. (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)
  405. (point)))))
  406. (if (and greedy pos)
  407. (save-restriction
  408. (narrow-to-region (point-min) start)
  409. (while (and (> pos (point-min))
  410. (save-excursion
  411. (goto-char pos)
  412. (backward-char 1)
  413. (looking-at (concat "\\(?:" regexp "\\)\\'"))))
  414. (setq pos (1- pos)))
  415. (save-excursion
  416. (goto-char pos)
  417. (looking-at (concat "\\(?:" regexp "\\)\\'")))))
  418. (not (null pos)))))
  419. (defun org-floor* (x &optional y)
  420. "Return a list of the floor of X and the fractional part of X.
  421. With two arguments, return floor and remainder of their quotient."
  422. (let ((q (floor x y)))
  423. (list q (- x (if y (* y q) q)))))
  424. ;; `pop-to-buffer-same-window' has been introduced in Emacs 24.1.
  425. (defun org-pop-to-buffer-same-window
  426. (&optional buffer-or-name norecord label)
  427. "Pop to buffer specified by BUFFER-OR-NAME in the selected window."
  428. (if (fboundp 'pop-to-buffer-same-window)
  429. (funcall
  430. 'pop-to-buffer-same-window buffer-or-name norecord)
  431. (funcall 'switch-to-buffer buffer-or-name norecord)))
  432. ;; RECURSIVE has been introduced with Emacs 23.2.
  433. ;; This is copying and adapted from `tramp-compat-delete-directory'
  434. (defun org-delete-directory (directory &optional recursive)
  435. "Compatibility function for `delete-directory'."
  436. (if (null recursive)
  437. (delete-directory directory)
  438. (condition-case nil
  439. (funcall 'delete-directory directory recursive)
  440. ;; This Emacs version does not support the RECURSIVE flag. We
  441. ;; use the implementation from Emacs 23.2.
  442. (wrong-number-of-arguments
  443. (setq directory (directory-file-name (expand-file-name directory)))
  444. (if (not (file-symlink-p directory))
  445. (mapc (lambda (file)
  446. (if (eq t (car (file-attributes file)))
  447. (org-delete-directory file recursive)
  448. (delete-file file)))
  449. (directory-files
  450. directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
  451. (delete-directory directory)))))
  452. ;;;###autoload
  453. (defmacro org-check-version ()
  454. "Try very hard to provide sensible version strings."
  455. (let* ((org-dir (org-find-library-dir "org"))
  456. (org-version.el (concat org-dir "org-version.el"))
  457. (org-fixup.el (concat org-dir "../mk/org-fixup.el")))
  458. (if (require 'org-version org-version.el 'noerror)
  459. '(progn
  460. (autoload 'org-release "org-version.el")
  461. (autoload 'org-git-version "org-version.el"))
  462. (if (require 'org-fixup org-fixup.el 'noerror)
  463. '(org-fixup)
  464. ;; provide fallback definitions and complain
  465. (warn "Could not define org version correctly. Check installation!")
  466. '(progn
  467. (defun org-release () "N/A")
  468. (defun org-git-version () "N/A !!check installation!!"))))))
  469. (defun org-file-equal-p (f1 f2)
  470. "Return t if files F1 and F2 are the same.
  471. Implements `file-equal-p' for older emacsen and XEmacs."
  472. (if (fboundp 'file-equal-p)
  473. (file-equal-p f1 f2)
  474. (let (f1-attr f2-attr)
  475. (and (setq f1-attr (file-attributes (file-truename f1)))
  476. (setq f2-attr (file-attributes (file-truename f2)))
  477. (equal f1-attr f2-attr)))))
  478. ;; `buffer-narrowed-p' is available for Emacs >=24.3
  479. (defun org-buffer-narrowed-p ()
  480. "Compatibility function for `buffer-narrowed-p'."
  481. (if (fboundp 'buffer-narrowed-p)
  482. (buffer-narrowed-p)
  483. (/= (- (point-max) (point-min)) (buffer-size))))
  484. (defmacro org-with-silent-modifications (&rest body)
  485. (if (fboundp 'with-silent-modifications)
  486. `(with-silent-modifications ,@body)
  487. `(org-unmodified ,@body)))
  488. (def-edebug-spec org-with-silent-modifications (body))
  489. (provide 'org-compat)
  490. ;;; org-compat.el ends here