Browse Source

Merge branch 'refactor/org-macros'

David Maus 14 years ago
parent
commit
7410001a47
11 changed files with 40 additions and 4 deletions
  1. 2 0
      lisp/ob-comint.el
  2. 1 0
      lisp/ob-exp.el
  3. 1 0
      lisp/ob-table.el
  4. 1 0
      lisp/ob-tangle.el
  5. 3 0
      lisp/ob.el
  6. 4 0
      lisp/org-agenda.el
  7. 2 2
      lisp/org-clock.el
  8. 1 0
      lisp/org-compat.el
  9. 23 2
      lisp/org-macs.el
  10. 1 0
      lisp/org-publish.el
  11. 1 0
      lisp/org-src.el

+ 2 - 0
lisp/ob-comint.el

@@ -54,6 +54,7 @@ executed inside the protection of `save-excursion' and
          (error "buffer %s doesn't exist or has no process" ,buffer))
          (error "buffer %s doesn't exist or has no process" ,buffer))
        (set-buffer ,buffer)
        (set-buffer ,buffer)
        ,@body)))
        ,@body)))
+(def-edebug-spec org-babel-comint-in-buffer (form body))
 
 
 (defmacro org-babel-comint-with-output (meta &rest body)
 (defmacro org-babel-comint-with-output (meta &rest body)
   "Evaluate BODY in BUFFER and return process output.
   "Evaluate BODY in BUFFER and return process output.
@@ -115,6 +116,7 @@ or user `keyboard-quit' during execution of body."
 		   string-buffer))
 		   string-buffer))
 	     (setq raw (substring string-buffer (match-end 0))))
 	     (setq raw (substring string-buffer (match-end 0))))
 	 (split-string string-buffer comint-prompt-regexp)))))
 	 (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)
 (defun org-babel-comint-input-command (buffer cmd)
   "Pass CMD to BUFFER.
   "Pass CMD to BUFFER.

+ 1 - 0
lisp/ob-exp.el

@@ -73,6 +73,7 @@ process."
 	 (setq results ,@body))
 	 (setq results ,@body))
        (set-buffer export-buffer)
        (set-buffer export-buffer)
        results)))
        results)))
+(def-edebug-spec org-babel-exp-in-export-file (form body))
 
 
 (defun org-babel-exp-src-block (body &rest headers)
 (defun org-babel-exp-src-block (body &rest headers)
   "Process source block for export.
   "Process source block for export.

+ 1 - 0
lisp/ob-table.el

@@ -118,6 +118,7 @@ example above."
            (org-babel-execute-src-block
            (org-babel-execute-src-block
             nil (list "emacs-lisp" "results" params) '((:results . "silent"))))
             nil (list "emacs-lisp" "results" params) '((:results . "silent"))))
        ""))))
        ""))))
+(def-edebug-spec sbe (form form))
 
 
 (provide 'ob-table)
 (provide 'ob-table)
 
 

+ 1 - 0
lisp/ob-tangle.el

@@ -119,6 +119,7 @@ evaluating BODY."
 	 (setf ,temp-result (progn ,@body)))
 	 (setf ,temp-result (progn ,@body)))
        (unless ,visited-p (kill-buffer ,temp-file))
        (unless ,visited-p (kill-buffer ,temp-file))
        ,temp-result)))
        ,temp-result)))
+(def-edebug-spec org-babel-with-temp-filebuffer (form body))
 
 
 ;;;###autoload
 ;;;###autoload
 (defun org-babel-load-file (file)
 (defun org-babel-load-file (file)

+ 3 - 0
lisp/ob.el

@@ -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)
 	 (if (org-bound-and-true-p org-edit-src-from-org-mode)
 	     (org-edit-src-exit)))
 	     (org-edit-src-exit)))
        t)))
        t)))
