help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: the hand that feeds you


From: Harald Hanche-Olsen
Subject: Re: the hand that feeds you
Date: Fri, 28 Jul 2006 11:12:12 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (berkeley-unix)

+ Kevin Rodgers <ihs_4664@yahoo.com>:

| Harald Hanche-Olsen wrote:
|> (defun kill-myself ()
|>   (insert "only once")
|>   (defun kill-myself ()))
|
| That is just as dependent on the implementation of defun as the original
| is on the implementation of run-hooks and remove-hooks, isn't it?

Er, no, it is only dependent on the specification of defun.  Notably,
that the inner defun does not define a local function, as it might in
some lisp dialects (but not elisp).

| BTW, this is truly suicidal:
|
| (defun kill-myself ()
|    (insert "only once")
|    (unintern 'kill-myself))

Not suicidal at all.  The uninterned symbol remains in the hook, and
its function definition will get called.

| But maybe (fmakunbound 'kill-myself) or
| (fset 'kill-myself (symbol-function 'ignore)) is good enough.  :-)

That will cause run-hooks to fail on the second try.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell


reply via email to

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