From: torys.anderson@gmail.com (Tory S. Anderson)
To: orgmode list <emacs-orgmode@gnu.org>
Subject: Re: Help: Saving Agenda Views
Date: Wed, 04 Feb 2015 16:27:54 -0500 [thread overview]
Message-ID: <87egq59xk5.fsf@gmail.com> (raw)
In-Reply-To: <87pp9pbkrk.fsf@gmail.com> (Tory S. Anderson's message of "Wed, 04 Feb 2015 13:21:19 -0500")
Okay, I've attempted to use my newbie elisp skills to hack together a solution but it doesn't work, yelling at me about wrong number of arguments (why?). Here's what I've put together (clearly inspired by the `org-agenda-filter-by-tag` function). Can anyone help me piece together what's wrong here?
--8<---------------cut here---------------start------------->8---
;; saving views
(setq org-agenda-custom-commands
'(("x" agenda)
("y" agenda*)
("c" "Class agendas"
((agenda "" ((org-agenda-span 7)))
(my-org-agenda-filter-by-tag "LMC_6215" "-"))
;;(org-agenda-filter-apply "+LMC_6215" "tag") ;; This one doesn't work because I can't see what "tag" should be
;; (org-agenda-redo)) ;; would be needed after org-agenda-filter-apply
)
))
;; For my usage
(defun my-org-agenda-filter-by-tag (tag char)
"A non-interactive version for use in custom commands. Keep only
those lines in the agenda buffer that have a specific tag. Char should be +
or -, filtering or narrowing."
; (interactive "P")
(let* ((alist org-tag-alist-for-agenda)
(tag-chars (mapconcat
(lambda (x) (if (and (not (symbolp (car x)))
(cdr x))
(char-to-string (cdr x))
""))
alist ""))
(efforts (org-split-string
(or (cdr (assoc (concat org-effort-property "_ALL")
org-global-properties))
"0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00"
"")))
(effort-op org-agenda-filter-effort-default-operator)
(effort-prompt "")
(inhibit-read-only t)
(current org-agenda-tag-filter)
maybe-refresh a n tag)
(when (member char '(?+ ?-))
;; Narrowing down
(cond ((equal char ?-) (setq strip t narrow t))
((equal char ?+) (setq strip nil narrow t))))
(cond
((equal char ?/)
(org-agenda-filter-show-all-tag)
(when (get 'org-agenda-tag-filter :preset-filter)
(org-agenda-filter-apply org-agenda-tag-filter 'tag))
(setq maybe-refresh t))
((equal char ?. )
(setq org-agenda-tag-filter
(mapcar (lambda(tag) (concat "+" tag))
(org-get-at-bol 'tags)))
(org-agenda-filter-apply org-agenda-tag-filter 'tag)
(setq maybe-refresh t))
((or (equal char ?\ )
(setq a (rassoc char alist))
(and (>= char ?0) (<= char ?9)
(setq n (if (= char ?0) 9 (- char ?0 1))
tag (concat effort-op (nth n efforts))
a (cons tag nil)))
(and (= char ??)
(setq tag "?eff")
a (cons tag nil))
(and tag (setq a (cons tag nil))))
(org-agenda-filter-show-all-tag)
(setq tag (car a))
(setq org-agenda-tag-filter
(cons (concat (if strip "-" "+") tag)
(if narrow current nil)))
(org-agenda-filter-apply org-agenda-tag-filter 'tag)
(setq maybe-refresh t))
(t (error "Invalid tag selection character %c" char)))
(when maybe-refresh
(org-agenda-redo))))
--8<---------------cut here---------------end--------------->8---
torys.anderson@gmail.com (Tory S. Anderson) writes:
> I'm trying to save an agenda view that I can arrive at in the following way:
>
> 1. Load agenda (default 1-day view)
> 2. / TAB "English_Class" (reduce to only entries tagged English_Class)
> 3. \ - TAB "schedule" (further reduce by removing entries having a :schedule tag)
> 4. w (load a 7-day span, week-view)
>
> However, I've been unable to grok the directions at http://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html
>
> The closest I've come is this:
>
> --8<---------------cut here---------------start------------->8---
> (setq org-agenda-custom-commands
> '(("c" "Class agendas" agenda ""
> ((org-agenda-tag-filter '("+LMC_6215"))
> (org-agenda-span 7)))))
> --8<---------------cut here---------------end--------------->8---
>
> But while this successfully sets the span, it fails to filter the buffer (let alone getting to my second filter). Where am I going wrong?
next prev parent reply other threads:[~2015-02-04 21:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-04 18:21 Help: Saving Agenda Views Tory S. Anderson
2015-02-04 21:27 ` Tory S. Anderson [this message]
2015-02-04 22:40 ` Subhan Michael Tindall
2015-02-05 11:39 ` Tory S. Anderson
2015-02-05 17:23 ` Subhan Michael Tindall
2015-02-05 23:14 ` Tory S. Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87egq59xk5.fsf@gmail.com \
--to=torys.anderson@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).