+(def-edebug-spec org-babel-do-in-edit-buffer (body))
 
 
 (defun org-babel-do-key-sequence-in-edit-buffer (key)
 (defun org-babel-do-key-sequence-in-edit-buffer (key)
   "Read key sequence and execute the command in edit buffer.
   "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))))
 	     (goto-char end-block))))
        (unless visited-p (kill-buffer to-be-removed))
        (unless visited-p (kill-buffer to-be-removed))
        (goto-char point))))
        (goto-char point))))
+(def-edebug-spec org-babel-map-src-blocks (form body))
 
 
 ;;;###autoload
 ;;;###autoload
 (defmacro org-babel-map-inline-src-blocks (file &rest body)
 (defmacro org-babel-map-inline-src-blocks (file &rest body)
@@ -742,6 +744,7 @@ buffer."
 	   (goto-char (match-end 0))))
 	   (goto-char (match-end 0))))
        (unless visited-p (kill-buffer to-be-removed))
        (unless visited-p (kill-buffer to-be-removed))
        (goto-char point))))
        (goto-char point))))
+(def-edebug-spec org-babel-map-inline-src-blocks (form body))
 
 
 ;;;###autoload
 ;;;###autoload
 (defun org-babel-execute-buffer (&optional arg)
 (defun org-babel-execute-buffer (&optional arg)

+ 4 - 0
lisp/org-agenda.el

@@ -1738,6 +1738,7 @@ of the current line."
 	 (save-excursion
 	 (save-excursion
 	   (goto-char ,marker)
 	   (goto-char ,marker)
 	   ,@body)))))
 	   ,@body)))))
+(def-edebug-spec org-agenda-with-point-at-orig-entry (form body))
 
 
 (defun org-add-agenda-custom-command (entry)
 (defun org-add-agenda-custom-command (entry)
   "Replace or add a command in `org-agenda-custom-commands'.
   "Replace or add a command in `org-agenda-custom-commands'.
@@ -2599,6 +2600,7 @@ before running the agenda command."
       (org-agenda nil cmd-key)))
       (org-agenda nil cmd-key)))
   (set-buffer org-agenda-buffer-name)
   (set-buffer org-agenda-buffer-name)
   (princ (org-encode-for-stdout (buffer-string))))
   (princ (org-encode-for-stdout (buffer-string))))
+(def-edebug-spec org-batch-agenda (form &rest sexp))
 
 
 ;(defun org-encode-for-stdout (string)
 ;(defun org-encode-for-stdout (string)
 ;  (if (fboundp 'encode-coding-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)
 				    priority-letter priority agenda-day)
 		     ",")))
 		     ",")))
 	(princ "\n")))))
 	(princ "\n")))))
+(def-edebug-spec org-batch-agenda-csv (form &rest sexp))
 
 
 (defun org-fix-agenda-info (props)
 (defun org-fix-agenda-info (props)
   "Make sure all properties on an agenda item have a canonical form.
   "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)))
 	      (org-write-agenda (expand-file-name (pop files) dir) nil t)))
 	  (and (get-buffer org-agenda-buffer-name)
 	  (and (get-buffer org-agenda-buffer-name)
 	       (kill-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)
 (defun org-agenda-mark-header-line (pos)
   "Mark the line at POS as an agenda structure header."
   "Mark the line at POS as an agenda structure header."

+ 2 - 2
lisp/org-clock.el

@@ -693,7 +693,7 @@ Use alsa's aplay tool if available."
 	 (goto-char (car ,clock))
 	 (goto-char (car ,clock))
 	 (beginning-of-line)
 	 (beginning-of-line)
 	 ,@forms))))
 	 ,@forms))))
-
+(def-edebug-spec org-with-clock-position (form body))
 (put 'org-with-clock-position 'lisp-indent-function 1)
 (put 'org-with-clock-position 'lisp-indent-function 1)
 
 
 (defmacro org-with-clock (clock &rest forms)
 (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)
 				  (outline-back-to-heading t)
 				  (point-marker))))
 				  (point-marker))))
        ,@forms)))
        ,@forms)))
