From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subhan Michael Tindall Subject: Re: Help: Saving Agenda Views Date: Thu, 5 Feb 2015 17:23:25 +0000 Message-ID: <4cc288dc6e7a40a99398b249a9fb2ce5@fcmailsvr3.familycareinc.org> References: <87pp9pbkrk.fsf@gmail.com> <87egq59xk5.fsf@gmail.com> <5e5ad53867dc4ff2b902b997f3405518@fcmailsvr3.familycareinc.org> <87bnl8two9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJQ9N-0005dO-QI for emacs-orgmode@gnu.org; Thu, 05 Feb 2015 12:23:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJQ9J-0006wS-Jp for emacs-orgmode@gnu.org; Thu, 05 Feb 2015 12:23:33 -0500 Received: from outbound.familycareinc.org ([207.170.205.147]:33345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJQ9J-0006wG-8J for emacs-orgmode@gnu.org; Thu, 05 Feb 2015 12:23:29 -0500 In-Reply-To: <87bnl8two9.fsf@gmail.com> Content-Language: en-US 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "'Tory S. Anderson'" Cc: orgmode list > -----Original Message----- > From: Tory S. Anderson [mailto:torys.anderson@gmail.com] > Sent: Thursday, February 05, 2015 3:39 AM > To: Subhan Michael Tindall > Cc: orgmode list > Subject: Re: [O] Help: Saving Agenda Views > = > THanks for the good tips and examples; I'll keep them handy. So, listing = the > org-agenda variables the one I want to edit is org-agenda filter; however, > changing this in my function does NOT change my agenda view the way it > should. Here's what I'm trying: > = > --8<---------------cut here---------------start------------->8--- > ;; saving views > (setq org-agenda-custom-commands > '(("c" "Class agendas" > ; ((agenda "" ((org-agenda-span 7) (org-agenda-tag-filter > "+LMC_6215"))))))) ;; No different results > ((agenda "" ((org-agenda-span 7) (org-agenda-tag-filter > '("+LMC_6215")))))))) ;; in the agenda, org-agenda-tag-filter remains nil= no > matter what --8<---------------cut here---------------end--------------->= 8--- > = > Why is `org-agenda-tag-filter` being ignored when `org-agenda-span` is > working? Hard to say, it appears org-agenda-tag-filter is an undocumented variable, = which I've never used. Glancing through the code it looks like an internal = variable that will likely have any externally set values overwritten You might try org-agenda-tag-filter-preset instead: (defvar org-agenda-tag-filter-preset nil) "A preset of the tags filter used for secondary agenda filtering. This must be a list of strings, each string must be a single tag preceded by \"+\" or \"-\". This variable should not be set directly, but agenda custom commands can bind it in the options section. The preset filter is a global property of the entire agenda view. In a block agenda, it will not work reliably to define a filter for one of the individual blocks. You need to set it in the global options and expect it to be applied to the entire view." Note that this will need to go in a different position syntactically to be = a global option for the view > = > Subhan Michael Tindall writes: > = > > Well, to start with your syntax is WAY off. Org custom agendas can be > pretty arcane. > > I'd start with setting up some custom agendas using the customizer, sav= ing > them, and then looking at how they are structured. > > Next, C-h v org-agenda TAB in an org buffer should get you a list of t= he > various settings you can use in a custom block. Note that not all variab= les are > valid in all types of blocks. > > And finally, take a look at the documentation for > > org-agenda-skip-function, as I believe this is what you will need to > > use to accomplish the goals you set below > > > > And, as a bonus, here's a snippet out of my emacs showing a couple of > different custom agendas with mulitiple blocks. > > ;;This one does a sorted list of all my TODOs, followed by an agenda > > block for 1 day ("D" "Todos+Clock" ((alltodo "" ((org-agenda-sticky nil) > > = (org-agenda-sorting-strategy (quote > ((agenda category-up todo-state-up deadline-up time-up)))))) > > (agenda ""= ((org-agenda-sticky nil) > > = (org-agenda-sorting-strategy (quote > ((agenda habit-down time-up priority-down category-keep)))) > > = (org-agenda-span 1) > > = (org-agenda-use-time-grid t) > > = (org-agenda-show-log (quote > clockcheck)) > > > > (org-agenda-clockreport nil))))) > > > > ;; this one does all todos of type RECURRING, then a tags search for > > everything with a STYLE property (tags does many things), followed by a= list > of all my todos using alltodo, using a skip function to screen out anythi= ng not > matching the regex , followed by a list of TODOs from a specific file (I = use > multiple project files for most things) ("R" "Recuring+Habits" > > > ((todo "RECURRING") > > > (tags "STYLE=3D{.+}") > > > (alltodo "" ( > > > (org-agenda-skip-function (lambda nil > (org-agenda-skip-entry-if > > > = > (quote notregexp) > "\\:LastWorked\\:"))) > > > (org-agenda-sticky nil) > > > (org-agenda-max-entries 10) > > > (org-agenda-clockreport nil) > > > (org-agenda-sorting-strategy (quote > ((todo tsia-down todo-state-up priority-down time-down) > > > = > ))))) > > > > > (agenda "my-todos" > > > ((org-agenda-files '("/my-todos.org")) > > > (org-agenda-span 1) > > > (org-agenda-clockreport nil) > > > )))) > > Hope this helps, there are not that many good complex agenda examples > > out there > > > > > >> -----Original Message----- > >> From: emacs-orgmode-bounces+subhant=3Dfamilycareinc.org@gnu.org > >> [mailto:emacs-orgmode-bounces+subhant=3Dfamilycareinc.org@gnu.org] > On > >> Behalf Of Tory S. Anderson > >> Sent: Wednesday, February 04, 2015 1:28 PM > >> To: orgmode list > >> Subject: Re: [O] Help: Saving Agenda Views > >> > >> 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 togeth= er > 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 (>=3D char ?0) (<=3D char ?9) > >> (setq n (if (=3D char ?0) 9 (- char ?0 1)) > >> tag (concat effort-op (nth n efforts)) > >> a (cons tag nil))) > >> (and (=3D 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 follow= ing > way: > >> > > >> > 1. Load agenda (default 1-day view) > >> > 2. / TAB "English_Class" (reduce to only entries tagged English_Clas= s) > >> > >> > 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? > > > > > > This message is intended for the sole use of the individual and entity = to > which it is addressed and may contain information that is privileged, > confidential and exempt from disclosure under applicable law. If you are = not > the intended addressee, nor authorized to receive for the intended > addressee, you are hereby notified that you may not use, copy, disclose or > distribute to anyone the message or any information contained in the > message. If you have received this message in error, please immediately > advise the sender by reply email and delete the message. Thank you. This message is intended for the sole use of the individual and entity to w= hich it is addressed and may contain information that is privileged, confid= ential and exempt from disclosure under applicable law. If you are not the = intended addressee, nor authorized to receive for the intended addressee, y= ou are hereby notified that you may not use, copy, disclose or distribute t= o anyone the message or any information contained in the message. If you ha= ve received this message in error, please immediately advise the sender by = reply email and delete the message. Thank you.