Re: [O] Agenda restrict to buffer

2012-07-12 Thread Bastien
Hi Andrea,

andrea crotti andrea.crott...@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



Re: [O] Agenda restrict to buffer

2012-07-12 Thread andrea crotti
2012/7/12 Bastien b...@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?



Re: [O] Agenda restrict to buffer

2012-07-12 Thread Bastien
andrea crotti andrea.crott...@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



[O] Agenda restrict to buffer

2012-07-11 Thread andrea crotti
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?