all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* completion-ignored-extensions: match full file names
@ 2011-01-14  0:54 David Reitter
  2011-01-14  1:51 ` Eli Zaretskii
  2011-01-14  2:53 ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: David Reitter @ 2011-01-14  0:54 UTC (permalink / raw)
  To: Emacs-Devel devel

After much searching, I finally figured out why completion did not work for in a specific, often-used case.

I gave several git repositories a ".git" ending in order to comply with the requirements of a program that comes with git (GitX).  One repository in the same directory does not have the ".git" extension.

Completion always choose the one directory without the extension, because `completion-ignored-extensions' contains ".git/".  So, matching ".git/" is a bit too general - I'd rather match something like "^\.git" in order to just exclude the internal ".git" directories.  Is that possible, and if not, would be it easy to realize?




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

* Re: completion-ignored-extensions: match full file names
  2011-01-14  0:54 completion-ignored-extensions: match full file names David Reitter
@ 2011-01-14  1:51 ` Eli Zaretskii
  2011-01-14  2:00   ` David Reitter
  2011-01-14 15:26   ` Stefan Monnier
  2011-01-14  2:53 ` Stefan Monnier
  1 sibling, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2011-01-14  1:51 UTC (permalink / raw)
  To: David Reitter; +Cc: emacs-devel

> From: David Reitter <david.reitter@gmail.com>
> Date: Thu, 13 Jan 2011 19:54:49 -0500
> 
> I gave several git repositories a ".git" ending in order to comply with the requirements of a program that comes with git (GitX).  One repository in the same directory does not have the ".git" extension.
> 
> Completion always choose the one directory without the extension, because `completion-ignored-extensions' contains ".git/".  So, matching ".git/" is a bit too general - I'd rather match something like "^\.git" in order to just exclude the internal ".git" directories.  Is that possible, and if not, would be it easy to realize?

Each element of completion-ignored-extensions is matched at the _end_
of the file/directory name of the completion candidates.  So I think
currently what you want is not possible.

Using regexp syntax is not a good idea, IMO, since that would require
to rewrite all the customizations users out there have, to escape the
dot.  But I think we could make a change whereby if an element of
completion-ignored-extensions begins with a slash, that means match at
the beginning.  Then we could have "/.git/" as an element, and that
would ignore only the standard ".git" subdirectories, not any
directory that happens to end in ".git".

WDYT?



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

* Re: completion-ignored-extensions: match full file names
  2011-01-14  1:51 ` Eli Zaretskii
@ 2011-01-14  2:00   ` David Reitter
  2011-01-14  2:50     ` Eli Zaretskii
  2011-01-14 15:26   ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: David Reitter @ 2011-01-14  2:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Jan 13, 2011, at 8:51 PM, Eli Zaretskii wrote:
>  But I think we could make a change whereby if an element of
> completion-ignored-extensions begins with a slash, that means match at
> the beginning.  Then we could have "/.git/" as an element, and that
> would ignore only the standard ".git" subdirectories, not any
> directory that happens to end in ".git".

Yes.  I originally thought of "^.git" to mirror regexps, but not to implement regexps for the reason you state.

I like your idea better, given that it really isn't a regexp.

The only (minor) issue I see is the name of the customization variable - at that point, the string no longer represents an extension of the file name.  Perhaps we'd argue that it's an extension (suffix) of the whole path name.

We might want to go through the default set of extension and update it.  "/.bzr/", for instance, and the other VCS directories. 

BTW, this functionality as well as the Emacs 23 completion mechanism are very well conceived and quite useful!




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

* Re: completion-ignored-extensions: match full file names
  2011-01-14  2:00   ` David Reitter
@ 2011-01-14  2:50     ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2011-01-14  2:50 UTC (permalink / raw)
  To: David Reitter; +Cc: emacs-devel

> From: David Reitter <david.reitter@gmail.com>
> Date: Thu, 13 Jan 2011 21:00:57 -0500
> Cc: emacs-devel@gnu.org
> 
> The only (minor) issue I see is the name of the customization variable - at that point, the string no longer represents an extension of the file name.

Neither is ".git/" with the trailing slash.  So we are already
extending the notion of ``extension'' here.  I see no harm in
extending it some more.  If adequately documented, this won't be a
problem, especially since it stays out of user's way unless
deliberately used for this particular purpose.



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

* Re: completion-ignored-extensions: match full file names
  2011-01-14  0:54 completion-ignored-extensions: match full file names David Reitter
  2011-01-14  1:51 ` Eli Zaretskii
