emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Persistent filters in Org mode
@ 2010-05-06  4:21 Thomas Morgan
  2010-05-07  7:26 ` Carsten Dominik
  2010-05-20  7:40 ` Carsten Dominik
  0 siblings, 2 replies; 8+ messages in thread
From: Thomas Morgan @ 2010-05-06  4:21 UTC (permalink / raw)
  To: emacs-orgmode

Hello, Org mode hackers,

This patch defines a variable `org-agenda-persistent-filters'.
When it is set, filters persist from one agenda view to the next.

I've found this convenient when using tags for contexts like @home,
@net, etc., some of which commonly remain applicable for a while.

Thanks,
Thomas

From 052ef9205845c78cb24d6fea8f89484bbe12a528 Mon Sep 17 00:00:00 2001
From: Thomas Morgan <tlm@ziiuu.com>
Date: Fri, 23 Apr 2010 11:48:03 +0200
Subject: [PATCH] New option `org-agenda-persistent-filters'.
 When set, keep filters from one agenda view to the next.

---
 lisp/org-agenda.el |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 93ef921..c8fd731 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -197,6 +197,11 @@ you can \"misuse\" it to also add other text to the header.  However,
   :group 'org-export-html
   :type 'string)
 
+(defcustom org-agenda-persistent-filters nil
+  "When set, keep filters from one agenda view to the next."
+  :group 'org-agenda
+  :type 'boolean)
+
 (defgroup org-agenda-custom-commands nil
  "Options concerning agenda views in Org-mode."
  :tag "Org Agenda Custom Commands"
@@ -2713,7 +2718,8 @@ bind it in the options section.")
   (setq org-todo-keywords-for-agenda nil)
   (setq org-done-keywords-for-agenda nil)
   (setq org-drawers-for-agenda nil)
-  (setq org-agenda-filter nil)
+  (unless org-agenda-persistent-filters
+    (setq org-agenda-filter nil))
   (put 'org-agenda-filter :preset-filter org-agenda-filter-preset)
   (if org-agenda-multi
       (progn
@@ -2788,7 +2794,7 @@ bind it in the options section.")
 	  (org-habit-insert-consistency-graphs))
       (run-hooks 'org-finalize-agenda-hook)
       (setq org-agenda-type (org-get-at-bol 'org-agenda-type))
-      (when (get 'org-agenda-filter :preset-filter)
+      (when (or org-agenda-filter (get 'org-agenda-filter :preset-filter))
 	(org-agenda-filter-apply org-agenda-filter))
       )))
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Persistent filters in Org mode
  2010-05-06  4:21 Persistent filters in Org mode Thomas Morgan
@ 2010-05-07  7:26 ` Carsten Dominik
       [not found]   ` <CBB93A41-08A8-45A3-BC8D-DD2BCE3171BA@uva.nl>
  2010-05-20  7:40 ` Carsten Dominik
  1 sibling, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2010-05-07  7:26 UTC (permalink / raw)
  To: Thomas Morgan; +Cc: emacs-orgmode

Hi Thomas,

this sounds like a useful idea to me.
What happens if a user sets a preset filter with agenda custom command  
options?

Maybe there should be a command to set and clear this persistent filter?
Would you like to implement this in order to complete this feature?

- Carsten

On May 6, 2010, at 6:21 AM, Thomas Morgan wrote:

> Hello, Org mode hackers,
>
> This patch defines a variable `org-agenda-persistent-filters'.
> When it is set, filters persist from one agenda view to the next.
>
> I've found this convenient when using tags for contexts like @home,
> @net, etc., some of which commonly remain applicable for a while.
>
> Thanks,
> Thomas
>
> From 052ef9205845c78cb24d6fea8f89484bbe12a528 Mon Sep 17 00:00:00 2001
> From: Thomas Morgan <tlm@ziiuu.com>
> Date: Fri, 23 Apr 2010 11:48:03 +0200
> Subject: [PATCH] New option `org-agenda-persistent-filters'.
> When set, keep filters from one agenda view to the next.
>
> ---
> lisp/org-agenda.el |   10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 93ef921..c8fd731 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -197,6 +197,11 @@ you can \"misuse\" it to also add other text to  
> the header.  However,
>   :group 'org-export-html
>   :type 'string)
>
> +(defcustom org-agenda-persistent-filters nil
> +  "When set, keep filters from one agenda view to the next."
> +  :group 'org-agenda
> +  :type 'boolean)
> +
> (defgroup org-agenda-custom-commands nil
>  "Options concerning agenda views in Org-mode."
>  :tag "Org Agenda Custom Commands"
> @@ -2713,7 +2718,8 @@ bind it in the options section.")
>   (setq org-todo-keywords-for-agenda nil)
>   (setq org-done-keywords-for-agenda nil)
>   (setq org-drawers-for-agenda nil)
> -  (setq org-agenda-filter nil)
> +  (unless org-agenda-persistent-filters
> +    (setq org-agenda-filter nil))
>   (put 'org-agenda-filter :preset-filter org-agenda-filter-preset)
>   (if org-agenda-multi
>       (progn
> @@ -2788,7 +2794,7 @@ bind it in the options section.")
> 	  (org-habit-insert-consistency-graphs))
>       (run-hooks 'org-finalize-agenda-hook)
>       (setq org-agenda-type (org-get-at-bol 'org-agenda-type))
> -      (when (get 'org-agenda-filter :preset-filter)
> +      (when (or org-agenda-filter (get 'org-agenda-filter :preset- 
> filter))
> 	(org-agenda-filter-apply org-agenda-filter))
>       )))
>
> -- 
> 1.6.3.3
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Persistent filters in Org mode
       [not found]   ` <CBB93A41-08A8-45A3-BC8D-DD2BCE3171BA@uva.nl>
@ 2010-05-15 21:32     ` Thomas Morgan
  2010-05-19  9:46       ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Morgan @ 2010-05-15 21:32 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Hi, Carsten,

Thanks for your reply.  I've been thinking about this --
please forgive my lateness...

Do you envision a new variable for a persistent filter,
independent of `org-agenda-filter'?  As it stands, one can
only make `org-agenda-filter' persistent or transient by
toggling `org-agenda-persistent-filters'.  I've been leaving
this on all the time, because it fits my usage of tags.
Would it be useful to you and others, though, to keep
separate persistent and transient filters?

(Note on terminology: reviewing the manual just now I realized
that `org-agenda-persistent-filters' should probably be renamed
`org-agenda-persistent-filter', because adding a condition to
a filter results in a narrowed filter, not several filters.)

The main thing I am missing now is a command to edit the filter
in the minibuffer.  Or, if there's a separate persistent filter,
perhaps the command could edit that if given an argument.

It might also be useful to save filters to registers and restore
them later.

Best regards,
Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Persistent filters in Org mode
  2010-05-15 21:32     ` Thomas Morgan
@ 2010-05-19  9:46       ` Carsten Dominik
  2010-05-19 23:23         ` Thomas Morgan
  0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2010-05-19  9:46 UTC (permalink / raw)
  To: Thomas Morgan; +Cc: emacs-orgmode

Hi Thomas,

On May 15, 2010, at 11:32 PM, Thomas Morgan wrote:

> Hi, Carsten,
>
> Thanks for your reply.  I've been thinking about this --
> please forgive my lateness...
>
> Do you envision a new variable for a persistent filter,
> independent of `org-agenda-filter'?  As it stands, one can
> only make `org-agenda-filter' persistent or transient by
> toggling `org-agenda-persistent-filters'.  I've been leaving
> this on all the time, because it fits my usage of tags.
> Would it be useful to you and others, though, to keep
> separate persistent and transient filters?
>
> (Note on terminology: reviewing the manual just now I realized
> that `org-agenda-persistent-filters' should probably be renamed
> `org-agenda-persistent-filter', because adding a condition to
> a filter results in a narrowed filter, not several filters.)
>

Hmm, you are right, I was a bit confused and not really clear.

I had first thought that what you had built was to a persistent filter
that one would have to specicfy.  But now I see that all you did
was to not clear the filter when a new agenda command is run.

I think this is good - so if you agree, I will apply your patch
and rename the variable to ...persistent-filter

> The main thing I am missing now is a command to edit the filter
> in the minibuffer.  Or, if there's a separate persistent filter,
> perhaps the command could edit that if given an argument.
>
> It might also be useful to save filters to registers and restore
> them later.

I guess a command to edit the filter, and a dedicated history variable  
for that command would be good enough?  Would you like to make this  
command and send me a combined patch with both changes?

- Carsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Persistent filters in Org mode
  2010-05-19  9:46       ` Carsten Dominik
@ 2010-05-19 23:23         ` Thomas Morgan
  2010-05-20  7:40           ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Morgan @ 2010-05-19 23:23 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Hi, Carsten,

> I think this is good - so if you agree, I will apply your patch
> and rename the variable to ...persistent-filter

That would be great, thanks.

>> The main thing I am missing now is a command to edit the filter
>> in the minibuffer.  Or, if there's a separate persistent filter,
>> perhaps the command could edit that if given an argument.
>>
>> It might also be useful to save filters to registers and restore
>> them later.
>
> I guess a command to edit the filter, and a dedicated history variable
> for that command would be good enough?  Would you like to make this
> command and send me a combined patch with both changes?

Alternatively, what do you think of the idea of saving
a complete agenda view to a register (including the filter)?
The register would contain all the information necessary to
recreate the agenda view, and there would be a command to
restore it.

Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Persistent filters in Org mode
  2010-05-06  4:21 Persistent filters in Org mode Thomas Morgan
  2010-05-07  7:26 ` Carsten Dominik
@ 2010-05-20  7:40 ` Carsten Dominik
  1 sibling, 0 replies; 8+ messages in thread
From: Carsten Dominik @ 2010-05-20  7:40 UTC (permalink / raw)
  To: Thomas Morgan; +Cc: emacs-orgmode

Applied, thanks!

the variable is renamed to `org-agenda-persistent-filter'.

- Carsten

On May 6, 2010, at 6:21 AM, Thomas Morgan wrote:

> Hello, Org mode hackers,
>
> This patch defines a variable `org-agenda-persistent-filters'.
> When it is set, filters persist from one agenda view to the next.
>
> I've found this convenient when using tags for contexts like @home,
> @net, etc., some of which commonly remain applicable for a while.
>
> Thanks,
> Thomas
>
> From 052ef9205845c78cb24d6fea8f89484bbe12a528 Mon Sep 17 00:00:00 2001
> From: Thomas Morgan <tlm@ziiuu.com>
> Date: Fri, 23 Apr 2010 11:48:03 +0200
> Subject: [PATCH] New option `org-agenda-persistent-filters'.
> When set, keep filters from one agenda view to the next.
>
> ---
> lisp/org-agenda.el |   10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 93ef921..c8fd731 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -197,6 +197,11 @@ you can \"misuse\" it to also add other text to  
> the header.  However,
>   :group 'org-export-html
>   :type 'string)
>
> +(defcustom org-agenda-persistent-filters nil
> +  "When set, keep filters from one agenda view to the next."
> +  :group 'org-agenda
> +  :type 'boolean)
> +
> (defgroup org-agenda-custom-commands nil
>  "Options concerning agenda views in Org-mode."
>  :tag "Org Agenda Custom Commands"
> @@ -2713,7 +2718,8 @@ bind it in the options section.")
>   (setq org-todo-keywords-for-agenda nil)
>   (setq org-done-keywords-for-agenda nil)
>   (setq org-drawers-for-agenda nil)
> -  (setq org-agenda-filter nil)
> +  (unless org-agenda-persistent-filters
> +    (setq org-agenda-filter nil))
>   (put 'org-agenda-filter :preset-filter org-agenda-filter-preset)
>   (if org-agenda-multi
>       (progn
> @@ -2788,7 +2794,7 @@ bind it in the options section.")
> 	  (org-habit-insert-consistency-graphs))
>       (run-hooks 'org-finalize-agenda-hook)
>       (setq org-agenda-type (org-get-at-bol 'org-agenda-type))
> -      (when (get 'org-agenda-filter :preset-filter)
> +      (when (or org-agenda-filter (get 'org-agenda-filter :preset- 
> filter))
> 	(org-agenda-filter-apply org-agenda-filter))
>       )))
>
> -- 
> 1.6.3.3
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Persistent filters in Org mode
  2010-05-19 23:23         ` Thomas Morgan
@ 2010-05-20  7:40           ` Carsten Dominik
  2010-05-24  1:55             ` Samuel Wales
  0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2010-05-20  7:40 UTC (permalink / raw)
  To: Thomas Morgan; +Cc: emacs-orgmode


On May 20, 2010, at 1:23 AM, Thomas Morgan wrote:

> Hi, Carsten,
>
>> I think this is good - so if you agree, I will apply your patch
>> and rename the variable to ...persistent-filter
>
> That would be great, thanks.
>
>>> The main thing I am missing now is a command to edit the filter
>>> in the minibuffer.  Or, if there's a separate persistent filter,
>>> perhaps the command could edit that if given an argument.
>>>
>>> It might also be useful to save filters to registers and restore
>>> them later.
>>
>> I guess a command to edit the filter, and a dedicated history  
>> variable
>> for that command would be good enough?  Would you like to make this
>> command and send me a combined patch with both changes?
>
> Alternatively, what do you think of the idea of saving
> a complete agenda view to a register (including the filter)?
> The register would contain all the information necessary to
> recreate the agenda view, and there would be a command to
> restore it.

That might be nice!  Or a way to interactively create a view and then  
turn it into a custom command with one key...

- Carsten

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Persistent filters in Org mode
  2010-05-20  7:40           ` Carsten Dominik
@ 2010-05-24  1:55             ` Samuel Wales
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Wales @ 2010-05-24  1:55 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode, Thomas Morgan

On 2010-05-20, Carsten Dominik <dominik@uva.nl> wrote:
> That might be nice!  Or a way to interactively create a view and then
> turn it into a custom command with one key...

Have not followed this thread, so please take this with a grain of salt.

My understanding of filters is that they are for quick changes of
views.  As long as we are brainstorming about inclusion in views,
perhaps it would be wise to consider the possibility of changing
sorting strategy in whatever mechanism is developed.  Doing a search
to recreate the entire buffer only to do a different sorting strategy
can take a prohibitively long amount of time, just as is the case with
tag filtering; it might make sense to combine the basic functionality
for both cases.

Just a possibility.  :)

-- 
Q: How many CDC "scientists" does it take to change a lightbulb?
A: "You only think it's dark." [CDC has denied a deadly disease for 25 years]
==========
Retrovirus: http://www.wpinstitute.org/xmrv/index.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-05-24  1:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06  4:21 Persistent filters in Org mode Thomas Morgan
2010-05-07  7:26 ` Carsten Dominik
     [not found]   ` <CBB93A41-08A8-45A3-BC8D-DD2BCE3171BA@uva.nl>
2010-05-15 21:32     ` Thomas Morgan
2010-05-19  9:46       ` Carsten Dominik
2010-05-19 23:23         ` Thomas Morgan
2010-05-20  7:40           ` Carsten Dominik
2010-05-24  1:55             ` Samuel Wales
2010-05-20  7:40 ` Carsten Dominik

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).