unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Philip Kaludercic <philipk@posteo.net>,
	Spyros Roum <spyros.roum@posteo.net>
Cc: "juri@linkov.net" <juri@linkov.net>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: Add completion to compilation-read-command
Date: Wed, 25 Dec 2024 19:36:31 +0000	[thread overview]
Message-ID: <DS7PR10MB5232AB9938363F1CA7BD5E60F30C2@DS7PR10MB5232.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87ttas80au.fsf@posteo.net>

1. I wasn't going to reply to the statements made 
about "completion" versus "narrowing", "selection", 
etc.  I think such a characterization isn't very 
useful, and it can be misleading.

Since I'm now replying (below), about Icicles, I'll
first say this about completion/narrowing/selection:

Emacs "completion" has always meant matching a (user)
pattern against some set of things, with the pattern
typically provided as text in the minibuffer or some 
other buffer.

IOW, completion is about _matching_, first & foremost.

Completion has also typically involved expanding or
replacing the pattern, based on the matches.  E.g.,
you type "forw", hit TAB, and your input pattern
might change to "forward-".

(In Icicles, such pattern expansion is optional - you
can toggle it on/off anytime during completion.)

The words "narrowing" and "selection" are less about
a mechanism, which "completion" speaks to, and more
about possible _uses_ of a completion mechanism.

I'm guessing that those who distinguished such things
from completion had a limited view of its possible
uses: limited to just obtaining a (single) completion
of a pattern - much as if the only use of `grep' were
to show all matches for a pattern and then let you
pick/access/use only one of them.

If that's how "completion" is viewed, then yes, 
"narrowing" and "selection" seem like very different 
things from completion.  That's not the way I view 
completion.

Of course, we use `grep' in many other ways, including
(1) seeing what all the matches are, and where they're
located (discovery etc.), and (2) piping `grep' output
to further `grep' patterns or other transformation
functions.

The uses of completion are really as general as those
of pattern matching.  Completion isn't at all limited
to obtaining a single completion.

The idea behind "narrowing" (it's really _progressive_
narrowing, since just a single act of completion
already narrows the original domain of candidates to
only those that match the initial pattern) is that
you can _chain together_ acts of completion/matching,
as you do when you pipe `grep' output through another
`grep' (or another kind of filter or a transformer),
etc. 

IOW, you can match one pattern, getting a set of
matches, and then filter those matches (as a new
domain of candidates) with another pattern, and so on.

This is different from just changing the input
pattern and recompleting, which just starts over again
with the original domain of candidates.

Of course, even such plain recompletion isn't limited
to a get-me-a-completion use case.  Like progressive
completion, it acts on a given _set_ of elements to
produce a new _set_.  Completion, in general, is an 
operation on sets: given a pattern and a set of
candidates, it returns a new set of candidates, which
match the pattern.

[ More generally, you can think "map"/"reduce": Besides
pattern-matching with filter functions, _transforming_
functions can be mapped across a set of candidates.
And an aggregation ("reduce") function can be applied
to a set of candidates together.  Dunno whether other
so-called "completion frameworks" offer this, but
Icicles does. ]

> > from this thread I learned that Icicles can be used 
> > to enhance completion similarly to how narrowing 
> > frameworks (like vertico) enhance narrowing.

It's the other way around.  Icicles did that for
decades before there were any other "narrowing
frameworks" or "completion frameworks".  And it's
not about "enhancing narrowing".  It's simply about 
ways of using (taking advantage of) completion
/ matching.

> I have never used it, because it is not available as 
> a package and it redefines built-in functions, but
> my understanding it that it is something similar.

2, I don't care that you've never used it, or why.
But for the record:

* It is a package.  It was on MELPA, till MELPA stopped
  pulling code from Emacs Wiki.  My other libraries 
  were also on MELPA.

* Icicles only redefines some predefined functions, and
  only while `icy-mode' is enabled (on).  When off, the
  original definitions are restored.

3. I'm no expert on the many "completion frameworks"
that've been added since Icicles.  But I have a hunch 
that none of them have something like the progressive 
completion of Icicles:

When you initiate a new completion / matching
/ filtering with a new pattern, you can do so in a
recursive minibuffer.  The previous set of matches
(completion candidates) then becomes the domain of
candidates for the current act of completing.

Using recursive minibuffers means, among other things, 
that you can return to any higher level and continue 
from there, branching down another trail of levels,
and so on.  In effect, there's a tree of possibilities.  
(You can also pop back to the top level directly 
anytime.)

> >> But for someone like me who doesn't use a
> >> selecting-narrowing framework like vertico, it
> >> suddenly means that SPC is rebound to
> >> `minibuffer-complete-word' and entering new
> >> commands becomes *a lot* more cumbersome.

4. On this I'll just say that I argued long ago for
Emacs to _not_ bind SPC in minibuffer keymaps to word 
completion.

To me, that's just an artifact / legacy left over from 
the fact that Emacs used completion pretty much only
for `M-x' and reading file names, and Emacs commands 
and file names rarely, if ever, contained SPC chars 
(esp. back then).

Completion being potentially usable for matching
against _any_ set of candidates, it makes sense in the 
vast majority of contexts (including potential) for
SPC to be self-inserting.

(Of course, in some contexts you might want using SPC 
in the minibuffer to do something besides adding a SPC 
char to your pattern to be matched.)

I argued the same for `?' and `C-j' (newline): by 
default they, like SPC, should self-insert in the 
minibuffer.  Eventually, after decades, SPC finally 
became self-inserting, but only for file-name
completion.

(I'd be willing to bet that other  "completion 
frameworks", like Icicles, let you insert such chars 
without using `C-q' etc.  I'm not betting on vanilla 
Emacs doing so anytime soon.)



  parent reply	other threads:[~2024-12-25 19:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-24  8:53 Add completion to compilation-read-command Spyros Roum
2024-12-24 11:35 ` Philip Kaludercic
2024-12-24 11:57   ` Spyros Roum
2024-12-24 12:53     ` Philip Kaludercic
2024-12-24 13:43       ` Spyros Roum
2024-12-24 14:53         ` Philip Kaludercic
2024-12-24 17:03     ` Juri Linkov
2024-12-24 18:36       ` Spyros Roum
2024-12-24 18:50         ` Juri Linkov
2024-12-24 18:59           ` Spyros Roum
2024-12-24 22:35             ` Philip Kaludercic
2024-12-25  7:27               ` Juri Linkov
2024-12-24 19:56           ` [External] : " Drew Adams
2024-12-25  7:29             ` Juri Linkov
2024-12-25 19:46               ` Drew Adams
2024-12-24 22:44         ` Philip Kaludercic
2024-12-25  8:26           ` Spyros Roum
2024-12-25 11:33             ` Philip Kaludercic
2024-12-25 15:44               ` Spyros Roum
2024-12-25 16:38                 ` Philip Kaludercic
2024-12-25 22:11                   ` Spyros Roum
2024-12-26 11:39                     ` Philip Kaludercic
2024-12-26 13:13                       ` Spyros Roum
2024-12-26 13:18                         ` Visuwesh
2024-12-26 14:46                           ` Spyros Roum
2024-12-26 15:04                             ` Visuwesh
2024-12-26 16:00                               ` Spyros Roum
2024-12-25 17:32                 ` Juri Linkov
2024-12-25 18:02                   ` Spyros Roum
2024-12-25 19:36               ` Drew Adams [this message]
2024-12-24 19:27       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DS7PR10MB5232AB9938363F1CA7BD5E60F30C2@DS7PR10MB5232.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    --cc=philipk@posteo.net \
    --cc=spyros.roum@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).