From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: [PATCH 7/7] Make org-batch-store-agenda-views a fun, use org-eval-in-environment Date: Tue, 2 Aug 2011 11:23:40 +0200 Message-ID: <1312277020-7888-8-git-send-email-dmaus@ictsoc.de> References: <1312277020-7888-1-git-send-email-dmaus@ictsoc.de> Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoBD2-0000eA-Qw for emacs-orgmode@gnu.org; Tue, 02 Aug 2011 05:24:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoBD1-0000JX-MC for emacs-orgmode@gnu.org; Tue, 02 Aug 2011 05:24:20 -0400 Received: from app1b.xlhost.de ([213.202.242.162]:59962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoBD1-0000JP-CY for emacs-orgmode@gnu.org; Tue, 02 Aug 2011 05:24:19 -0400 In-Reply-To: <1312277020-7888-1-git-send-email-dmaus@ictsoc.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: David Maus * org-agenda.el (org-batch-store-agenda-views): Make it a function, use org-eval-in-environment. --- lisp/org-agenda.el | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 6079377..9215d2a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -2697,17 +2697,14 @@ This ensures the export commands can easily use it." (interactive) (eval (list 'org-batch-store-agenda-views))) -;; FIXME, why is this a macro????? ;;;###autoload -(defmacro org-batch-store-agenda-views (&rest parameters) +(defun org-batch-store-agenda-views (&rest parameters) "Run all custom agenda commands that have a file argument." (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands)) (pop-up-frames nil) (dir default-directory) - pars cmd thiscmdkey files opts cmd-or-set) - (while parameters - (push (list (pop parameters) (if parameters (pop parameters))) pars)) - (setq pars (reverse pars)) + (pars (org-make-parameter-alist parameters)) + cmd thiscmdkey files opts cmd-or-set) (save-window-excursion (while cmds (setq cmd (pop cmds) @@ -2717,13 +2714,14 @@ This ensures the export commands can easily use it." files (nth (if (listp cmd-or-set) 4 5) cmd)) (if (stringp files) (setq files (list files))) (when files - (eval (list 'let (append org-agenda-exporter-settings opts pars) - (list 'org-agenda nil thiscmdkey))) + (org-eval-in-environment (append org-agenda-exporter-settings + opts pars) + (org-agenda nil thiscmdkey)) (set-buffer org-agenda-buffer-name) (while files - (eval (list 'let (append org-agenda-exporter-settings opts pars) - (list 'org-write-agenda - (expand-file-name (pop files) dir) nil t)))) + (org-eval-in-environment (append org-agenda-exporter-settings + opts pars) + (org-write-agenda (expand-file-name (pop files) dir) nil t))) (and (get-buffer org-agenda-buffer-name) (kill-buffer org-agenda-buffer-name))))))) -- 1.7.2.5