From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Gustav_Wikstr=F6m?= Subject: Re: Filtering in org-agenda-filter-by-category Date: Thu, 27 Jun 2013 17:22:17 +0200 Message-ID: References: <87a9mboarm.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=e89a8ff1c81cdaebe304e0245320 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsE1d-0005fl-OB for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 11:22:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsE1a-0007mQ-HB for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 11:22:21 -0400 In-Reply-To: <87a9mboarm.fsf@bzg.ath.cx> 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: Bastien Cc: Org Mode List --e89a8ff1c81cdaebe304e0245320 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Oh, ok. Didn't realize. I did the change a long time ago in my private installation. One difference in my version is the visibility of the filter in the mode-line though. Doing C-u < multiple times adds every removed category to the display in the mode-line. I updated to 8.0.3 recently and did some changes to "my" version to correspond to the evolution in the main repository. Here comes an updated version: (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 (and org-agenda-filtered-by-category org-agenda-category-filter) (org-agenda-filter-show-all-cat) (let ((cat (org-no-properties (get-text-property (point) 'org-category)= ))) (cond ((and cat strip) (org-agenda-filter-apply (push (concat "-" cat) org-agenda-category-filter) 'category)) ((and cat) (org-agenda-filter-apply (setq org-agenda-category-filter (list (concat "+" cat))) 'category)) ((error "No category at point")))))) I also attached a diff between the above and the code in 8.0.3. Regards Gustav On Thu, Jun 27, 2013 at 4:48 PM, Bastien wrote: > > Hi Gustav, > > (please use plain text when posting code, other the code snippet > is often mangled and not readable... thanks!) > > Gustav Wikstr=F6m writes: > > > I'd like to propose an addition to the function > > "org-agenda-filter-by-category"; that is, the function called when push= ing > > "<" in an agenda. > > > > As some might know adding a C-u in front of the command filters away th= e > > current category instead of only listing it solemnly. I've made a chang= e 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 tim= e. > > Using C-u < multiple times to exclude entries from multiple categories > works here. What version of Org are you using (M-x org-version RET)? > > Thanks, > > -- > Bastien --e89a8ff1c81cdaebe304e0245320 Content-Type: text/plain; charset=US-ASCII; name="diff.txt" Content-Disposition: attachment; filename="diff.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hig3o3ol0 ZGlmZiAtLWdpdCBhL2xpc3Avb3JnLWFnZW5kYS5lbCBiL2xpc3Avb3JnLWFnZW5kYS5lbAppbmRl eCBmZTJjNzQzLi5lMWZjNGVjIDEwMDY0NAotLS0gYS9saXNwL29yZy1hZ2VuZGEuZWwKKysrIGIv bGlzcC9vcmctYWdlbmRhLmVsCkBAIC03MzA3LDEyICs3MzA3LDE1IEBAIFRoZSBjYXRlZ29yeSBp cyB0aGF0IG9mIHRoZSBjdXJyZW50IGxpbmUuIgogCSAgIG9yZy1hZ2VuZGEtY2F0ZWdvcnktZmls dGVyKQogICAgICAgKG9yZy1hZ2VuZGEtZmlsdGVyLXNob3ctYWxsLWNhdCkKICAgICAobGV0ICgo Y2F0IChvcmctbm8tcHJvcGVydGllcyAoZ2V0LXRleHQtcHJvcGVydHkgKHBvaW50KSAnb3JnLWNh dGVnb3J5KSkpKQotICAgICAgKGlmIChhbmQgY2F0IChub3QgKHN0cmluZz0gIiIgY2F0KSkpCi0J ICAob3JnLWFnZW5kYS1maWx0ZXItYXBwbHkKLQkgICAoc2V0cSBvcmctYWdlbmRhLWNhdGVnb3J5 LWZpbHRlcgotCQkgKGxpc3QgKGNvbmNhdCAoaWYgc3RyaXAgIi0iICIrIikgY2F0KSkpCi0JICAg J2NhdGVnb3J5KQotCShlcnJvciAiTm8gY2F0ZWdvcnkgYXQgcG9pbnQiKSkpKSkKKyAgICAgIChj b25kCisgICAgICAgKChhbmQgY2F0IHN0cmlwKQorICAgICAgICAob3JnLWFnZW5kYS1maWx0ZXIt YXBwbHkKKyAgICAgICAgIChwdXNoIChjb25jYXQgIi0iIGNhdCkgb3JnLWFnZW5kYS1jYXRlZ29y eS1maWx0ZXIpICdjYXRlZ29yeSkpCisgICAgICAgKChhbmQgY2F0KQorICAgICAgICAob3JnLWFn ZW5kYS1maWx0ZXItYXBwbHkKKyAgICAgICAgIChzZXRxIG9yZy1hZ2VuZGEtY2F0ZWdvcnktZmls dGVyCisJICAgICAgIChsaXN0IChjb25jYXQgIisiIGNhdCkpKSAnY2F0ZWdvcnkpKQorICAgICAg ICgoZXJyb3IgIk5vIGNhdGVnb3J5IGF0IHBvaW50IikpKSkpKQogCiAoZGVmdW4gb3JnLWZpbmQt dG9wLWhlYWRsaW5lICgmb3B0aW9uYWwgcG9zKQogICAiRmluZCB0aGUgdG9wbW9zdCBwYXJlbnQg aGVhZGxpbmUgYW5kIHJldHVybiBpdC4iCg== --e89a8ff1c81cdaebe304e0245320--