emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [agenda] Case-insensitive tag search
@ 2011-10-09  2:25 Marcelo de Moraes Serpa
  2011-10-10 15:48 ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-10-09  2:25 UTC (permalink / raw)
  To: Org Mode

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

Hey guys,

When I started using org, I used to tag everything with upper-case tags. It
just feels noisy now and I started tagging them in lower-case. The agenda
tag search (C-a m) makes that distinction, and I'd like to just search for
the tag string regardless of case. Is that possible to configure?

Thanks in advance,

- Marcelo.

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

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

* Re: [agenda] Case-insensitive tag search
  2011-10-09  2:25 [agenda] Case-insensitive tag search Marcelo de Moraes Serpa
@ 2011-10-10 15:48 ` Marcelo de Moraes Serpa
  2011-10-10 19:16   ` Carsten Dominik
  0 siblings, 1 reply; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-10-10 15:48 UTC (permalink / raw)
  To: Org Mode

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

*bump*... anyone ? :)

On Sat, Oct 8, 2011 at 9:25 PM, Marcelo de Moraes Serpa <celoserpa@gmail.com
> wrote:

> Hey guys,
>
> When I started using org, I used to tag everything with upper-case tags. It
> just feels noisy now and I started tagging them in lower-case. The agenda
> tag search (C-a m) makes that distinction, and I'd like to just search for
> the tag string regardless of case. Is that possible to configure?
>
> Thanks in advance,
>
> - Marcelo.
>

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

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

* Re: [agenda] Case-insensitive tag search
  2011-10-10 15:48 ` Marcelo de Moraes Serpa
@ 2011-10-10 19:16   ` Carsten Dominik
  2011-10-10 20:54     ` Marcelo de Moraes Serpa
  0 siblings, 1 reply; 9+ messages in thread
From: Carsten Dominik @ 2011-10-10 19:16 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode


On 10.10.2011, at 17:48, Marcelo de Moraes Serpa wrote:

> *bump*... anyone ? :)
> 
> On Sat, Oct 8, 2011 at 9:25 PM, Marcelo de Moraes Serpa <celoserpa@gmail.com> wrote:
> Hey guys,
> 
> When I started using org, I used to tag everything with upper-case tags. It just feels noisy now and I started tagging them in lower-case. The agenda tag search (C-a m) makes that distinction, and I'd like to just search for the tag string regardless of case. Is that possible to configure?

No.

- Carsten

> 
> Thanks in advance,
> 
> - Marcelo.
> 

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

* Re: [agenda] Case-insensitive tag search
  2011-10-10 19:16   ` Carsten Dominik
@ 2011-10-10 20:54     ` Marcelo de Moraes Serpa
  2011-10-10 22:20       ` suvayu ali
  0 siblings, 1 reply; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-10-10 20:54 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org Mode

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

@Carsten Thank you for the reply.

Would it be hard to add such feature, considering I'm just beginning with
elisp? Might be a candidate for my first patch to orgmode :)

Thanks,

- M

On Mon, Oct 10, 2011 at 2:16 PM, Carsten Dominik
<carsten.dominik@gmail.com>wrote:

>
> On 10.10.2011, at 17:48, Marcelo de Moraes Serpa wrote:
>
> > *bump*... anyone ? :)
> >
> > On Sat, Oct 8, 2011 at 9:25 PM, Marcelo de Moraes Serpa <
> celoserpa@gmail.com> wrote:
> > Hey guys,
> >
> > When I started using org, I used to tag everything with upper-case tags.
> It just feels noisy now and I started tagging them in lower-case. The agenda
> tag search (C-a m) makes that distinction, and I'd like to just search for
> the tag string regardless of case. Is that possible to configure?
>
> No.
>
> - Carsten
>
> >
> > Thanks in advance,
> >
> > - Marcelo.
> >
>
>

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

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

* Re: [agenda] Case-insensitive tag search
  2011-10-10 20:54     ` Marcelo de Moraes Serpa
@ 2011-10-10 22:20       ` suvayu ali
  2011-10-11  0:42         ` Marcelo de Moraes Serpa
  2011-10-11  0:56         ` Nick Dokos
  0 siblings, 2 replies; 9+ messages in thread