-
+(def-edebug-spec org-with-clock (form body))
 (put 'org-with-clock 'lisp-indent-function 1)
 (put 'org-with-clock 'lisp-indent-function 1)
 
 
 (defsubst org-clock-clock-in (clock &optional resume start-time)
 (defsubst org-clock-clock-in (clock &optional resume start-time)

+ 1 - 0
lisp/org-compat.el

@@ -286,6 +286,7 @@ Works on both Emacs and XEmacs."
      (dolist (ext-inv-spec ext-inv-specs)
      (dolist (ext-inv-spec ext-inv-specs)
        (set-extent-property (car ext-inv-spec) 'invisible
        (set-extent-property (car ext-inv-spec) 'invisible
 			    (cadr ext-inv-spec)))))
 			    (cadr ext-inv-spec)))))
+(def-edebug-spec org-xemacs-without-invisibility (body))
 
 
 (defun org-indent-to-column (column &optional minimum buffer)
 (defun org-indent-to-column (column &optional minimum buffer)
   "Work around a bug with extents with invisibility in XEmacs."
   "Work around a bug with extents with invisibility in XEmacs."

+ 23 - 2
lisp/org-macs.el

@@ -51,6 +51,7 @@
   `(let ,(mapcar (lambda (s)
   `(let ,(mapcar (lambda (s)
 		   `(,s (make-symbol (concat "--" (symbol-name ',s))))) symbols)
 		   `(,s (make-symbol (concat "--" (symbol-name ',s))))) symbols)
      ,@body))
      ,@body))
+(def-edebug-spec org-with-gensyms (sexp body))
 (put 'org-with-gensyms 'lisp-indent-function 1)
 (put 'org-with-gensyms 'lisp-indent-function 1)
 
 
 (defmacro org-called-interactively-p (&optional kind)
 (defmacro org-called-interactively-p (&optional kind)
@@ -61,17 +62,20 @@
 		  (>= emacs-minor-version 2)))
 		  (>= emacs-minor-version 2)))
 	 `(with-no-warnings (called-interactively-p ,kind)) ;; defined with no argument in <=23.1
 	 `(with-no-warnings (called-interactively-p ,kind)) ;; defined with no argument in <=23.1
        `(interactive-p))))
        `(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)
 	 (or (< emacs-major-version 23)
 	     (and (= emacs-major-version 23)
 	     (and (= emacs-major-version 23)
 		  (< emacs-minor-version 2))))
 		  (< emacs-minor-version 2))))
     (defmacro with-silent-modifications (&rest body)
     (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)
 (defmacro org-bound-and-true-p (var)
   "Return the value of symbol VAR if it is bound, else nil."
   "Return the value of symbol VAR if it is bound, else nil."
   `(and (boundp (quote ,var)) ,var))
   `(and (boundp (quote ,var)) ,var))
+(def-edebug-spec org-bound-and-true-p (symbolp))
 
 
 (defun org-string-nw-p (s)
 (defun org-string-nw-p (s)
   "Is S a string with a non-white character?"
   "Is S a string with a non-white character?"
@@ -92,6 +96,7 @@ Also, do not record undo information."
       (let ((buffer-undo-list t)
       (let ((buffer-undo-list t)
 	    before-change-functions after-change-functions)
 	    before-change-functions after-change-functions)
 	,@body))))
 	,@body))))
