From 3c5a1b28106f6e8891576482e94a106188b9f571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Wed, 17 May 2023 08:55:40 -0700 Subject: emacs: add function for skipping by tag in org-agenda --- .emacs.local.d/lisp/packages/rul-org-agenda.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to '.emacs.local.d/lisp/packages') diff --git a/.emacs.local.d/lisp/packages/rul-org-agenda.el b/.emacs.local.d/lisp/packages/rul-org-agenda.el index 7a6e787..8122afb 100644 --- a/.emacs.local.d/lisp/packages/rul-org-agenda.el +++ b/.emacs.local.d/lisp/packages/rul-org-agenda.el @@ -365,6 +365,23 @@ as the default task." (defvar bh/organization-task-id "eb155a82-92b2-4f25-a3c6-0304591af2f9") +;; https://stackoverflow.com/a/10091330 +(defun zin/org-agenda-skip-tag (tag &optional others) + "Skip all entries that correspond to TAG. + +If OTHERS is true, skip all entries that do not correspond to TAG." + (let ((next-headline (save-excursion (or (outline-next-heading) (point-max)))) + (current-headline (or (and (org-at-heading-p) + (point)) + (save-excursion (org-back-to-heading))))) + (if others + (if (not (member tag (org-get-tags-at current-headline))) + next-headline + nil) + (if (member tag (org-get-tags-at current-headline)) + next-headline + nil)))) + (defun bh/clock-in-organization-task-as-default () (interactive) (org-with-point-at (org-id-find bh/organization-task-id 'marker) -- cgit v1.2.3