From: suvayu ali @ 2011-10-10 22:20 UTC (permalink / raw)
  To: Marcelo de Moraes Serpa; +Cc: Org Mode, Carsten Dominik

Hi Marcelo,

On Mon, Oct 10, 2011 at 10:54 PM, Marcelo de Moraes Serpa
<celoserpa@gmail.com> wrote:
> Would it be hard to add such feature, considering I'm just beginning with
> elisp? Might be a candidate for my first patch to orgmode :)

Since you mention lisp, I think you can have an easy solution with a
custom agenda command. As far as I can see there could be two
possibilities, bind `case-fold-search' to t or `downcase' your search
query before performing a regular tags search.

I haven't looked at any code before making these suggestions. So you
will have to figure out which, if any at all, is viable.

HF

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: [agenda] Case-insensitive tag search
  2011-10-10 22:20       ` suvayu ali
@ 2011-10-11  0:42         ` Marcelo de Moraes Serpa
  2011-10-11  0:56         ` Nick Dokos
  1 sibling, 0 replies; 9+ messages in thread
From: Marcelo de Moraes Serpa @ 2011-10-11  0:42 UTC (permalink / raw)
  To: suvayu ali; +Cc: Org Mode, Carsten Dominik

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

Thanks Suvayu, I'll play with it.

- Marcelo.

On Mon, Oct 10, 2011 at 5:20 PM, suvayu ali <fatkasuvayu+linux@gmail.com>wrote:

> Hi Marcelo,
>
> On Mon, Oct 10, 2011 at 10:54 PM, Marcelo de Moraes Serpa
> <celoserpa@gmail.com> wrote:
> > Would it be hard to add such feature, considering I'm just beginning with
> > elisp? Might be a candidate for my first patch to orgmode :)
>
> Since you mention lisp, I think you can have an easy solution with a
> custom agenda command. As far as I can see there could be two
> possibilities, bind `case-fold-search' to t or `downcase' your search
> query before performing a regular tags search.
>
> I haven't looked at any code before making these suggestions. So you
> will have to figure out which, if any at all, is viable.
>
> HF
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
>

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

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

* Re: [agenda] Case-insensitive tag search
  2011-10-10 22:20       ` suvayu ali
  2011-10-11  0:42         ` Marcelo de Moraes Serpa
@ 2011-10-11  0:56         ` Nick Dokos
  2011-10-11  6:22           ` Carsten Dominik
  1 sibling, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2011-10-11  0:56 UTC (permalink / raw)
  To: suvayu ali
  Cc: nicholas.dokos, Org Mode, Marcelo de Moraes Serpa,
	Carsten Dominik

suvayu ali <fatkasuvayu+linux@gmail.com> wrote:

> Hi Marcelo,
> 
> On Mon, Oct 10, 2011 at 10:54 PM, Marcelo de Moraes Serpa
> <celoserpa@gmail.com> wrote:
> > Would it be hard to add such feature, considering I'm just beginning with
> > elisp? Might be a candidate for my first patch to orgmode :)
> 
> Since you mention lisp, I think you can have an easy solution with a
> custom agenda command. As far as I can see there could be two
> possibilities, bind `case-fold-search' to t or `downcase' your search
> query before performing a regular tags search.
> 
> I haven't looked at any code before making these suggestions. So you
> will have to figure out which, if any at all, is viable.
> 

My first thought was advising the function as above but it didn't work
when I tried it, so I did look at the code: org-tags-view calls
org-scan-tags which sets case-fold-search to nil unconditionally, hence
the advice failure (I think). But I also tried to set it to t (in a git
branch) and that too did not work for me - I gave up at that point
(however, I didn't try very hard so it is quite conceivable that I
misunderstood the code or did something wrong.)

Nick

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