@ 2011-01-14  2:53 ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2011-01-14  2:53 UTC (permalink / raw)
  To: David Reitter; +Cc: Emacs-Devel devel

> Completion always choose the one directory without the extension, because
> completion-ignored-extensions' contains ".git/".  So, matching ".git/"
> is a bit too general - I'd rather match something like "^\.git" in order to
> just exclude the internal ".git" directories.  Is that possible, and if not,
> would be it easy to realize?

Currently completion-ignored-extensions contains a list of strings and
can't specify regexps.  Patches to make it possible to use regexps would
be welcome (probably via some other variables).


        Stefan



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

* Re: completion-ignored-extensions: match full file names
  2011-01-14  1:51 ` Eli Zaretskii
  2011-01-14  2:00   ` David Reitter
@ 2011-01-14 15:26   ` Stefan Monnier
  2011-01-16  0:13     ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2011-01-14 15:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: David Reitter, emacs-devel

> Each element of completion-ignored-extensions is matched at the _end_
> of the file/directory name of the completion candidates.  So I think
> currently what you want is not possible.

> Using regexp syntax is not a good idea, IMO, since that would require
> to rewrite all the customizations users out there have, to escape the
> dot.  But I think we could make a change whereby if an element of
> completion-ignored-extensions begins with a slash, that means match at
> the beginning.  Then we could have "/.git/" as an element, and that
> would ignore only the standard ".git" subdirectories, not any
> directory that happens to end in ".git".

> WDYT?

I'd much rather add regexp-support, which will give a lot more
flexibility and should be pretty easy to implement.  Of course, it will
have to use a new variable since as you point out the current 
completion-ignored-extensions aren't compatible with
a regexp interpretation.


        Stefan



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

* Re: completion-ignored-extensions: match full file names
  2011-01-14 15:26   ` Stefan Monnier
@ 2011-01-16  0:13     ` Eli Zaretskii
  2011-01-16  4:40       ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2011-01-16  0:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: david.reitter, emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: David Reitter <david.reitter@gmail.com>,  emacs-devel@gnu.org
> Date: Fri, 14 Jan 2011 10:26:22 -0500
> 
> I'd much rather add regexp-support, which will give a lot more
> flexibility and should be pretty easy to implement.  Of course, it will
> have to use a new variable since as you point out the current 
> completion-ignored-extensions aren't compatible with
> a regexp interpretation.

I don't object, but this has a disadvantage that we would need to
start using this regexp-based variable right away, to filter out only
literally the ".cvs", ".bzr", ".git" etc. directories, not just any
directory that ends in these extensions.  IOW, introducing the new
variable would mean that the default value of
completion-ignored-extensions will change and the default value of the
new variable will be non-nil.  So it sounds like a more invasive
change.



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

* Re: completion-ignored-extensions: match full file names
  2011-01-16  0:13     ` Eli Zaretskii
@ 2011-01-16  4:40       ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2011-01-16  4:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: david.reitter, emacs-devel

>> I'd much rather add regexp-support, which will give a lot more
>> flexibility and should be pretty easy to implement.  Of course, it will
>> have to use a new variable since as you point out the current 
>> completion-ignored-extensions aren't compatible with
>> a regexp interpretation.

> I don't object, but this has a disadvantage that we would need to
> start using this regexp-based variable right away, to filter out only
> literally the ".cvs", ".bzr", ".git" etc. directories, not just any
> directory that ends in these extensions.  IOW, introducing the new
> variable would mean that the default value of
> completion-ignored-extensions will change and the default value of the
> new variable will be non-nil.

I don't understand in what way it's a disadvantage.

> So it sounds like a more invasive change.

Could be.  But it brings more benefit to the end-users.


        Stefan



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

end of thread, other threads:[~2011-01-16  4:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14  0:54 completion-ignored-extensions: match full file names David Reitter
2011-01-14  1:51 ` Eli Zaretskii
2011-01-14  2:00   ` David Reitter
2011-01-14  2:50     ` Eli Zaretskii
2011-01-14 15:26   ` Stefan Monnier
2011-01-16  0:13     ` Eli Zaretskii
2011-01-16  4:40       ` Stefan Monnier
2011-01-14  2:53 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.