emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Agenda restrict to buffer


From: Bastien
Subject: Re: [O] Agenda restrict to buffer
Date: Thu, 12 Jul 2012 10:15:32 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux)

Hi Andrea,

andrea crotti <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]