[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: the hand that feeds you
From: |
wenbinye |
Subject: |
Re: the hand that feeds you |
Date: |
27 Jul 2006 23:50:30 -0700 |
User-agent: |
G2/0.2 |
how about define the function like this:
(defvar kill-myself nil)
(defun kill-myself ()
(unless kill-myself
(insert "only once")
(setq kill-myself t)))
Andreas Seik wrote:
> Hello Newsgroup,
>
> i need code in a hook that is executed only once,
> so i tested the following:
>
>
> (defvar my-hook '())
> (defun kill-myself ()
> (insert "only once")(remove-hook 'my-hook 'kill-myself))
> (add-hook 'my-hook 'kill-myself)
> (run-hooks 'my-hook);; i think it might crash here, but it does not
> (run-hooks 'my-hook)
>
> it, seems to work, but i do not trust it.
> is it not "biting the hand that feeds you"
>
> thank you
> Andreas