From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [agenda] Case-insensitive tag search Date: Tue, 11 Oct 2011 08:22:15 +0200 Message-ID: <7DC4ED7B-7E74-48DD-B174-80F5AA62D812@gmail.com> References: <4619.1318294561@alphaville.dokosmarshall.org> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDVkk-0000aM-Cx for emacs-orgmode@gnu.org; Tue, 11 Oct 2011 02:23:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDVkj-0007KU-6u for emacs-orgmode@gnu.org; Tue, 11 Oct 2011 02:23:50 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:36651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDVki-0007KP-Rm for emacs-orgmode@gnu.org; Tue, 11 Oct 2011 02:23:49 -0400 Received: by eye4 with SMTP id 4so1587810eye.0 for ; Mon, 10 Oct 2011 23:23:47 -0700 (PDT) In-Reply-To: <4619.1318294561@alphaville.dokosmarshall.org> 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: nicholas.dokos@hp.com Cc: Org Mode , Marcelo de Moraes Serpa On 11.10.2011, at 02:56, Nick Dokos wrote: > suvayu ali wrote: >=20 >> Hi Marcelo, >>=20 >> On Mon, Oct 10, 2011 at 10:54 PM, Marcelo de Moraes Serpa >> 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 :) >>=20 >> 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. >>=20 >> 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. >>=20 >=20 > 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." =20 ;; 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))) =20 ;; 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=