From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Agenda restrict to buffer Date: Thu, 12 Jul 2012 10:15:32 +0200 Message-ID: <87bojl1jkr.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpEY9-0007Mg-Q8 for emacs-orgmode@gnu.org; Thu, 12 Jul 2012 04:15:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpEY3-0007qH-2b for emacs-orgmode@gnu.org; Thu, 12 Jul 2012 04:15:01 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:34818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpEY2-0007qB-Rr for emacs-orgmode@gnu.org; Thu, 12 Jul 2012 04:14:55 -0400 Received: by weys10 with SMTP id s10so388981wey.0 for ; Thu, 12 Jul 2012 01:14:54 -0700 (PDT) In-Reply-To: (andrea crotti's message of "Wed, 11 Jul 2012 11:23:21 +0100") 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: andrea crotti Cc: emacs-orgmode@gnu.org Hi Andrea, andrea crotti writes: > I never quite understood how to pass arguments to org-agenda without > using it interactively.. > I want a simple thing, a command that shows the agenda with the TODO > entries from a given file > > So supposing the buffer "projects.org" is open I tried this: > > (defun my-org-agenda () > (interactive) > (switch-to-buffer (get-buffer "projects.org")) > (org-agenda :arg 'agenda :restriction '<)) (The `org-agenda' arguments are not lispy keywords arguments, which are currently discouraged in Emacs Lisp.) > which complains for > Wrong number of arguments: (lambda (&optional arg keys restriction) > "Dispatch agenda commands to collect entries to the agenda buffer. > > Any suggestions? (defun my-org-agenda-command () (interactive) (org-agenda-set-restriction-lock 'file) (org-agenda nil "%")) Note that you need to be in your .org file for this to work, so this isn't really suited for a global keybinding, only for org-mode-map. HTH, -- Bastien