unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* HowTo: directory-files and friends and case-insensitive match
@ 2016-02-06  3:40 raman
  2016-02-06  6:21 ` Marcin Borkowski
  2016-02-06  8:06 ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: raman @ 2016-02-06  3:40 UTC (permalink / raw)
  To: emacs-devel



At present there is no obvious means to make directory-files and friends
match files in a case-insensitive manner -- is there a trick I'm
missing, or is this a missing feature?


-- 



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

* Re: HowTo: directory-files and friends and case-insensitive match
  2016-02-06  3:40 HowTo: directory-files and friends and case-insensitive match raman
@ 2016-02-06  6:21 ` Marcin Borkowski
  2016-02-06  8:06 ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Marcin Borkowski @ 2016-02-06  6:21 UTC (permalink / raw)
  To: raman; +Cc: emacs-devel


On 2016-02-06, at 04:40, raman <raman@google.com> wrote:

> At present there is no obvious means to make directory-files and friends
> match files in a case-insensitive manner -- is there a trick I'm
> missing, or is this a missing feature?

I use abo-abo's Ivy, and it does that (among many other, useful things).

BTW, I have no idea how to turn it off. ;-)

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: HowTo: directory-files and friends and case-insensitive match
  2016-02-06  3:40 HowTo: directory-files and friends and case-insensitive match raman
  2016-02-06  6:21 ` Marcin Borkowski
@ 2016-02-06  8:06 ` Eli Zaretskii
  2016-02-06 16:07   ` raman
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2016-02-06  8:06 UTC (permalink / raw)
  To: raman; +Cc: emacs-devel

> From: raman <raman@google.com>
> Date: Fri, 05 Feb 2016 19:40:10 -0800
> 
> At present there is no obvious means to make directory-files and friends
> match files in a case-insensitive manner -- is there a trick I'm
> missing, or is this a missing feature?

What do you mean by "match files"?  directory-files doesn't match any
files, unless its 3rd argument is a regexp.  If you meant matching
against that regexp, then indeed currently you cannot specify
case-insensitive matches.  The matching is always case-insensitive on
MS-Windows, and always case-sensitive on all other platforms.

Technically, this is easy to change, but note the 2 fundamental
difficulties with doing that:

  . It is not clear which case mapping to use.  We have a case mapping
    set up for each buffer, but using that for file names sounds
    questionable.  We could set up a special case mapping for file
    names, but we need to figure out what language to base that on.
    (The MS-Windows code mentioned above uses a kludge which I don't
    think we should keep if we make this a user-visible feature.)

  . directory-files etc. should be able to (and do in practice) work
    with unibyte file names in certain situations.  Emacs doesn't know
    how to downcase unibyte characters.

So this is a small project, actually.  Volunteers are welcome.



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

* Re: HowTo: directory-files and friends and case-insensitive match
  2016-02-06  8:06 ` Eli Zaretskii
@ 2016-02-06 16:07   ` raman
  2016-02-07 17:46     ` John Wiegley
  0 siblings, 1 reply; 13+ messages in thread
From: raman @ 2016-02-06 16:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:
You understood the question correctly.

I'm specifically trying to match file extensions in a case insensitive
manner in this instance, so yes a somewhat more confined problem.  Given
the complexity I'll just go ahead and construct the regexp to match
lower and upper case.
>> From: raman <raman@google.com>
>> Date: Fri, 05 Feb 2016 19:40:10 -0800
>> 
>> At present there is no obvious means to make directory-files and friends
>> match files in a case-insensitive manner -- is there a trick I'm
>> missing, or is this a missing feature?
>
> What do you mean by "match files"?  directory-files doesn't match any
> files, unless its 3rd argument is a regexp.  If you meant matching
> against that regexp, then indeed currently you cannot specify
> case-insensitive matches.  The matching is always case-insensitive on
> MS-Windows, and always case-sensitive on all other platforms.
>
> Technically, this is easy to change, but note the 2 fundamental
> difficulties with doing that:
>
>   . It is not clear which case mapping to use.  We have a case mapping
>     set up for each buffer, but using that for file names sounds
>     questionable.  We could set up a special case mapping for file
>     names, but we need to figure out what language to base that on.
>     (The MS-Windows code mentioned above uses a kludge which I don't
>     think we should keep if we make this a user-visible feature.)
>
>   . directory-files etc. should be able to (and do in practice) work
>     with unibyte file names in certain situations.  Emacs doesn't know
>     how to downcase unibyte characters.
>
> So this is a small project, actually.  Volunteers are welcome.
>

-- 



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

