From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Borkowski Subject: How to launch an agenda view programmatically? Date: Wed, 19 Jul 2017 19:08:38 +0200 Message-ID: <87tw2873s9.fsf@jane> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXsT2-0004nu-Dx for emacs-orgmode@gnu.org; Wed, 19 Jul 2017 13:08:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXsSx-0003BR-Ea for emacs-orgmode@gnu.org; Wed, 19 Jul 2017 13:08:56 -0400 Received: from mail.mojserwer.eu ([195.110.48.8]:52945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXsSx-0003B8-8S for emacs-orgmode@gnu.org; Wed, 19 Jul 2017 13:08:51 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 9F490E69B8 for ; Wed, 19 Jul 2017 19:08:50 +0200 (CEST) Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wvw1t08s9K7u for ; Wed, 19 Jul 2017 19:08:45 +0200 (CEST) Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 54543E69AF for ; Wed, 19 Jul 2017 19:08:45 +0200 (CEST) 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: 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