emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delayed warnings


From: Stefan Monnier
Subject: Re: Delayed warnings
Date: Mon, 21 Mar 2011 18:05:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> Only I would process `display-delayed-warnings' in reverse, so C code
> can add with

>   Vdisplay_delayed_warnings = Fcons (..., Vdisplay_delayed_warnings);

> but the user still gets the warnings in order.

Or you could have your C code all `add-hook-once' on post-command-hook
which would be a new function that adds a function onto a hook such that
the function is only run once and then automatically removed.
Something like:

   (defun add-hook-once (hook function &optional append local)
     "Same as `add-hook', but FUN is only run once.
   Also contrary to `add-hook', this is not idempotent."
     ;; FIXME: need to check if `function' was already added to the hook.
     (let ((code (list 'lambda)))
       (setcdr code `(() (,function) (remove-hook ',hook ',code ',local)))
       (add-hook hook code append local)))


-- Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]