Subject: bug#78658: 30.1; [PATCH] Dired feature suggestion: dired-on-marked-files-in-all-buffers

From: Daniel Mendler <[email-masked]>
Date: Tue, 03 Jun 2025 22:09:27 +0200

Drew Adams via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <[email-masked]> writes:

>> > >     (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'.

Note that the `completion-styles' only affect
`completion-try-completion' and `completion-all-completions', but not
the primitive `try-completion', which always computes the common prefix.