From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marco Wahl Subject: Re: How to launch an agenda view programmatically? Date: Wed, 19 Jul 2017 20:10:24 +0200 Message-ID: <84mv802t7z.fsf@tm6592> References: <87tw2873s9.fsf@jane> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXtQp-00072Q-C8 for emacs-orgmode@gnu.org; Wed, 19 Jul 2017 14:10:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXtQm-0005Ze-4E for emacs-orgmode@gnu.org; Wed, 19 Jul 2017 14:10:43 -0400 Received: from [195.159.176.226] (port=60482 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXtQl-0005Yf-Sc for emacs-orgmode@gnu.org; Wed, 19 Jul 2017 14:10:40 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dXtQZ-0003uT-3u for emacs-orgmode@gnu.org; Wed, 19 Jul 2017 20:10:27 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hi! Marcin Borkowski 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