emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Gustav Wikström" <gustav.erik@gmail.com>
To: Org Mode List <emacs-orgmode@gnu.org>
Subject: Filtering in org-agenda-filter-by-category
Date: Sun, 16 Jun 2013 23:42:26 +0200	[thread overview]
Message-ID: <CA+SyOP9hqDXAh4pMizXYdDeLdj+MQdoGa6m7rM7jPG8r-gVY5w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]

Dear list,

I'd like to propose an addition to the function
"org-agenda-filter-by-category"; that is, the function called when pushing
"<" in an agenda.

As some might know adding a C-u in front of the command filters away the
current category instead of only listing it solemnly. I've made a change in
my source to allow multiple categories to be filtered away, instead of the
current functionality where only one category could be removed at a time.
This allows for multiple categories to be removed from the agenda. Very
simple, very effective.

Maybe some kind person could look at this and incorporate in the source?

(defun org-agenda-filter-by-category (strip)
  "Keep only those lines in the agenda buffer that have a specific category.
The category is that of the current line."
  (interactive "P")
  (if org-agenda-filtered-by-category
      (org-agenda-filter-show-all-cat)
    (let ((cat (org-no-properties (get-text-property (point)
'org-category))))
      (cond
       ((and cat (not strip))
        (org-agenda-filter-apply
         (list (concat "+" cat)) 'category))
       ((and cat strip)
        (org-agenda-filter-apply
         (push (concat "-" cat) org-agenda-category-filter) 'category))
       ((error "No category at point"))))))

/Gustav

[-- Attachment #2: Type: text/html, Size: 2455 bytes --]

             reply	other threads:[~2013-06-16 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16 21:42 Gustav Wikström [this message]
2013-06-27 14:48 ` Filtering in org-agenda-filter-by-category Bastien
2013-06-27 15:22   ` Gustav Wikström
2013-06-27 15:45     ` Bastien

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=CA+SyOP9hqDXAh4pMizXYdDeLdj+MQdoGa6m7rM7jPG8r-gVY5w@mail.gmail.com \
    --to=gustav.erik@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).