unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Davis Herring <herring@lanl.gov>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: RE: `read--expression' and `read-minibuffer'
Date: Tue, 6 Sep 2016 13:29:03 -0700 (PDT)	[thread overview]
Message-ID: <b93b69a2-f719-40de-8623-6b594027bdb4@default> (raw)
In-Reply-To: <10888855-8ce3-648f-82ac-2b9e1409effc@lanl.gov>

> >> Because it is tailored for that use case.  The kind of completion
> >> it provides for instance assumes the S-exp is an Elisp expression.
> >
> > Of course it is an Elisp expression.  It does not follow that
> > the Elisp expression that has been read will then be _evaluated_.
> 
> In this thread, Stefan is defining an "Elisp expression" to be
> precisely an S-exp that is intended for `eval'.

He may be.  But that does not really correspond to the effect of
`read--expression'.  There is nothing in its behavior that limits
what is read to expressions that are intended to be evaluated.

> > Completion can be used and useful when constructing an Elisp
> > expression to be read, regardless of whether the expression
> > that is read will be evaluated, or can be evaluated without
> > error.
> 
> So a variant of `read--expression' could be written that does a subset
> of that completion appropriate to the more general context of entering
> an S-exp.  It might for instance be a flag passed to `read--expression'.

See above.  What is read and returned is an arbitrary sexp, not
one that is supposedly intended only for evaluation.

Perhaps you are referring to the fact that after `(' a symbol is
completed against only function names, instead of against both
function and variable names?

That's not a real problem, but that's the only place/case where I
can see an argument for a "variant" behavior (completion against
both function and variable names at that position too).

Or perhaps you are referring to the fact that `read--expression'
runs `eval-expression-minibuffer-setup-hook' functions at the
outset?

If you want to bother creating a variant for completing both
function and variable symbols, and for not running that
eval-intended hook, I don't have a problem with that.

The point is to get a reasonably behaving read function for
sexps that is not branded "internal".

The non-"internal" function `read-minibuffer' is not very
reasonable, and is essentially a vestige, at this point.

And there is little sense in otherwise asking users to roll
their own, e.g., using just `read-from-minibuffer' with
`read-expression-map' and `read-expression-history'.

We can do better, and better is already available:
`read--expression'.  Some such function should now be
available non-"internally".

If you want to (1) rename the current `read--expression'
to `read-expression-for-eval' and (2) create a variant
`read-expression' (which is for both eval and not),
please go ahead.

Or if you want to roll those together, distinguishing the
behaviors by an optional arg, please go ahead.

> This answers your original question: it's internal because we are
> still discovering the use cases and desirable interface for it.

1. That's not a good reason to make it "internal".  If you want
   to learn more about use cases and improving the interface then
   make it non-"internal".  Users are best placed to tell you
   about both of those things.

   The function has been available for almost 3 years "internally".
   Do you really think more time to just ponder it "internally" is
   what is called for, to "discover the use cases and desirable
   interface"?

2. That "reason" applies to ALL new functions.  It's hardly a
   solid reason.  It's not a reason why _this_ function should
   be "internal".

3. The same (#2) applies to the only other reason given so far
   (by Stefan), which was that it is easier to make an existing
   function become non-"internal" than it is to make it become
   "internal".  That "reason" too applies to ALL new functions.

What would _you_ choose, to read an arbitrary Lisp expression
in the minibuffer?  Would you really choose the non-"internal"
function `read-minibuffer'?  Not if you wanted to help the
users whose input was being read.  Or would you use just
`read-from-minibuffer', passing `read-expression-map' and
`read-expression-history'?

(`read-expression-map' and `read-expression-history' have been
around since the beginning (Emacs 20, anyway), for reading sexps.)

Time to plant this little one outside, in the wide world beyond
the hothouse/incubator, I'd say.



  reply	other threads:[~2016-09-06 20:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-03 18:20 `read--expression' and `read-minibuffer' Drew Adams
2016-09-04  4:40 ` Stefan Monnier
2016-09-04  5:53   ` Drew Adams
2016-09-04  6:27     ` Stefan Monnier
2016-09-04 15:39       ` Drew Adams
2016-09-05  2:36         ` Stefan Monnier
2016-09-06 19:02         ` Davis Herring
2016-09-06 20:29           ` Drew Adams [this message]
2016-09-07  0:04             ` Stefan Monnier
2016-09-07  3:01               ` Drew Adams
2016-09-07  3:46                 ` Stefan Monnier
2016-09-07  5:54                   ` Drew Adams
2016-09-07 12:12                     ` Stefan Monnier
2016-09-09 21:41                       ` Drew Adams
2016-09-07 13:25                     ` Herring, Davis
2016-09-07 16:02                       ` Drew Adams
2016-09-07 17:01                         ` Davis Herring
2016-09-07 21:01                           ` Drew Adams
2016-09-07 22:17               ` Michael Heerdegen
2016-09-07 22:30                 ` Stefan Monnier
2016-09-07 22:50                   ` Michael Heerdegen
2016-09-08  0:19                     ` Stefan Monnier
2016-09-06 21:05           ` Stefan Monnier
2016-09-06 21:35             ` Drew Adams

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=b93b69a2-f719-40de-8623-6b594027bdb4@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=herring@lanl.gov \
    --cc=monnier@iro.umontreal.ca \
    /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).