* Re: HowTo: directory-files and friends and case-insensitive match
  2016-02-06 16:07   ` raman
@ 2016-02-07 17:46     ` John Wiegley
  2016-02-07 19:53       ` raman
  2016-02-08 14:06       ` Regexp matching (was: HowTo: directory-files and friends and case-insensitive match) Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: John Wiegley @ 2016-02-07 17:46 UTC (permalink / raw)
  To: raman; +Cc: Eli Zaretskii, emacs-devel

>>>>> raman  <raman@google.com> writes:

> I'm specifically trying to match file extensions in a case insensitive
> manner in this instance, so yes a somewhat more confined problem. Given the
> complexity I'll just go ahead and construct the regexp to match lower and
> upper case.

To make any variation on .jpeg:

    (directory-files DIR t "\\.[Jj][Pp][Ee]?[Gg]\\'")

You could write a helper function to "case insensitize" regexps, if one
doesn't already exist somewhere.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Re: HowTo: directory-files and friends and case-insensitive match
  2016-02-07 17:46     ` John Wiegley
@ 2016-02-07 19:53       ` raman
  2016-02-07 19:57         ` Eli Zaretskii
  2016-02-08 14:06       ` Regexp matching (was: HowTo: directory-files and friends and case-insensitive match) Stefan Monnier
  1 sibling, 1 reply; 13+ messages in thread
From: raman @ 2016-02-07 19:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

John Wiegley <jwiegley@gmail.com> writes:

As I said, I've implemented myself a solution and moved on. That said, I
do not entirely buy Eli's "this is a large problem that needs to be
solved first" argument -- if that were the case, variables like
completion-ignore-case and   read-file-name-completion-ignore-case would
not exist either -- but I digress ...>>>>>> raman  <raman@google.com> writes:
>
>> I'm specifically trying to match file extensions in a case insensitive
>> manner in this instance, so yes a somewhat more confined problem. Given the
>> complexity I'll just go ahead and construct the regexp to match lower and
>> upper case.
>
> To make any variation on .jpeg:
>
>     (directory-files DIR t "\\.[Jj][Pp][Ee]?[Gg]\\'")
>
> You could write a helper function to "case insensitize" regexps, if one
> doesn't already exist somewhere.

-- 



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

* Re: HowTo: directory-files and friends and case-insensitive match
  2016-02-07 19:53       ` raman
@ 2016-02-07 19:57         ` Eli Zaretskii
  2016-02-07 21:37           ` raman
  2016-02-07 22:15           ` John Wiegley
  0 siblings, 2 replies; 13+ messages in thread
From: Eli Zaretskii @ 2016-02-07 19:57 UTC (permalink / raw)
  To: raman; +Cc: emacs-devel

> From: raman <raman@google.com>
> Date: Sun, 07 Feb 2016 11:53:06 -0800
> Cc: emacs-devel@gnu.org
> 
> John Wiegley <jwiegley@gmail.com> writes:
> 
> As I said, I've implemented myself a solution and moved on. That said, I
> do not entirely buy Eli's "this is a large problem that needs to be
> solved first" argument -- if that were the case, variables like
> completion-ignore-case and   read-file-name-completion-ignore-case would
> not exist either

If you want me to resign from working on Emacs, just continue posting
such remarks.  Sooner or later, they will have effect.



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

* Re: HowTo: directory-files and friends and case-insensitive match
  2016-02-07 19:57         ` Eli Zaretskii
@ 2016-02-07 21:37           ` raman
  2016-02-07 22:15           ` John Wiegley
  1 sibling, 0 replies; 13+ messages in thread
From: raman @ 2016-02-07 21:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:
Likewise:-)
>> From: raman <raman@google.com>
>> Date: Sun, 07 Feb 2016 11:53:06 -0800
>> Cc: emacs-devel@gnu.org
>> 
>> John Wiegley <jwiegley@gmail.com> writes:
>> 
>> As I said, I've implemented myself a solution and moved on. That said, I
>> do not entirely buy Eli's "this is a large problem that needs to be
>> solved first" argument -- if that were the case, variables like
>> completion-ignore-case and   read-file-name-completion-ignore-case would
>> not exist either
>
> If you want me to resign from working on Emacs, just continue posting
> such remarks.  Sooner or later, they will have effect.

-- 



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

* Re: HowTo: directory-files and friends and case-insensitive match
  2016-02-07 19:57         ` Eli Zaretskii
  2016-02-07 21:37           ` raman
@ 2016-02-07 22:15           ` John Wiegley
  1 sibling, 0 replies; 13+ messages in thread
From: John Wiegley @ 2016-02-07 22:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel, raman

>>>>> Eli Zaretskii <eliz@gnu.org> writes:

> If you want me to resign from working on Emacs, just continue posting such
> remarks. Sooner or later, they will have effect.

I would certainly hope not!! If my e-mails can have an equal and countering
effect to the discouraging ones, let me know and I'll keep the balances
weighted in your favor. :)

