unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>, 35508@debbugs.gnu.org
Subject: bug#35508: 27.0.50; Fine-ordering of functions on hooks
Date: Tue, 30 Apr 2019 14:37:41 -0700 (PDT)	[thread overview]
Message-ID: <80d76085-af3c-4b74-b9ae-6f831922aa80@default> (raw)
In-Reply-To: <jwvwojbkz63.fsf@iro.umontreal.ca>

> +But in some cases, it is important to control the relative ordering of
> +functions on the hook.  The optional argument @var{depth} lets you indicate
> +where the function should be inserted in the list: it should then be a
> number
> +between -100 and 100 where the higher the value, the closer to the end of
> the
> +list the function should go.  The @var{depth} defaults to 0 and for backward
> +compatibility when @var{depth} is a non-nil symbol it is interpreted as a
> depth
> +of 90.  Furthermore, when @var{depth} is strictly greater than 0 the
> function
> +is added @emph{after} rather than before functions of the same depth.

Commenting on just this part.  If by "default" you mean
that providing nil or no DEPTH arg has the same effect
as providing a DEPTH of 0, then I don't think that
defaulting to 0 is backward-compatible.

Currently the default behavior is to prepend.
Presumably 0 does not mean prepend but insert ~halfway.
And currently if you provide 0 as the APPEND arg you
get the effect of 100, not 0 (IIUC).

I think that if you add this feature the doc should say
something about an expected/possible use case - when
"it is important to control the relative ordering".
(I'm curious, for example, never having come across the
need.)

The way you describe it makes it seem like it will be
common to supply a specific number rather than just
appending (i.e. at the end).  Will it be common to need
a number other than 100?

BTW, do similar considerations not apply to advice?
There we have before, after, and replace, essentially.
Why don't we need -100 to 100 for ordering there?
(Again, just curious.)





  reply	other threads:[~2019-04-30 21:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30 20:37 bug#35508: 27.0.50; Fine-ordering of functions on hooks Stefan Monnier
2019-04-30 21:37 ` Drew Adams [this message]
2019-04-30 22:31   ` Stefan Monnier
2019-05-01 18:00 ` Eli Zaretskii
2019-05-01 20:29   ` Stefan Monnier
2019-05-08 18:32     ` Stefan Monnier
2019-05-11 12:05       ` Eli Zaretskii
2019-05-11 13:26         ` Stefan Monnier
2019-05-11 13:54           ` Eli Zaretskii
2019-05-13 13:29             ` Stefan Monnier
2019-05-29 19:56               ` Stefan Monnier

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=80d76085-af3c-4b74-b9ae-6f831922aa80@default \
    --to=drew.adams@oracle.com \
    --cc=35508@debbugs.gnu.org \
    --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).