emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] How to launch an agenda view programmatically?


From: Marcin Borkowski
Subject: [O] How to launch an agenda view programmatically?
Date: Wed, 19 Jul 2017 19:08:38 +0200
User-agent: mu4e 0.9.19; emacs 26.0.50

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]