+(def-edebug-spec org-unmodified (body))
 
 
 (defun org-substitute-posix-classes (re)
 (defun org-substitute-posix-classes (re)
   "Substitute posix classes in regular expression RE."
   "Substitute posix classes in regular expression RE."
@@ -110,6 +115,7 @@ Also, do not record undo information."
 (defmacro org-re (s)
 (defmacro org-re (s)
   "Replace posix classes in regular expression."
   "Replace posix classes in regular expression."
   (if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s))
   (if (featurep 'xemacs) `(org-substitute-posix-classes ,s) s))
+(def-edebug-spec org-re (form))
 
 
 (defmacro org-preserve-lc (&rest body)
 (defmacro org-preserve-lc (&rest body)
   (org-with-gensyms (line col)
   (org-with-gensyms (line col)
@@ -119,6 +125,7 @@ Also, do not record undo information."
 	   (progn ,@body)
 	   (progn ,@body)
 	 (org-goto-line ,line)
 	 (org-goto-line ,line)
 	 (org-move-to-column ,col)))))
 	 (org-move-to-column ,col)))))
+(def-edebug-spec org-preserve-lc (body))
 
 
 (defmacro org-without-partial-completion (&rest body)
 (defmacro org-without-partial-completion (&rest body)
   `(if (and (boundp 'partial-completion-mode)
   `(if (and (boundp 'partial-completion-mode)
@@ -130,7 +137,9 @@ Also, do not record undo information."
 	   ,@body)
 	   ,@body)
        (partial-completion-mode 1))
        (partial-completion-mode 1))
      ,@body))
      ,@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)
 (defmacro org-maybe-intangible (props)
   "Add '(intangible t) to PROPS if Emacs version is earlier than Emacs 22.
   "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
 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
 	 (save-excursion
 	   (goto-char (or ,mpom (point)))
 	   (goto-char (or ,mpom (point)))
 	   ,@body)))))
 	   ,@body)))))
+(def-edebug-spec org-with-point-at (form body))
 (put 'org-with-point-at 'lisp-indent-function 1)
 (put 'org-with-point-at 'lisp-indent-function 1)
 
 
 (defmacro org-no-warnings (&rest body)
 (defmacro org-no-warnings (&rest body)
   (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) 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)
 (defmacro org-if-unprotected (&rest body)
   "Execute BODY if there is no `org-protected' text property at point."
   "Execute BODY if there is no `org-protected' text property at point."
   `(unless (get-text-property (point) 'org-protected)
   `(unless (get-text-property (point) 'org-protected)
      ,@body))
      ,@body))
+(def-edebug-spec org-if-unprotected (body))
 
 
 (defmacro org-if-unprotected-1 (&rest body)
 (defmacro org-if-unprotected-1 (&rest body)
   "Execute BODY if there is no `org-protected' text property at point-1."
   "Execute BODY if there is no `org-protected' text property at point-1."
   `(unless (get-text-property (1- (point)) 'org-protected)
   `(unless (get-text-property (1- (point)) 'org-protected)
      ,@body))
      ,@body))
+(def-edebug-spec org-if-unprotected-1 (body))
 
 
 (defmacro org-if-unprotected-at (pos &rest body)
 (defmacro org-if-unprotected-at (pos &rest body)
   "Execute BODY if there is no `org-protected' text property at POS."
   "Execute BODY if there is no `org-protected' text property at POS."
   `(unless (get-text-property ,pos 'org-protected)
   `(unless (get-text-property ,pos 'org-protected)
      ,@body))
      ,@body))
+(def-edebug-spec org-if-unprotected-at (form body))
 (put 'org-if-unprotected-at 'lisp-indent-function 1)
 (put 'org-if-unprotected-at 'lisp-indent-function 1)
 
 
 (defun org-re-search-forward-unprotected (&rest args)
 (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)
       (unless (get-text-property (match-beginning 0) 'org-protected)
 	(throw 'exit (point))))))
 	(throw 'exit (point))))))
 
 
+;; FIXME: Normalize argument names
 (defmacro org-with-remote-undo (_buffer &rest _body)
 (defmacro org-with-remote-undo (_buffer &rest _body)
   "Execute BODY while recording undo information in two buffers."
   "Execute BODY while recording undo information in two buffers."
   (org-with-gensyms (cline cmd buf1 buf2 undo1 undo2 c1 c2)
   (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
 	   ;; remember which buffer to undo
 	   (push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2)
 	   (push (list ,cmd ,cline ,buf1 ,c1 ,buf2 ,c2)
 		 org-agenda-undo-list))))))
 		 org-agenda-undo-list))))))
