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: "59559@debbugs.gnu.org" <59559@debbugs.gnu.org>
Subject: bug#59559: 28.1; `minibuffer-with-setup-hook' with :append
Date: Sat, 21 Jan 2023 18:41:15 +0000	[thread overview]
Message-ID: <SJ0PR10MB54884FE9BD0993D789EB1244F3CA9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87edro6jl7.fsf@web.de>

> > > I think clarifying that a bit would make sense.
> > Yes.
> I tried to do that:
<proposed>
  In the default case, FUN is an expression that should
  evaluate to a function, and the result will be prepended to
  `minibuffer-setup-hook'.  If FUN is an unquoted list of the
  form `(:append FUN1)', the result of evaluating FUN1 will be
  appended to `minibuffer-setup-hook' instead of prepending it.

Thx.

I'd say (but Eli will likely disagree), that we need
not and should not use future tense ("will be"),
and we should avoid "should".  But that's just a
doc-style question.

More importantly, I'd avoid talking about an unquoted
list.  It's not really about quotation, is it?  It's
about evaluation.  It's about the first arg being a
sexp that doesn't simply get evaluated.

The important thing, I think, is to get across the
(quite unusual) treatment of arg FUN: It's not just
evaluated, and it's not just NOT evaluated.  (IMO,
this is a poor interface, but we are where we are.)

I suggest something like this - somehow get across
the fact that FUN _might_ be simply evaluated, and
the result prepended, or it might be a sexp that's
_not_ evaluated, but _part_ of it is, and in that
case the result of that evaluation is appended.

E.g.:

  Argument FUN is a sexp; it is not simply evaluated.
  Two cases:
  * If FUN has form (:append FUNCTION), evaluate
    FUNCTION and append the result to the hook.
  * Otherwise, evaluate FUN and prepend the result
    to the hook.

Another possibility:

  If FUN is (without evaluating) a sexp (:append FUNCTION)
  then FUNCTION is evaluated and appended to the hook.
  Otherwise, FUN is evaluated and prepended to the hook.

(Could say "list" instead of "sexp", but the latter
stresses the connotation that it's not evaluated.)

We might also change the name FUN.  Maybe use FUN-SPEC
or something - something that doesn't suggest that it
_is_ a function but that it specifies a function that
gets added to the hook.

A question is whether what is said in the doc of
`add-hook' is also true here: the function "is not
added if already present."

If so, I think the doc should say that.  (It's kind
of a shame that we can't just point to `add-hook'.)





  parent reply	other threads:[~2023-01-21 18:41 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 [this message]
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
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=SJ0PR10MB54884FE9BD0993D789EB1244F3CA9@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=59559@debbugs.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.