GNU bug report logs -
#78658
30.1; [PATCH] Dired feature suggestion: dired-on-marked-files-in-all-buffers
Previous Next
Full log
Message #41 received at 78658 <at> debbugs.gnu.org (full text, mbox):
> > > (let ((common (try-completion "" files)))
> >
> > My brain had failed to make the connection between "completion"
> > and programmatically obtaining a common prefix from list of
> > strings. It makes perfect sense in hindsight, but I'd simply
> > never thought about completion in non-interactive terms, and was
> > surprised when I hadn't found a documented function for doing
> > this (but I wasn't looking under Completion at all).
> >
> > Eli, I reckon this is worth either documenting somewhere under
> > (info "(elisp) Strings and Characters") or else creating a
> > slightly more string-centric wrapper, something like:
>
> Feel free to suggest patches for the documentation, but please
> remember that results of calling completion functions can depend on
> the completion styles in effect, so if we want to advertise this as a
> way of producing the largest common prefix, we should probably bind
> completion-styles to something specific around this call.
That may be a good point. In a way it's too bad that
`completion-styles' affects `try-completion'.
Or maybe I should say that it's too bad we don't have a
better primitive for this purpose than `try-completion'.
In a way, we're reusing something that wasn't really
designed for this use.
There's also `fill-common-string-prefix', but that
just takes two strings as arg. What's called for is
a function that takes a list of strings as arg (like
`try-completion' does).
In the code that I show in my reply today to Phil, I
too didn't bother to bind `completion-styles'. But
I agree that if we use `try-completion' in this way
then maybe we should do that.
This bug report was last modified 5 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.