all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Eli Zaretskii <eliz@gnu.org>,
	"59559@debbugs.gnu.org" <59559@debbugs.gnu.org>
Subject: bug#59559: 28.1; `minibuffer-with-setup-hook' with :append
Date: Mon, 23 Jan 2023 03:14:20 +0000	[thread overview]
Message-ID: <SJ0PR10MB54887A4B1C8502709055A9E9F3C89@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87h6wip0ly.fsf@web.de>

> Well yes, I know, I expected that behavior after reading
> the docstring.  You obviously don't.
> 
> Nowhere is said that FUN should be a function _name_ or a symbol.

If it's not evaluated, and we say that it's added to a
hook, then it must be a sexp that represents a function
in some way, no?  What kinds of sexps represent/name
functions?  Lambda forms and defined-function names
(symbols).  (And maybe someone could think the symbol
name does also.)

> Unless stated otherwise, what you specify as an argument
> is an expression.

But given that assumption, what expressions are expected
for argument FUN?

The doc says that FUN is added to the hook.  Only functions
are added to a hook.  So FUN, the sexp, must be a function?
A sexp isn't a function, and a function isn't a sexp.

So one guesses that maybe it means a sexp that _represents_
a function.  OK. What kinds of specs represent functions?

You see where this leads, I hope.  Is that sexp evaluated?
Do I quote a function name or just pass the function name
(which certainly represents/names a function)?  That info
is missing.  It's not enough to know that macro args are
sexps.

And then we get to the part about the other, more particular
form of spec you can use for FUN - the other sexp that
represents a function, (:append FUN1).

Here we're told not that the whole thing (which is FUN from
the signature and the first line) is added to the hook, but
that FUN1 is added to the hook.

So already there's a contradiction from the the first line.
Even so, now we have that the FUN1 sexp part of the sexp
(:append FUN1) is actually what gets added.  OK.

And we're back to the same question as for FUN: a sexp that
represents a function.  Is it eval'd?  Quoted or unquoted
function representation?   Doesn't matter for a lambda, but
does matter for a function name.

Note that the doc string even goes to the trouble of adding
the detail that "This macro actually adds an auxiliary
function that calls FUN, rather than FUN itself, to
'minibuffer-setup-hook'."  Is that so important for users?

And yet we don't want to make clear whether the sexps (FUN
and FUN1) that represent functions that get added (oops - in
an auxiliary function) get evaluated, i.e., whether you pass
foobar or #'foobar?  Why isn't that important to communicate?

The doc isn't clear, IMO, and it doesn't help to say that if
a reader just understands that macros don't eval their args
then it should be clear.

> Here only with the exception that two syntaxes are
> possible, the alternative one is a list, like we e.g. 
> know from cl arglists.

I see a vague here with CL keyword args, if that's what
you're suggesting.  But CL doc would never show the lambda
list in a way that doesn't make a keyword arg clear, and it
would specifically call out the use of the supported keyword
arg.  (And of course, Elisp doesn't have or allow keyword
args in a lambda list.)

> My patch tried to make that part clearer: the argument is of the form
> FUN or (:append FUN) (an macro _argument_ described as of a certain form
> always speaks about the unevaluated s-exp), and FUN is an expression
> evaluating to the function that will be added to the hook.

Yes, your text was a big improvement, and yes, you tried to
address the problems I raised.  My only comment was a minor
one: to avoid talking about an "unquoted list".

And I pointed to another problem: is it true, as it is for
`add-hook', that the function "is not added if already
present"?  If so, the doc should say that.  A reader can't
assume that that's what happens - there's no mention that
`add-hook' is involved, for instance.  Neither of you have
spoken to this question.

I think the doc should make clear (explicit) that there're
two _alternative_ FUNC arg forms, that both are sexps, and
that in one form the entire sexp is eval'd to produce the
function that's added, and in the (:append F) form the F
part is eval'd to give the function that's added.

Also, I don't think that the non-(:append F) form is any
more of a "default" than the (:append F) form.  There are
two acceptable forms for that sexp arg; neither is default.





  reply	other threads:[~2023-01-23  3:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25  2:55 bug#59559: 28.1; `minibuffer-with-setup-hook' with :append Drew Adams
2022-11-25  3:07 ` Drew Adams
2023-01-10 17:37   ` Michael Heerdegen
2023-01-10 18:37     ` Drew Adams
2023-01-10 19:34       ` Michael Heerdegen
2023-01-10 19:53         ` Michael Heerdegen
2023-01-10 20:56           ` Drew Adams
2023-01-10 20:45         ` Drew Adams
2023-01-21 14:36           ` Michael Heerdegen
2023-01-21 15:35             ` Eli Zaretskii
2023-01-21 16:07               ` Michael Heerdegen
2023-01-21 18:43                 ` Eli Zaretskii
2023-01-21 18:57                   ` Drew Adams
2023-01-21 19:26                     ` Eli Zaretskii
2023-01-21 18:51               ` Drew Adams
2023-01-21 19:23                 ` Eli Zaretskii
2023-01-21 20:57                   ` Drew Adams
2023-01-21 18:41             ` Drew Adams
2023-01-21 19:29               ` Eli Zaretskii
2023-01-21 20:27                 ` Michael Heerdegen
2023-01-22  5:58                   ` Eli Zaretskii
2023-01-22 22:10                     ` Drew Adams
2023-01-22 22:19                       ` Drew Adams
2023-01-23  0:15                       ` Michael Heerdegen
2023-01-23  3:14                         ` Drew Adams [this message]
2023-01-23  3:21                           ` Drew Adams
2023-01-23 14:11                           ` Michael Heerdegen
2023-01-23 16:38                             ` Drew Adams
2023-01-23 12:15                       ` 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

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

  git send-email \
    --in-reply-to=SJ0PR10MB54887A4B1C8502709055A9E9F3C89@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=59559@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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 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.