all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Strange use of (run-with-timer 0 nil #'foo args) in do-after-load-evaluation
Date: Sat, 26 Oct 2019 14:18:19 +0000	[thread overview]
Message-ID: <20191026141819.GD17424@ACM> (raw)
In-Reply-To: <jwvmudnd6rk.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Sat, Oct 26, 2019 at 08:41:27 -0400, Stefan Monnier wrote:
> >           (run-with-timer 0 nil
> >                           (lambda (msg)
> >                             (message "%s" msg))
> >                           msg)

> > run-with-timer is being used to run message once, immediately.
> > Why not just call message?

> Good question.  It's been that way since

>     commit 5766c380eec20a19844253cbb511922b6c70fc0b
>     Author: Stefan Monnier <monnier@iro.umontreal.ca>
>     Date:   Sat Sep 12 03:35:40 2009 +0000
    
>         * lread.c (Fload): Don't output a message after loading an obsolete
>         package any more (done in Lisp now).
>         * subr.el (do-after-load-evaluation): Warn the user after loading an
>         obsolete package.

> but I can't see any trace of an explanation nor can I find it in my memory.

> > What is going on, here?  Is the run-with-timer mechanism being used
> > deliberately to make the "deprecated" message prevail over other
> > messages?

> That's my best guess, yes.

I think I can see what's happening, now.  The (run-with-timer 0 nil ...)
mechanism doesn't trigger its function until Emacs is waiting for input.
This will be in the minibuffer routines, just after the y-or-n-p has
displayed its prompt string and tries to read a character.  So the
(run-with-timer ...) message will overwrite any prompt string.

I have counted 11 occurrences of run-with-timer or run-at-time with a
zero delay in them.

So, the (run-with-timer ...) seems indeed to be being used to raise the
"priority" of its message.  Maybe a simple message call should be used
here instead.

> > The current situation seems unsatisfactory; the prompt from
> > hack-local-variables is more important than the deprecation message,
> > and shouldn't be obscured by it.

> It's a kind of general problem with messages, indeed.

Yes.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2019-10-26 14:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26 10:14 Strange use of (run-with-timer 0 nil #'foo args) in do-after-load-evaluation Alan Mackenzie
2019-10-26 12:41 ` Stefan Monnier
2019-10-26 13:16   ` Lars Ingebrigtsen
2019-10-26 16:38     ` Stefan Monnier
2019-10-27  1:01       ` HaiJun Zhang
2019-10-27 21:57     ` Juri Linkov
2019-10-27 22:29       ` Juri Linkov
2019-10-28  9:41         ` martin rudalics
2019-10-28  2:13       ` Stefan Monnier
2019-10-28 10:45       ` Lars Ingebrigtsen
2019-10-28 22:19         ` Juri Linkov
2019-10-28 23:20           ` Stefan Kangas
2019-10-29 23:39             ` Juri Linkov
2019-10-29 11:38           ` Lars Ingebrigtsen
2019-10-29 23:45             ` Juri Linkov
2019-10-29 23:58               ` Lars Ingebrigtsen
2019-10-30  8:22                 ` martin rudalics
2019-10-30 22:10                 ` Juri Linkov
2019-10-31  2:00                   ` Stefan Monnier
2019-11-03 20:50                     ` Juri Linkov
2019-11-05 22:54                     ` bug#38076: Using minibuffer for y-or-n-p Juri Linkov
2019-11-06 22:25                       ` Juri Linkov
2019-10-26 14:18   ` Alan Mackenzie [this message]
2019-10-26 15:27   ` Strange use of (run-with-timer 0 nil #'foo args) in do-after-load-evaluation Juanma Barranquero
2019-10-27 21:51 ` Juri Linkov
2019-10-28  3:34   ` 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=20191026141819.GD17424@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@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 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.