* Re: [agenda] Case-insensitive tag search
  2011-10-11  0:56         ` Nick Dokos
@ 2011-10-11  6:22           ` Carsten Dominik
  2011-10-11  7:39             ` Christian Moe
  0 siblings, 1 reply; 9+ messages in thread
From: Carsten Dominik @ 2011-10-11  6:22 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Org Mode, Marcelo de Moraes Serpa


On 11.10.2011, at 02:56, Nick Dokos wrote:

> suvayu ali <fatkasuvayu+linux@gmail.com> wrote:
> 
>> Hi Marcelo,
>> 
>> On Mon, Oct 10, 2011 at 10:54 PM, Marcelo de Moraes Serpa
>> <celoserpa@gmail.com> wrote:
>>> Would it be hard to add such feature, considering I'm just beginning with
>>> elisp? Might be a candidate for my first patch to orgmode :)
>> 
>> Since you mention lisp, I think you can have an easy solution with a
>> custom agenda command. As far as I can see there could be two
>> possibilities, bind `case-fold-search' to t or `downcase' your search
>> query before performing a regular tags search.
>> 
>> I haven't looked at any code before making these suggestions. So you
>> will have to figure out which, if any at all, is viable.
>> 
> 
> My first thought was advising the function as above but it didn't work
> when I tried it, so I did look at the code: org-tags-view calls
> org-scan-tags which sets case-fold-search to nil unconditionally, hence
> the advice failure (I think). But I also tried to set it to t (in a git
> branch) and that too did not work for me - I gave up at that point
> (however, I didn't try very hard so it is quite conceivable that I
> misunderstood the code or did something wrong.)

Matching tags in the scanner is not using search (which would
be influenced by case-fold-search).  Instead, it uses
membership tests, which is case-insensitive.

Here is a patch which does make this match case-insensitive.
-----------------------------------------------------------------------
Changes at master
	Modified lisp/org.el
diff --git a/lisp/org.el b/lisp/org.el
index b26e1a3..083e7dd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12656,7 +12656,9 @@ only lines with a TODO keyword are included in the output."
 
 		 ;; eval matcher only when the todo condition is OK
 		 (and (or (not todo-only) (member todo org-not-done-keywords))
-		      (let ((case-fold-search t)) (eval matcher)))
+		      (let ((case-fold-search t)
+			    (tags-list (mapcar 'downcase tags-list)))
+			(eval matcher)))
 
 		 ;; Call the skipper, but return t if it does not skip,
 		 ;; so that the `and' form continues evaluating


-----------------------------------------------------------------------

However, tags are treated case-sensitively also by the functions
setting tags. For example, if an entry has the tag :aa:, you
can still set a tag :Aa:. To be on the safe side, my suggestion
would be to apply a function to your files which would
downcase all the tags present in the buffer.

Marcelo, maybe this is a nice task to try your elisp on?
With perl, it would be a one-liner....

- Carsten

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

* Re: [agenda] Case-insensitive tag search
  2011-10-11  6:22           ` Carsten Dominik
@ 2011-10-11  7:39             ` Christian Moe
  0 siblings, 0 replies; 9+ messages in thread
From: Christian Moe @ 2011-10-11  7:39 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: nicholas.dokos, Org Mode, Marcelo de Moraes Serpa

On 10/11/11 8:22 AM, Carsten Dominik wrote:
> (...) To be on the safe side, my suggestion
> would be to apply a function to your files which would
> downcase all the tags present in the buffer.
>
> Marcelo, maybe this is a nice task to try your elisp on?
> With perl, it would be a one-liner....

I have one... but I won't spoil Marcelo's fun if he wants to write his 
own; it was indeed a nice task!

:)

Christian

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

end of thread, other threads:[~2011-10-11  7:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-09  2:25 [agenda] Case-insensitive tag search Marcelo de Moraes Serpa
2011-10-10 15:48 ` Marcelo de Moraes Serpa
2011-10-10 19:16   ` Carsten Dominik
2011-10-10 20:54     ` Marcelo de Moraes Serpa
2011-10-10 22:20       ` suvayu ali
2011-10-11  0:42         ` Marcelo de Moraes Serpa
2011-10-11  0:56         ` Nick Dokos
2011-10-11  6:22           ` Carsten Dominik
2011-10-11  7:39             ` Christian Moe

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