From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Gustav_Wikstr=F6m?= Subject: Filtering in org-agenda-filter-by-category Date: Sun, 16 Jun 2013 23:42:26 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec5215eff23c0ad04df4c5b6e Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoKiU-0005dv-La for emacs-orgmode@gnu.org; Sun, 16 Jun 2013 17:42:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UoKiS-000374-06 for emacs-orgmode@gnu.org; Sun, 16 Jun 2013 17:42:30 -0400 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]:52513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoKiR-00036q-Pl for emacs-orgmode@gnu.org; Sun, 16 Jun 2013 17:42:27 -0400 Received: by mail-pa0-f46.google.com with SMTP id fa11so2226796pad.19 for ; Sun, 16 Jun 2013 14:42:26 -0700 (PDT) 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: Org Mode List --bcaec5215eff23c0ad04df4c5b6e Content-Type: text/plain; charset=ISO-8859-1 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 --bcaec5215eff23c0ad04df4c5b6e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Dear list,

I'd like to propos= e an addition to the function "org-agenda-filter-by-category"; th= at 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 s= olemnly. I've made a change in my source to allow multiple categories t= o be filtered away, instead of the current functionality where only one cat= egory 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 a= nd incorporate in the source?

(defun org-agenda-filter-by-category (st= rip)
=A0 "Keep only those lines = in the agenda buffer that have a specific category.
The category is that of the current line.&q= uot;
=A0 (interactive "P")<= /font>
=A0 (if org-agenda-f= iltered-by-category
= =A0 =A0 =A0 (org-agenda-filter-show-all-cat)
=A0 =A0 (let ((cat (org-no-prope= rties (get-text-property (point) 'org-category))))
=A0 =A0 =A0 (cond
=A0 =A0 =A0 =A0((and cat (not strip))
=A0 =A0 =A0 =A0 (org-agenda-filt= er-apply
=A0 =A0 =A0= =A0 =A0(list (concat "+" cat)) 'category))
= =A0 =A0 =A0 =A0((and cat strip)
=A0 =A0 =A0 =A0 (org-agenda-filt= er-apply
=A0 =A0 =A0= =A0 =A0(push (concat "-" cat) org-agenda-category-filter) 'c= ategory))
=A0 =A0 =A0 =A0((error "No = category at point"))))))

/Gustav
--bcaec5215eff23c0ad04df4c5b6e--