emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marco Wahl <marcowahlsoft@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to launch an agenda view programmatically?
Date: Wed, 19 Jul 2017 20:10:24 +0200	[thread overview]
Message-ID: <84mv802t7z.fsf@tm6592> (raw)
In-Reply-To: 87tw2873s9.fsf@jane

Hi!

Marcin Borkowski <mbork@mbork.pl> writes:

> Hi all,
>
> I have this in my init.el:
>
> (defun mbork/org-agenda-skip-if-parent-done-or-noagenda ()
>   "Return t if any of the parents of the current entry is a DONE
>   item, or there is a :noagenda: or :project: tag."
>   (save-excursion
>     (catch 'done
>       (when (or (member "noagenda" (org-get-tags-at))
> 		(member "project" (org-get-tags-at)))
> 	(throw 'done
> 	       (plist-get (cadr (org-element-context)) :contents-end)))
>       (while (org-up-heading-safe)
> 	(if (or (org-entry-is-done-p))
> 	    (throw 'done
> 		   (plist-get (cadr (org-element-context)) :contents-end)))))))
>
> (setq org-agenda-custom-commands
>       '(("n"
> 	 "Agenda, tasks, projects"
> 	 ((agenda "")
> 	  (alltodo "" ((org-agenda-skip-function #'mbork/org-agenda-skip-if-parent-done-or-noagenda)))
> 	  (tags "+project-TODO=\"DONE\"")))))
>
> Now instead of pressing C-c a n, I want to be able to launch my custom
> agenda command from Lisp.  How do I do that?

Isn't this just (org-agenda nil "n")?


Best regards
            Marco

      reply	other threads:[~2017-07-19 18:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 17:08 How to launch an agenda view programmatically? Marcin Borkowski
2017-07-19 18:10 ` Marco Wahl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84mv802t7z.fsf@tm6592 \
    --to=marcowahlsoft@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).