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

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

Re: How to create a higher order function?


From: Emanuel Berg
Subject: Re: How to create a higher order function?
Date: Tue, 21 Sep 2021 07:06:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Or `cl-gensym' and `funcall' as in ...

(require 'cl-lib)

(defun add-one-shot-hook (hook fun)
  (let ((name (cl-gensym)))
    (setf (symbol-function name)
          (lambda (&rest _)
            (remove-hook hook name)
            (funcall fun) ))
    (add-hook hook name) ))

Looks like something from Pascal J. B. -
maybe he wrote it ...

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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