mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-26 07:33:39 +00:00
Merge branch 'refactor/org-macros'
This commit is contained in:
commit
7410001a47
@ -54,6 +54,7 @@ executed inside the protection of `save-excursion' and
|
||||
(error "buffer %s doesn't exist or has no process" ,buffer))
|
||||
(set-buffer ,buffer)
|
||||
,@body)))
|
||||
(def-edebug-spec org-babel-comint-in-buffer (form body))
|
||||
|
||||
(defmacro org-babel-comint-with-output (meta &rest body)
|
||||
"Evaluate BODY in BUFFER and return process output.
|
||||
@ -115,6 +116,7 @@ or user `keyboard-quit' during execution of body."
|
||||
string-buffer))
|
||||
(setq raw (substring string-buffer (match-end 0))))
|
||||
(split-string string-buffer comint-prompt-regexp)))))
|
||||
(def-edebug-spec org-babel-comint-with-output (form body))
|
||||
|
||||
(defun org-babel-comint-input-command (buffer cmd)
|
||||
"Pass CMD to BUFFER.
|
||||
|
@ -73,6 +73,7 @@ process."
|
||||
(setq results ,@body))
|
||||
(set-buffer export-buffer)
|
||||
results)))
|
||||
(def-edebug-spec org-babel-exp-in-export-file (form body))
|
||||
|
||||
(defun org-babel-exp-src-block (body &rest headers)
|
||||
"Process source block for export.
|
||||
|
@ -118,6 +118,7 @@ example above."
|
||||
(org-babel-execute-src-block
|
||||
nil (list "emacs-lisp" "results" params) '((:results . "silent"))))
|
||||
""))))
|
||||
(def-edebug-spec sbe (form form))
|
||||
|
||||
(provide 'ob-table)
|
||||
|
||||
|
@ -119,6 +119,7 @@ evaluating BODY."
|
||||
(setf ,temp-result (progn ,@body)))
|
||||
(unless ,visited-p (kill-buffer ,temp-file))
|
||||
,temp-result)))
|
||||
(def-edebug-spec org-babel-with-temp-filebuffer (form body))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-load-file (file)
|
||||
|
@ -624,6 +624,7 @@ Return t if a code block was found at point, nil otherwise."
|
||||
(if (org-bound-and-true-p org-edit-src-from-org-mode)
|
||||
(org-edit-src-exit)))
|
||||
t)))
|
||||
(def-edebug-spec org-babel-do-in-edit-buffer (body))
|
||||
|
||||
(defun org-babel-do-key-sequence-in-edit-buffer (key)
|
||||
"Read key sequence and execute the command in edit buffer.
|
||||
@ -720,6 +721,7 @@ end-body --------- point at the end of the body"
|
||||
(goto-char end-block))))
|
||||
(unless visited-p (kill-buffer to-be-removed))
|
||||
(goto-char point))))
|
||||
(def-edebug-spec org-babel-map-src-blocks (form body))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro org-babel-map-inline-src-blocks (file &rest body)
|
||||
@ -742,6 +744,7 @@ buffer."
|
||||
(goto-char (match-end 0))))
|
||||
(unless visited-p (kill-buffer to-be-removed))
|
||||
(goto-char point))))
|
||||
(def-edebug-spec org-babel-map-inline-src-blocks (form body))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-execute-buffer (&optional arg)
|
||||
|
@ -1738,6 +1738,7 @@ of the current line."
|
||||
(save-excursion
|
||||
(goto-char ,marker)
|
||||
,@body)))))
|
||||
(def-edebug-spec org-agenda-with-point-at-orig-entry (form body))
|
||||
|
||||
(defun org-add-agenda-custom-command (entry)
|
||||
"Replace or add a command in `org-agenda-custom-commands'.
|
||||
@ -2599,6 +2600,7 @@ before running the agenda command."
|
||||
(org-agenda nil cmd-key)))
|
||||
(set-buffer org-agenda-buffer-name)
|
||||
(princ (org-encode-for-stdout (buffer-string))))
|
||||
(def-edebug-spec org-batch-agenda (form &rest sexp))
|
||||
|
||||
;(defun org-encode-for-stdout (string)
|
||||
; (if (fboundp 'encode-coding-string)
|
||||
@ -2665,6 +2667,7 @@ agenda-day The day in the agenda where this is listed"
|
||||
priority-letter priority agenda-day)
|
||||
",")))
|
||||
(princ "\n")))))
|
||||
(def-edebug-spec org-batch-agenda-csv (form &rest sexp))
|
||||
|
||||
(defun org-fix-agenda-info (props)
|
||||
"Make sure all properties on an agenda item have a canonical form.
|
||||
@ -2741,6 +2744,7 @@ This ensures the export commands can easily use it."
|
||||
(org-write-agenda (expand-file-name (pop files) dir) nil t)))
|
||||
(and (get-buffer org-agenda-buffer-name)
|
||||
(kill-buffer org-agenda-buffer-name)))))))
|
||||
(def-edebug-spec org-batch-store-agenda-views (&rest sexp))
|
||||
|
||||
(defun org-agenda-mark-header-line (pos)
|
||||
"Mark the line at POS as an agenda structure header."
|
||||
|
@ -693,7 +693,7 @@ Use alsa's aplay tool if available."
|
||||
(goto-char (car ,clock))
|
||||
(beginning-of-line)
|
||||
,@forms))))
|
||||
|
||||
(def-edebug-spec org-with-clock-position (form body))
|
||||
(put 'org-with-clock-position 'lisp-indent-function 1)
|
||||
|
||||
(defmacro org-with-clock (clock &rest forms)
|
||||
@ -709,7 +709,7 @@ This macro also protects the current active clock from being altered."
|
||||
(outline-back-to-heading t)
|
||||
(point-marker))))
|
||||
,@forms)))
|
||||
|
||||
(def-edebug-spec org-with-clock (form body))
|
||||
(put 'org-with-clock 'lisp-indent-function 1)
|
||||
|
||||
(defsubst org-clock-clock-in (clock &optional resume start-time)
|
||||
|
@ -286,6 +286,7 @@ Works on both Emacs and XEmacs."
|
||||
(dolist (ext-inv-spec ext-inv-specs)
|
||||
(set-extent-property (car ext-inv-spec) 'invisible
|
||||
(cadr ext-inv-spec)))))
|
||||
(def-edebug-spec org-xemacs-without-invisibility (body))
|
||||
|
||||
(defun org-indent-to-column (column &optional minimum buffer)
|
||||
"Work around a bug with extents with invisibility in XEmacs."
|
||||
|
@ -51,6 +51,7 @@
|
||||
`(let ,(mapcar (lambda (s)
|
||||
`(,s (make-symbol (concat "--" (symbol-name ',s))))) symbols)
|
||||
,@body))
|
||||
(def-edebug-spec org-with-gensyms (sexp body))
|
||||
(put 'org-with-gensyms 'lisp-indent-function 1)
|
||||
|
||||
(defmacro org-called-interactively-p (&optional kind)
|
||||
@ -61,17 +62,20 @@
|
||||
(>= emacs-minor-version 2)))
|
||||
`(with-no-warnings (called-interactively-p ,kind)) ;; defined with no argument in <=23.1
|
||||
`(interactive-p))))
|
||||
(def-edebug-spec org-called-interactively-p (&optional ("quote" symbolp)))
|
||||
|
||||
(if (and (not (fboundp 'with-silent-modifications))
|
||||
(when (and (not (fboundp 'with-silent-modifications))
|
||||
(or (< emacs-major-version 23)
|
||||
(and (= emacs-major-version 23)
|
||||
(< emacs-minor-version 2))))
|
||||
(defmacro with-silent-modifications (&rest body)
|
||||
`(org-unmodified ,@body)))
|
||||
`(org-unmodified ,@body))
|
||||
(def-edebug-spec with-silent-modifications (body)))
|
||||
|
||||
(defmacro org-bound-and-true-p (var)
|
||||
"Return the value of symbol VAR if it is bound, else nil."
|
||||
`(and (boundp (quote ,var)) ,var))
|
||||
(def-edebug-spec org-bound-and-true-p (symbolp))
|
||||
|
||||
(defun org-string-nw-p (s)
|
||||
"Is S a string with a non-white character?"
|
||||
@ -92,6 +96,7 @@ Also, do not record undo information."
|
||||
(let ((buffer-undo-list t)
|
||||
before-change-functions after-change-functions)
|
||||
,@body))))
|
||||
(def-edebug-spec org-unmodified (body))
|
||||
|
||||
(defun org-substitute-posix-classes (re)
|
||||
"Substitute posix classes in regular expression RE."
|
||||
@ -110,6 +115,7 @@ Also, do not record undo information."
|
||||
(defmacro org-re (s)
|
||||
"Replace posix classes in regular expression."
|
||||
(if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s))
|
||||
(def-edebug-spec org-re (form))
|
||||
|
||||
(defmacro org-preserve-lc (&rest body)
|
||||
(org-with-gensyms (line col)
|
||||
@ -119,6 +125,7 @@ Also, do not record undo information."
|
||||
(progn ,@body)
|
||||
(org-goto-line ,line)
|
||||
(org-move-to-column ,col)))))
|
||||
(def-edebug-spec org-preserve-lc (body))
|
||||
|
||||
(defmacro org-without-partial-completion (&rest body)
|
||||
`(if (and (boundp 'partial-completion-mode)
|
||||
@ -130,7 +137,9 @@ Also, do not record undo information."
|
||||
,@body)
|
||||
(partial-completion-mode 1))
|
||||
,@body))
|
||||
(def-edebug-spec org-without-partial-completion (body))
|
||||
|
||||
;; FIXME: Slated for removal. Current Org mode does not support Emacs < 22
|
||||
(defmacro org-maybe-intangible (props)
|
||||
"Add '(intangible t) to PROPS if Emacs version is earlier than Emacs 22.
|
||||
In Emacs 21, invisible text is not avoided by the command loop, so the
|
||||
@ -152,25 +161,30 @@ We use a macro so that the test can happen at compilation time."
|
||||
(save-excursion
|
||||
(goto-char (or ,mpom (point)))
|
||||
,@body)))))
|
||||
(def-edebug-spec org-with-point-at (form body))
|
||||
(put 'org-with-point-at 'lisp-indent-function 1)
|
||||
|
||||
(defmacro org-no-warnings (&rest body)
|
||||
(cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
|
||||
(def-edebug-spec org-no-warnings (body))
|
||||
|
||||
(defmacro org-if-unprotected (&rest body)
|
||||
"Execute BODY if there is no `org-protected' text property at point."
|
||||
`(unless (get-text-property (point) 'org-protected)
|
||||
,@body))
|
||||
(def-edebug-spec org-if-unprotected (body))
|
||||
|
||||
(defmacro org-if-unprotected-1 (&rest body)
|
||||
"Execute BODY if there is no `org-protected' text property at point-1."
|
||||
`(unless (get-text-property (1- (point)) 'org-protected)
|
||||
,@body))
|
||||
(def-edebug-spec org-if-unprotected-1 (body))
|
||||
|
||||
(defmacro org-if-unprotected-at (pos &rest body)
|
||||
"Execute BODY if there is no `org-protected' text property at POS."
|
||||
`(unless (get-text-property ,pos 'org-protected)
|
||||
,@body))
|
||||
(def-edebug-spec org-if-unprotected-at (form body))
|
||||
(put 'org-if-unprotected-at 'lisp-indent-function 1)
|
||||
|
||||
(defun org-re-search-forward-unprotected (&rest args)
|
||||
@ -182,6 +196,7 @@ We use a macro so that the test can happen at compilation time."
|
||||
(unless (get-text-property (match-beginning 0) 'org-protected)
|
||||
(throw 'exit (point))))))
|
||||
|
||||
;; FIXME: Normalize argument names
|
||||
(defmacro org-with-remote-undo (_buffer &rest _body)
|
||||
"Execute BODY while recording undo information in two buffers."
|
||||
(org-with-gensyms (cline cmd buf1 buf2 undo1 undo2 c1 c2)
|
||||
@ -205,11 +220,13 @@ We use a macro so that the test can happen at compilation time."
|
||||
;; remember which buffer to undo
|
||||
(push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2)
|
||||
org-agenda-undo-list))))))
|
||||
(def-edebug-spec org-with-remote-undo (form body))
|
||||
(put 'org-with-remote-undo 'lisp-indent-function 1)
|
||||
|
||||
(defmacro org-no-read-only (&rest body)
|
||||
"Inhibit read-only for BODY."
|
||||
`(let ((inhibit-read-only t)) ,@body))
|
||||
(def-edebug-spec org-no-read-only (body))
|
||||
|
||||
(defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
|
||||
rear-nonsticky t mouse-map t fontified t
|
||||
@ -349,6 +366,7 @@ point nowhere."
|
||||
(and (markerp (cdr c)) (move-marker (cdr c) nil)))
|
||||
,data)))
|
||||
,rtn)))
|
||||
(def-edebug-spec org-save-outline-visibility (form body))
|
||||
|
||||
(defmacro org-with-wide-buffer (&rest body)
|
||||
"Execute body while temporarily widening the buffer."
|
||||
@ -356,6 +374,7 @@ point nowhere."
|
||||
(save-restriction
|
||||
(widen)
|
||||
,@body)))
|
||||
(def-edebug-spec org-with-wide-buffer (body))
|
||||
|
||||
(defmacro org-with-limited-levels (&rest body)
|
||||
"Execute BODY with limited number of outline levels."
|
||||
@ -363,6 +382,7 @@ point nowhere."
|
||||
(outline-regexp org-outline-regexp)
|
||||
(org-outline-regexp-at-bol (concat "^" org-outline-regexp)))
|
||||
,@body))
|
||||
(def-edebug-spec org-with-limited-levels (body))
|
||||
|
||||
(defvar org-outline-regexp) ; defined in org.el
|
||||
(defvar org-odd-levels-only) ; defined in org.el
|
||||
@ -384,6 +404,7 @@ The number of levels is controlled by `org-inlinetask-min-level'"
|
||||
|
||||
(defmacro org-eval-in-environment (environment form)
|
||||
`(eval (list 'let ,environment ',form)))
|
||||
(def-edebug-spec org-eval-in-environment (form form))
|
||||
(put 'org-eval-in-environment 'lisp-indent-function 1)
|
||||
|
||||
(defun org-make-parameter-alist (flat)
|
||||
|
@ -602,6 +602,7 @@ PUB-DIR is the publishing directory."
|
||||
org-export-preprocess-after-headline-targets-hook)
|
||||
org-export-preprocess-after-headline-targets-hook)))
|
||||
,@body))
|
||||
(def-edebug-spec org-publish-with-aux-preprocess-maybe (body))
|
||||
|
||||
(defvar project-plist)
|
||||
(defun org-publish-org-to-latex (plist filename pub-dir)
|
||||
|
@ -718,6 +718,7 @@ the language, a switch telling if the content should be in a single line."
|
||||
(with-current-buffer (marker-buffer beg-marker)
|
||||
(goto-char (marker-position beg-marker))
|
||||
,@body))))
|
||||
(def-edebug-spec org-src-do-at-code-block (body))
|
||||
|
||||
(defun org-src-do-key-sequence-at-code-block (&optional key)
|
||||
"Execute key sequence at code block in the source Org buffer.
|
||||
|
Loading…
Reference in New Issue
Block a user