emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Agenda restrict to buffer
@ 2012-07-11 10:23 andrea crotti
  2012-07-12  8:15 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: andrea crotti @ 2012-07-11 10:23 UTC (permalink / raw)
  To: emacs-orgmode

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 '<))

which complains for
Wrong number of arguments: (lambda (&optional arg keys restriction)
"Dispatch agenda commands to collect entries to the agenda buffer.

Any suggestions?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Agenda restrict to buffer
  2012-07-11 10:23 Agenda restrict to buffer andrea crotti
@ 2012-07-12  8:15 ` Bastien
  2012-07-12 14:14   ` andrea crotti
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2012-07-12  8:15 UTC (permalink / raw)
  To: andrea crotti; +Cc: emacs-orgmode

Hi Andrea,

andrea crotti <andrea.crotti.0@gmail.com> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Agenda restrict to buffer
  2012-07-12  8:15 ` Bastien
@ 2012-07-12 14:14   ` andrea crotti
  2012-07-12 14:46     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: andrea crotti @ 2012-07-12 14:14 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

2012/7/12 Bastien <bzg@gnu.org>:
>
> (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


Nice thanks I'll give it a try..
I can maybe switch to the buffer automatically and run that, as I was
trying to do before.
Just for curiosity, why the lispy arguments are deprecated?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Agenda restrict to buffer
  2012-07-12 14:14   ` andrea crotti
@ 2012-07-12 14:46     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2012-07-12 14:46 UTC (permalink / raw)
  To: andrea crotti; +Cc: emacs-orgmode

andrea crotti <andrea.crotti.0@gmail.com> writes:

> Just for curiosity, why the lispy arguments are deprecated?

Not "deprecated", just "not recommended".

See http://lists.gnu.org/archive/html/emacs-devel/2003-08/msg00436.html
for a start.  Many heated discussions on the web about this.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-12 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-11 10:23 Agenda restrict to buffer andrea crotti
2012-07-12  8:15 ` Bastien
2012-07-12 14:14   ` andrea crotti
2012-07-12 14:46     ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).