[Top][All Lists]

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

Re: moy-compilation-schedule-execute.el

From: Stefan Monnier
Subject: Re: moy-compilation-schedule-execute.el
Date: Tue, 10 Feb 2004 17:44:51 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> You have  both options :  compilation-end-hook is a  "permanent hook",
> and compilation-end-hook-once  is the set  of functions to run  at the
> end of /this/ compilation. 

How about not adding another hook but using a function like the one below

(defun add-hook-once (hook function 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]