From: Marcin Borkowski <mbork@mbork.pl>
To: Org-Mode mailing list <emacs-orgmode@gnu.org>
Subject: How to launch an agenda view programmatically?
Date: Wed, 19 Jul 2017 19:08:38 +0200 [thread overview]
Message-ID: <87tw2873s9.fsf@jane> (raw)
Hi all,
I have this in my init.el:
--8<---------------cut here---------------start------------->8---
(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\"")))))
--8<---------------cut here---------------end--------------->8---
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?
TIA,
--
Marcin Borkowski
next reply other threads:[~2017-07-19 17:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 17:08 Marcin Borkowski [this message]
2017-07-19 18:10 ` How to launch an agenda view programmatically? Marco Wahl
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tw2873s9.fsf@jane \
--to=mbork@mbork.pl \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.