Eli, Raman, I hope we can avoid discouragement and disparaging remarks. Not
everything has to be solved immediately, so please consider a coffee break to
relieve frustration, rather than sending e-mail that could distress the spirit
of much appreciated contributors on this list.

Our community is our life; Emacs doesn't maintain itself.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Regexp matching (was: HowTo: directory-files and friends and case-insensitive match)
  2016-02-07 17:46     ` John Wiegley
  2016-02-07 19:53       ` raman
@ 2016-02-08 14:06       ` Stefan Monnier
  2016-02-08 15:57         ` Regexp matching John Wiegley
  2016-02-08 16:21         ` Paul Eggert
  1 sibling, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2016-02-08 14:06 UTC (permalink / raw)
  To: emacs-devel

> To make any variation on .jpeg:

>     (directory-files DIR t "\\.[Jj][Pp][Ee]?[Gg]\\'")

> You could write a helper function to "case insensitize" regexps, if one
> doesn't already exist somewhere.

FWIW:

- We need to update/replace/rewrite our C-level regexp matching code.
- Most likely, along the way we may be able to add
  "compiled-regexp" objects.  Currently the regexp-compilation is done
  transparently, with a cache to avoid obvious performance issues;
  this works well in most cases, but offering access to compiled-regexps
  could open up a few more options.
- I'd love it if the new code could provide something like
  `make-regexp-case-insensitive'; either applied to the string-regexp or
  to the compiled-regexp, or maybe as an option to `regexp-compile'.


        Stefan




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

* Re: Regexp matching
  2016-02-08 14:06       ` Regexp matching (was: HowTo: directory-files and friends and case-insensitive match) Stefan Monnier
@ 2016-02-08 15:57         ` John Wiegley
  2016-02-08 16:21         ` Paul Eggert
  1 sibling, 0 replies; 13+ messages in thread
From: John Wiegley @ 2016-02-08 15:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

> - We need to update/replace/rewrite our C-level regexp matching code.
> - Most likely, along the way we may be able to add
>   "compiled-regexp" objects.  Currently the regexp-compilation is done
>   transparently, with a cache to avoid obvious performance issues;
>   this works well in most cases, but offering access to compiled-regexps
>   could open up a few more options.
> - I'd love it if the new code could provide something like
>   `make-regexp-case-insensitive'; either applied to the string-regexp or
>   to the compiled-regexp, or maybe as an option to `regexp-compile'.

Agreed on all points.  Perhaps we could abuse text properties for this, by
allowing regexps that can be enriched with properties like :case-insensitive t.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Re: Regexp matching
  2016-02-08 14:06       ` Regexp matching (was: HowTo: directory-files and friends and case-insensitive match) Stefan Monnier
  2016-02-08 15:57         ` Regexp matching John Wiegley
@ 2016-02-08 16:21         ` Paul Eggert
  2016-02-11 19:01           ` John Wiegley
  1 sibling, 1 reply; 13+ messages in thread
From: Paul Eggert @ 2016-02-08 16:21 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

On 02/08/2016 06:06 AM, Stefan Monnier wrote:
> - We need to update/replace/rewrite our C-level regexp matching code.

If I had time I'd scrap all the Emacs-specific stuff and restart it 
again from the gnulib copy, adding any Emacs-necessary features back.



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

* Re: Regexp matching
  2016-02-08 16:21         ` Paul Eggert
@ 2016-02-11 19:01           ` John Wiegley
  0 siblings, 0 replies; 13+ messages in thread
From: John Wiegley @ 2016-02-11 19:01 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Stefan Monnier, emacs-devel

>>>>> Paul Eggert <eggert@cs.ucla.edu> writes:

>> - We need to update/replace/rewrite our C-level regexp matching code.

> If I had time I'd scrap all the Emacs-specific stuff and restart it again
> from the gnulib copy, adding any Emacs-necessary features back.

I'd sort of love to see a rewrite of that code; any candidate commits on a
feature branch would be a welcome sight...

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

end of thread, other threads:[~2016-02-11 19:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-06  3:40 HowTo: directory-files and friends and case-insensitive match raman
2016-02-06  6:21 ` Marcin Borkowski
2016-02-06  8:06 ` Eli Zaretskii
2016-02-06 16:07   ` raman
2016-02-07 17:46     ` John Wiegley
2016-02-07 19:53       ` raman
2016-02-07 19:57         ` Eli Zaretskii
2016-02-07 21:37           ` raman
2016-02-07 22:15           ` John Wiegley
2016-02-08 14:06       ` Regexp matching (was: HowTo: directory-files and friends and case-insensitive match) Stefan Monnier
2016-02-08 15:57         ` Regexp matching John Wiegley
2016-02-08 16:21         ` Paul Eggert
2016-02-11 19:01           ` John Wiegley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).