+(def-edebug-spec org-with-remote-undo (form body))
 (put 'org-with-remote-undo 'lisp-indent-function 1)
 (put 'org-with-remote-undo 'lisp-indent-function 1)
 
 
 (defmacro org-no-read-only (&rest body)
 (defmacro org-no-read-only (&rest body)
   "Inhibit read-only for BODY."
   "Inhibit read-only for BODY."
   `(let ((inhibit-read-only t)) ,@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
 (defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
 				   rear-nonsticky t mouse-map t fontified t
 				   rear-nonsticky t mouse-map t fontified t
@@ -349,6 +366,7 @@ point nowhere."
 		   (and (markerp (cdr c)) (move-marker (cdr c) nil)))
 		   (and (markerp (cdr c)) (move-marker (cdr c) nil)))
 		 ,data)))
 		 ,data)))
        ,rtn)))
        ,rtn)))
+(def-edebug-spec org-save-outline-visibility (form body))
 
 
 (defmacro org-with-wide-buffer (&rest body)
 (defmacro org-with-wide-buffer (&rest body)
  "Execute body while temporarily widening the buffer."
  "Execute body while temporarily widening the buffer."
@@ -356,6 +374,7 @@ point nowhere."
     (save-restriction
     (save-restriction
        (widen)
        (widen)
        ,@body)))
        ,@body)))
+(def-edebug-spec org-with-wide-buffer (body))
 
 
 (defmacro org-with-limited-levels (&rest body)
 (defmacro org-with-limited-levels (&rest body)
   "Execute BODY with limited number of outline levels."
   "Execute BODY with limited number of outline levels."
@@ -363,6 +382,7 @@ point nowhere."
 	  (outline-regexp org-outline-regexp)
 	  (outline-regexp org-outline-regexp)
 	  (org-outline-regexp-at-bol (concat "^" org-outline-regexp)))
 	  (org-outline-regexp-at-bol (concat "^" org-outline-regexp)))
      ,@body))
      ,@body))
+(def-edebug-spec org-with-limited-levels (body))
 
 
 (defvar org-outline-regexp) ; defined in org.el
 (defvar org-outline-regexp) ; defined in org.el
 (defvar org-odd-levels-only) ; 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)
 (defmacro org-eval-in-environment (environment form)
   `(eval (list 'let ,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)
 (put 'org-eval-in-environment 'lisp-indent-function 1)
 
 
 (defun org-make-parameter-alist (flat)
 (defun org-make-parameter-alist (flat)

+ 1 - 0
lisp/org-publish.el

@@ -602,6 +602,7 @@ PUB-DIR is the publishing directory."
 		   org-export-preprocess-after-headline-targets-hook)
 		   org-export-preprocess-after-headline-targets-hook)
 	   org-export-preprocess-after-headline-targets-hook)))
 	   org-export-preprocess-after-headline-targets-hook)))
      ,@body))
      ,@body))
+(def-edebug-spec org-publish-with-aux-preprocess-maybe (body))
 
 
 (defvar project-plist)
 (defvar project-plist)
 (defun org-publish-org-to-latex (plist filename pub-dir)
 (defun org-publish-org-to-latex (plist filename pub-dir)

+ 1 - 0
lisp/org-src.el

@@ -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)
 	 (with-current-buffer (marker-buffer beg-marker)
 	   (goto-char (marker-position beg-marker))
 	   (goto-char (marker-position beg-marker))
 	   ,@body))))
 	   ,@body))))
+(def-edebug-spec org-src-do-at-code-block (body))
 
 
 (defun org-src-do-key-sequence-at-code-block (&optional key)
 (defun org-src-do-key-sequence-at-code-block (&optional key)
   "Execute key sequence at code block in the source Org buffer.
   "Execute key sequence at code block in the source Org buffer.