2008-03-22 15:52:18 +00:00
|
|
|
;;; org-macs.el --- Top-level definitions for Org-mode
|
|
|
|
|
2013-01-01 15:04:24 +00:00
|
|
|
;; Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
;; Author: Carsten Dominik <carsten at orgmode dot org>
|
|
|
|
;; Keywords: outlines, hypermedia, calendar, wp
|
|
|
|
;; Homepage: http://orgmode.org
|
|
|
|
;;
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;;
|
2008-05-06 12:45:52 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2008-03-22 15:52:18 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 12:45:52 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 12:45:52 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2008-03-22 15:52:18 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;;
|
|
|
|
;;; Commentary:
|
|
|
|
|
2008-04-04 21:44:48 +00:00
|
|
|
;; This file contains macro definitions, defsubst definitions, other
|
|
|
|
;; stuff needed for compilation and top-level forms in Org-mode, as well
|
|
|
|
;; lots of small functions that are not org-mode specific but simply
|
|
|
|
;; generally useful stuff.
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2009-06-07 20:14:33 +00:00
|
|
|
(eval-and-compile
|
|
|
|
(unless (fboundp 'declare-function)
|
2010-11-21 10:20:40 +00:00
|
|
|
(defmacro declare-function (fn file &optional arglist fileonly)))
|
|
|
|
(if (>= emacs-major-version 23)
|
|
|
|
(defsubst org-char-to-string(c)
|
|
|
|
"Defsubst to decode UTF-8 character values in emacs 23 and beyond."
|
|
|
|
(char-to-string c))
|
|
|
|
(defsubst org-char-to-string (c)
|
|
|
|
"Defsubst to decode UTF-8 character values in emacs 22."
|
|
|
|
(string (decode-char 'ucs c)))))
|
2009-06-07 20:14:33 +00:00
|
|
|
|
2009-06-07 15:07:07 +00:00
|
|
|
(declare-function org-add-props "org-compat" (string plist &rest props))
|
2010-07-20 05:54:11 +00:00
|
|
|
(declare-function org-string-match-p "org-compat" (&rest args))
|
2009-06-07 15:07:07 +00:00
|
|
|
|
2011-08-10 05:28:41 +00:00
|
|
|
(defmacro org-with-gensyms (symbols &rest body)
|
|
|
|
`(let ,(mapcar (lambda (s)
|
|
|
|
`(,s (make-symbol (concat "--" (symbol-name ',s))))) symbols)
|
|
|
|
,@body))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-with-gensyms (sexp body))
|
2011-08-10 05:28:41 +00:00
|
|
|
(put 'org-with-gensyms 'lisp-indent-function 1)
|
|
|
|
|
2010-10-25 11:26:27 +00:00
|
|
|
(defmacro org-called-interactively-p (&optional kind)
|
2011-06-29 22:25:09 +00:00
|
|
|
(if (featurep 'xemacs)
|
2012-08-11 17:10:44 +00:00
|
|
|
`(interactive-p)
|
|
|
|
(if (or (> emacs-major-version 23)
|
|
|
|
(and (>= emacs-major-version 23)
|
|
|
|
(>= emacs-minor-version 2)))
|
|
|
|
;; defined with no argument in <=23.1
|
|
|
|
`(with-no-warnings (called-interactively-p ,kind))
|
|
|
|
`(interactive-p))))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-called-interactively-p (&optional ("quote" symbolp)))
|
2010-10-25 11:26:27 +00:00
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
(defmacro org-bound-and-true-p (var)
|
|
|
|
"Return the value of symbol VAR if it is bound, else nil."
|
|
|
|
`(and (boundp (quote ,var)) ,var))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-bound-and-true-p (symbolp))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
2010-07-20 05:54:11 +00:00
|
|
|
(defun org-string-nw-p (s)
|
|
|
|
"Is S a string with a non-white character?"
|
|
|
|
(and (stringp s)
|
|
|
|
(org-string-match-p "\\S-" s)
|
|
|
|
s))
|
|
|
|
|
2010-06-25 07:00:19 +00:00
|
|
|
(defun org-not-nil (v)
|
2010-06-26 05:54:07 +00:00
|
|
|
"If V not nil, and also not the string \"nil\", then return V.
|
|
|
|
Otherwise return nil."
|
|
|
|
(and v (not (equal v "nil")) v))
|
2010-06-25 07:00:19 +00:00
|
|
|
|
2011-08-10 05:49:02 +00:00
|
|
|
(defun org-substitute-posix-classes (re)
|
|
|
|
"Substitute posix classes in regular expression RE."
|
|
|
|
(let ((ss re))
|
|
|
|
(save-match-data
|
|
|
|
(while (string-match "\\[:alnum:\\]" ss)
|
|
|
|
(setq ss (replace-match "a-zA-Z0-9" t t ss)))
|
|
|
|
(while (string-match "\\[:word:\\]" ss)
|
|
|
|
(setq ss (replace-match "a-zA-Z0-9" t t ss)))
|
|
|
|
(while (string-match "\\[:alpha:\\]" ss)
|
|
|
|
(setq ss (replace-match "a-zA-Z" t t ss)))
|
|
|
|
(while (string-match "\\[:punct:\\]" ss)
|
|
|
|
(setq ss (replace-match "\001-@[-`{-~" t t ss)))
|
|
|
|
ss)))
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
(defmacro org-re (s)
|
|
|
|
"Replace posix classes in regular expression."
|
2011-08-10 05:49:02 +00:00
|
|
|
(if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-re (form))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
(defmacro org-preserve-lc (&rest body)
|
2011-08-10 05:33:43 +00:00
|
|
|
(org-with-gensyms (line col)
|
|
|
|
`(let ((,line (org-current-line))
|
|
|
|
(,col (current-column)))
|
|
|
|
(unwind-protect
|
|
|
|
(progn ,@body)
|
|
|
|
(org-goto-line ,line)
|
|
|
|
(org-move-to-column ,col)))))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-preserve-lc (body))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
2013-02-25 10:47:01 +00:00
|
|
|
;; Use `org-with-silent-modifications' to ignore cosmetic changes and
|
|
|
|
;; `org-unmodified' to ignore real text modifications
|
2013-02-23 10:44:24 +00:00
|
|
|
(defmacro org-unmodified (&rest body)
|
2012-12-30 00:21:27 +00:00
|
|
|
"Run BODY while preserving the buffer's `buffer-modified-p' state."
|
|
|
|
(org-with-gensyms (was-modified)
|
|
|
|
`(let ((,was-modified (buffer-modified-p)))
|
|
|
|
(unwind-protect
|
2013-02-23 10:44:24 +00:00
|
|
|
(let ((buffer-undo-list t)
|
|
|
|
(inhibit-modification-hooks t))
|
|
|
|
,@body)
|
|
|
|
(set-buffer-modified-p ,was-modified)))))
|
|
|
|
(def-edebug-spec org-unmodified (body))
|
2012-12-30 00:21:27 +00:00
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
(defmacro org-without-partial-completion (&rest body)
|
2011-07-02 10:15:20 +00:00
|
|
|
`(if (and (boundp 'partial-completion-mode)
|
2011-07-02 14:51:55 +00:00
|
|
|
partial-completion-mode
|
2011-07-02 10:15:20 +00:00
|
|
|
(fboundp 'partial-completion-mode))
|
2012-08-11 17:10:44 +00:00
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(partial-completion-mode -1)
|
|
|
|
,@body)
|
|
|
|
(partial-completion-mode 1))
|
2011-07-02 10:15:20 +00:00
|
|
|
,@body))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-without-partial-completion (body))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
2012-08-11 17:10:44 +00:00
|
|
|
;; FIXME: Slated for removal. Current Org mode does not support Emacs < 22
|
2008-03-22 15:52:18 +00:00
|
|
|
(defmacro org-maybe-intangible (props)
|
2008-12-16 16:23:08 +00:00
|
|
|
"Add '(intangible t) to PROPS if Emacs version is earlier than Emacs 22.
|
2010-07-16 21:23:01 +00:00
|
|
|
In Emacs 21, invisible text is not avoided by the command loop, so the
|
2008-03-22 15:52:18 +00:00
|
|
|
intangible property is needed to make sure point skips this text.
|
|
|
|
In Emacs 22, this is not necessary. The intangible text property has
|
|
|
|
led to problems with flyspell. These problems are fixed in flyspell.el,
|
|
|
|
but we still avoid setting the property in Emacs 22 and later.
|
|
|
|
We use a macro so that the test can happen at compilation time."
|
2009-04-14 10:35:32 +00:00
|
|
|
(if (< emacs-major-version 22)
|
2008-03-22 15:52:18 +00:00
|
|
|
`(append '(intangible t) ,props)
|
|
|
|
props))
|
|
|
|
|
|
|
|
(defmacro org-with-point-at (pom &rest body)
|
|
|
|
"Move to buffer and point of point-or-marker POM for the duration of BODY."
|
2011-08-10 05:33:43 +00:00
|
|
|
(org-with-gensyms (mpom)
|
|
|
|
`(let ((,mpom ,pom))
|
2011-02-25 18:30:33 +00:00
|
|
|
(save-excursion
|
2011-08-10 05:33:43 +00:00
|
|
|
(if (markerp ,mpom) (set-buffer (marker-buffer ,mpom)))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (or ,mpom (point)))
|
|
|
|
,@body)))))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-with-point-at (form body))
|
2009-09-12 05:05:21 +00:00
|
|
|
(put 'org-with-point-at 'lisp-indent-function 1)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
(defmacro org-no-warnings (&rest body)
|
|
|
|
(cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-no-warnings (body))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
2013-04-10 12:32:55 +00:00
|
|
|
(defmacro org-with-remote-undo (buffer &rest body)
|
2008-03-22 15:52:18 +00:00
|
|
|
"Execute BODY while recording undo information in two buffers."
|
2011-08-10 05:33:43 +00:00
|
|
|
(org-with-gensyms (cline cmd buf1 buf2 undo1 undo2 c1 c2)
|
|
|
|
`(let ((,cline (org-current-line))
|
|
|
|
(,cmd this-command)
|
|
|
|
(,buf1 (current-buffer))
|
2013-04-10 12:32:55 +00:00
|
|
|
(,buf2 ,buffer)
|
2011-08-10 05:33:43 +00:00
|
|
|
(,undo1 buffer-undo-list)
|
2013-04-10 12:32:55 +00:00
|
|
|
(,undo2 (with-current-buffer ,buffer buffer-undo-list))
|
2011-08-10 05:33:43 +00:00
|
|
|
,c1 ,c2)
|
2013-04-10 12:32:55 +00:00
|
|
|
,@body
|
2011-08-10 05:33:43 +00:00
|
|
|
(when org-agenda-allow-remote-undo
|
|
|
|
(setq ,c1 (org-verify-change-for-undo
|
|
|
|
,undo1 (with-current-buffer ,buf1 buffer-undo-list))
|
|
|
|
,c2 (org-verify-change-for-undo
|
|
|
|
,undo2 (with-current-buffer ,buf2 buffer-undo-list)))
|
|
|
|
(when (or ,c1 ,c2)
|
|
|
|
;; make sure there are undo boundaries
|
|
|
|
(and ,c1 (with-current-buffer ,buf1 (undo-boundary)))
|
|
|
|
(and ,c2 (with-current-buffer ,buf2 (undo-boundary)))
|
|
|
|
;; remember which buffer to undo
|
|
|
|
(push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2)
|
|
|
|
org-agenda-undo-list))))))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-with-remote-undo (form body))
|
2011-02-27 12:50:02 +00:00
|
|
|
(put 'org-with-remote-undo 'lisp-indent-function 1)
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
(defmacro org-no-read-only (&rest body)
|
|
|
|
"Inhibit read-only for BODY."
|
|
|
|
`(let ((inhibit-read-only t)) ,@body))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-no-read-only (body))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
(defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
|
2010-06-03 22:13:19 +00:00
|
|
|
rear-nonsticky t mouse-map t fontified t
|
|
|
|
org-emphasis t)
|
2008-03-22 15:52:18 +00:00
|
|
|
"Properties to remove when a string without properties is wanted.")
|
|
|
|
|
|
|
|
(defsubst org-match-string-no-properties (num &optional string)
|
|
|
|
(if (featurep 'xemacs)
|
|
|
|
(let ((s (match-string num string)))
|
2008-04-20 06:10:18 +00:00
|
|
|
(and s (remove-text-properties 0 (length s) org-rm-props s))
|
2008-03-22 15:52:18 +00:00
|
|
|
s)
|
|
|
|
(match-string-no-properties num string)))
|
|
|
|
|
2012-08-15 07:35:21 +00:00
|
|
|
(defsubst org-no-properties (s &optional restricted)
|
|
|
|
"Remove all text properties from string S.
|
|
|
|
When RESTRICTED is non-nil, only remove the properties listed
|
|
|
|
in `org-rm-props'."
|
2008-03-22 15:52:18 +00:00
|
|
|
(if (fboundp 'set-text-properties)
|
|
|
|
(set-text-properties 0 (length s) nil s)
|
2012-08-15 07:35:21 +00:00
|
|
|
(if restricted
|
|
|
|
(remove-text-properties 0 (length s) org-rm-props s)
|
|
|
|
(set-text-properties 0 (length s) nil s)))
|
2008-03-22 15:52:18 +00:00
|
|
|
s)
|
|
|
|
|
|
|
|
(defsubst org-get-alist-option (option key)
|
|
|
|
(cond ((eq key t) t)
|
|
|
|
((eq option t) t)
|
|
|
|
((assoc key option) (cdr (assoc key option)))
|
2013-02-27 07:46:26 +00:00
|
|
|
(t (let ((r (cdr (assq 'default option))))
|
|
|
|
(if (listp r) (delq nil r) r)))))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
2009-04-30 20:50:47 +00:00
|
|
|
(defsubst org-check-external-command (cmd &optional use no-error)
|
2009-11-12 12:39:29 +00:00
|
|
|
"Check if external program CMD for USE exists, error if not.
|
2009-08-15 06:16:38 +00:00
|
|
|
When the program does exist, return its path.
|
2009-04-30 20:50:47 +00:00
|
|
|
When it does not exist and NO-ERROR is set, return nil.
|
|
|
|
Otherwise, throw an error. The optional argument USE can describe what this
|
|
|
|
program is needed for, so that the error message can be more informative."
|
|
|
|
(or (executable-find cmd)
|
|
|
|
(if no-error
|
|
|
|
nil
|
|
|
|
(error "Can't find `%s'%s" cmd
|
|
|
|
(if use (format " (%s)" use) "")))))
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
(defsubst org-inhibit-invisibility ()
|
|
|
|
"Modified `buffer-invisibility-spec' for Emacs 21.
|
|
|
|
Some ops with invisible text do not work correctly on Emacs 21. For these
|
|
|
|
we turn off invisibility temporarily. Use this in a `let' form."
|
|
|
|
(if (< emacs-major-version 22) nil buffer-invisibility-spec))
|
|
|
|
|
|
|
|
(defsubst org-set-local (var value)
|
|
|
|
"Make VAR local in current buffer and set it to VALUE."
|
2009-07-06 15:00:03 +00:00
|
|
|
(set (make-local-variable var) value))
|
2008-03-22 15:52:18 +00:00
|
|
|
|
|
|
|
(defsubst org-last (list)
|
|
|
|
"Return the last element of LIST."
|
|
|
|
(car (last list)))
|
|
|
|
|
|
|
|
(defun org-let (list &rest body)
|
|
|
|
(eval (cons 'let (cons list body))))
|
|
|
|
(put 'org-let 'lisp-indent-function 1)
|
|
|
|
|
|
|
|
(defun org-let2 (list1 list2 &rest body)
|
|
|
|
(eval (cons 'let (cons list1 (list (cons 'let (cons list2 body)))))))
|
|
|
|
(put 'org-let2 'lisp-indent-function 2)
|
|
|
|
|
|
|
|
(defsubst org-call-with-arg (command arg)
|
2008-05-09 04:08:45 +00:00
|
|
|
"Call COMMAND interactively, but pretend prefix arg was ARG."
|
2008-03-22 15:52:18 +00:00
|
|
|
(let ((current-prefix-arg arg)) (call-interactively command)))
|
|
|
|
|
|
|
|
(defsubst org-current-line (&optional pos)
|
|
|
|
(save-excursion
|
|
|
|
(and pos (goto-char pos))
|
|
|
|
;; works also in narrowed buffer, because we start at 1, not point-min
|
|
|
|
(+ (if (bolp) 1 0) (count-lines 1 (point)))))
|
|
|
|
|
2009-08-27 08:24:09 +00:00
|
|
|
(defsubst org-goto-line (N)
|
|
|
|
(save-restriction
|
|
|
|
(widen)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(forward-line (1- N))))
|
|
|
|
|
2009-01-21 12:14:07 +00:00
|
|
|
(defsubst org-current-line-string (&optional to-here)
|
|
|
|
(buffer-substring (point-at-bol) (if to-here (point) (point-at-eol))))
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
(defsubst org-pos-in-match-range (pos n)
|
|
|
|
(and (match-beginning n)
|
|
|
|
(<= (match-beginning n) pos)
|
|
|
|
(>= (match-end n) pos)))
|
|
|
|
|
|
|
|
(defun org-autoload (file functions)
|
2008-05-09 04:08:45 +00:00
|
|
|
"Establish autoload for all FUNCTIONS in FILE, if not bound already."
|
2008-03-22 15:52:18 +00:00
|
|
|
(let ((d (format "Documentation will be available after `%s.el' is loaded."
|
|
|
|
file))
|
|
|
|
f)
|
|
|
|
(while (setq f (pop functions))
|
|
|
|
(or (fboundp f) (autoload f file d t)))))
|
|
|
|
|
2008-04-10 12:48:59 +00:00
|
|
|
(defun org-match-line (re)
|
2008-04-03 15:58:13 +00:00
|
|
|
"Looking-at at the beginning of the current line."
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-at-bol))
|
|
|
|
(looking-at re)))
|
|
|
|
|
2008-04-04 21:44:48 +00:00
|
|
|
(defun org-plist-delete (plist property)
|
|
|
|
"Delete PROPERTY from PLIST.
|
|
|
|
This is in contrast to merely setting it to 0."
|
|
|
|
(let (p)
|
|
|
|
(while plist
|
|
|
|
(if (not (eq property (car plist)))
|
|
|
|
(setq p (plist-put p (car plist) (nth 1 plist))))
|
|
|
|
(setq plist (cddr plist)))
|
|
|
|
p))
|
|
|
|
|
2009-06-07 14:11:14 +00:00
|
|
|
(defun org-replace-match-keep-properties (newtext &optional fixedcase
|
|
|
|
literal string)
|
|
|
|
"Like `replace-match', but add the text properties found original text."
|
|
|
|
(setq newtext (org-add-props newtext (text-properties-at
|
|
|
|
(match-beginning 0) string)))
|
|
|
|
(replace-match newtext fixedcase literal string))
|
|
|
|
|
2010-08-27 14:18:32 +00:00
|
|
|
(defmacro org-save-outline-visibility (use-markers &rest body)
|
|
|
|
"Save and restore outline visibility around BODY.
|
|
|
|
If USE-MARKERS is non-nil, use markers for the positions.
|
|
|
|
This means that the buffer may change while running BODY,
|
|
|
|
but it also means that the buffer should stay alive
|
|
|
|
during the operation, because otherwise all these markers will
|
|
|
|
point nowhere."
|
|
|
|
(declare (indent 1))
|
2011-08-10 05:33:43 +00:00
|
|
|
(org-with-gensyms (data rtn)
|
|
|
|
`(let ((,data (org-outline-overlay-data ,use-markers))
|
|
|
|
,rtn)
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(setq ,rtn (progn ,@body))
|
|
|
|
(org-set-outline-overlay-data ,data))
|
|
|
|
(when ,use-markers
|
|
|
|
(mapc (lambda (c)
|
|
|
|
(and (markerp (car c)) (move-marker (car c) nil))
|
|
|
|
(and (markerp (cdr c)) (move-marker (cdr c) nil)))
|
|
|
|
,data)))
|
|
|
|
,rtn)))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-save-outline-visibility (form body))
|
2010-08-27 14:18:32 +00:00
|
|
|
|
2011-03-05 10:01:28 +00:00
|
|
|
(defmacro org-with-wide-buffer (&rest body)
|
2012-08-11 17:10:44 +00:00
|
|
|
"Execute body while temporarily widening the buffer."
|
|
|
|
`(save-excursion
|
|
|
|
(save-restriction
|
2011-03-09 09:56:47 +00:00
|
|
|
(widen)
|
|
|
|
,@body)))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-with-wide-buffer (body))
|
2011-03-05 10:01:28 +00:00
|
|
|
|
2009-07-19 07:42:22 +00:00
|
|
|
(defmacro org-with-limited-levels (&rest body)
|
|
|
|
"Execute BODY with limited number of outline levels."
|
2012-05-08 13:19:36 +00:00
|
|
|
`(let* ((org-called-with-limited-levels t)
|
|
|
|
(org-outline-regexp (org-get-limited-outline-regexp))
|
2011-07-23 08:13:07 +00:00
|
|
|
(outline-regexp org-outline-regexp)
|
2012-07-28 20:29:13 +00:00
|
|
|
(org-outline-regexp-bol (concat "^" org-outline-regexp)))
|
2009-07-19 07:42:22 +00:00
|
|
|
,@body))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-with-limited-levels (body))
|
2009-07-19 07:42:22 +00:00
|
|
|
|
2011-07-18 17:25:10 +00:00
|
|
|
(defvar org-outline-regexp) ; defined in org.el
|
2009-07-20 07:16:28 +00:00
|
|
|
(defvar org-odd-levels-only) ; defined in org.el
|
|
|
|
(defvar org-inlinetask-min-level) ; defined in org-inlinetask.el
|
2009-07-19 07:42:22 +00:00
|
|
|
(defun org-get-limited-outline-regexp ()
|
|
|
|
"Return outline-regexp with limited number of levels.
|
2010-07-16 21:23:01 +00:00
|
|
|
The number of levels is controlled by `org-inlinetask-min-level'"
|
Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).
* org-timer.el (org-timer-set-timer): Ditto.
* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.
* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.
* org-remember.el (org-remember-handler): Ditto.
* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.
* org-macs.el (org-get-limited-outline-regexp): Ditto.
* org-lparse.el (org-replace-region-by): Ditto.
* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.
* org-indent.el (org-indent-indent-buffer): Ditto.
* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.
* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.
* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.
* org-docbook.el (org-replace-region-by-docbook): Ditto.
* org-ctags.el (find-tag): Ditto.
* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.
* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.
* org-ascii.el (org-replace-region-by-ascii): Ditto.
* org-archive.el (org-archive-subtree): Ditto.
* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-20 18:03:45 +00:00
|
|
|
(if (or (not (derived-mode-p 'org-mode)) (not (featurep 'org-inlinetask)))
|
Don't use `outline-regexp' anymore.
Use `org-outline-regexp' instead or `outline-regexp'. Also use the
new defconst `org-outline-regexp-bol' to match `org-outline-regexp'
at the beginning of line.
* org.el (org-outline-regexp-bol): New defconst.
(org-outline-level, org-set-font-lock-defaults, org-cycle)
(org-overview, org-content, org-flag-drawer)
(org-first-headline-recenter, org-insert-todo-heading)
(org-map-region, org-move-subtree-down, org-paste-subtree)
(org-kill-is-subtree-p, org-context-p, org-refile)
(org-refile-new-child, org-toggle-comment, org-todo)
(org-add-planning-info, org-add-log-setup, org-scan-tags)
(org-set-tags, org-insert-property-drawer)
(org-prepare-agenda-buffers, org-preview-latex-fragment)
(org-speed-command-default-hook, org-check-for-hidden)
(org-toggle-item, org-toggle-heading)
(org-indent-line-function, org-set-autofill-regexps)
(org-fill-paragraph, org-toggle-fixed-width-section)
(org-yank-generic, org-yank-folding-would-swallow-text)
(org-first-sibling-p, org-goto-sibling)
(org-goto-first-child, org-show-entry): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-remember.el (org-remember-handler): Use
`org-outline-regexp-bol'.
* org-mouse.el (org-mouse-match-todo-keyword, org-mode-hook)
(org-mouse-move-tree, org-mouse-transform-to-outline): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-macs.el (org-with-limited-levels)
(org-get-limited-outline-regexp): Use `org-outline-regexp'.
* org-indent.el (org-indent-outline-re)
(org-indent-refresh-section, org-indent-refresh-to): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-html.el (org-export-as-html): Use
`org-outline-regexp-bol'.
* org-footnote.el (org-footnote-at-definition-p)
(org-footnote-normalize): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-exp.el (org-export-preprocess-string): Don't redefine
`outline-regexp'.
* org-docbook.el (org-export-as-docbook): Use
`org-outline-regexp-bol'.
* org-colview.el (org-columns, org-columns-compute): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
* org-colview-xemacs.el (org-columns, org-columns-compute):
Use `org-outline-regexp-bol'.
* org-clock.el (org-clock-insert-selection-line)
(org-clock-in, org-clock-out, org-dblock-write:clocktable):
Use `org-outline-regexp' and `org-outline-regexp-bol'.
* org-ascii.el (org-export-as-ascii)
(org-export-ascii-push-links): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-archive.el (org-archive-to-archive-sibling)
(org-archive-all-done): Use `org-outline-regexp' and
`org-outline-regexp-bol'.
* org-agenda.el (org-agenda, org-search-view)
(org-agenda-list-stuck-projects, org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-get-blocks): Use
`org-outline-regexp' and `org-outline-regexp-bol'.
2011-07-17 19:17:08 +00:00
|
|
|
org-outline-regexp
|
2009-07-19 07:42:22 +00:00
|
|
|
(let* ((limit-level (1- org-inlinetask-min-level))
|
|
|
|
(nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level)))
|
|
|
|
(format "\\*\\{1,%d\\} " nstars))))
|
2009-08-03 15:30:30 +00:00
|
|
|
|
2011-07-03 11:23:09 +00:00
|
|
|
(defun org-format-seconds (string seconds)
|
2012-07-30 08:08:15 +00:00
|
|
|
"Compatibility function replacing format-seconds."
|
2011-07-03 11:23:09 +00:00
|
|
|
(if (fboundp 'format-seconds)
|
|
|
|
(format-seconds string seconds)
|
|
|
|
(format-time-string string (seconds-to-time seconds))))
|
|
|
|
|
2011-08-10 05:43:10 +00:00
|
|
|
(defmacro org-eval-in-environment (environment form)
|
|
|
|
`(eval (list 'let ,environment ',form)))
|
Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-11 06:57:25 +00:00
|
|
|
(def-edebug-spec org-eval-in-environment (form form))
|
2011-08-10 05:43:10 +00:00
|
|
|
(put 'org-eval-in-environment 'lisp-indent-function 1)
|
|
|
|
|
2011-08-10 06:14:26 +00:00
|
|
|
(defun org-make-parameter-alist (flat)
|
|
|
|
"Return alist based on FLAT.
|
2012-08-11 17:10:44 +00:00
|
|
|
FLAT is a list with alternating symbol names and values. The
|
2011-08-10 06:14:26 +00:00
|
|
|
returned alist is a list of lists with the symbol name in car and
|
|
|
|
the value in cdr."
|
|
|
|
(when flat
|
|
|
|
(cons (list (car flat) (cadr flat))
|
2012-08-11 17:10:44 +00:00
|
|
|
(org-make-parameter-alist (cddr flat)))))
|
2011-08-10 06:14:26 +00:00
|
|
|
|
2013-01-10 23:43:26 +00:00
|
|
|
;;;###autoload
|
2013-01-06 17:24:56 +00:00
|
|
|
(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)))
|
|
|
|
|
2008-03-22 15:52:18 +00:00
|
|
|
(provide 'org-macs)
|
|
|
|
|
|
|
|
;;; org-macs.el ends here
|