emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to launch an agenda view programmatically?
@ 2017-07-19 17:08 Marcin Borkowski
  2017-07-19 18:10 ` Marco Wahl
  0 siblings, 1 reply; 2+ messages in thread
From: Marcin Borkowski @ 2017-07-19 17:08 UTC (permalink / raw)
  To: Org-Mode mailing list

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

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

end of thread, other threads:[~2017-07-19 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-19 17:08 How to launch an agenda view programmatically? Marcin Borkowski
2017-07-19 18:10 ` Marco Wahl

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