[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Checking if new commands have been defined: Can you help me find a bette
Checking if new commands have been defined: Can you help me find a better approach?
Mon, 21 Dec 2009 15:53:00 +0100
Thunderbird 18.104.22.168 (Windows/20090812)
I want to check if new commands have been defined during a specific
period of time.
There are two obvious approaches:
Using 'mapatoms' to compile lists of available commands and
This technique is a bit too slow for my needs. It introduces a slight
lag when used in a time-critical interactive function.
Redefining 'defun' (and optionally 'fset') to trap command definitions.
This one messes rather crudely with the internals:
(fset 'old-defun (symbol-function 'defun))
(defmacro defun (&rest body)
`(let* ((fn-symbol (first (quote ,body)))
(was-command (commandp fn-symbol))
(result (macroexpand (old-defun ,@body))))
(and (not was-command) (commandp fn-symbol)
(setq new-command-defined-flag t))
Are there other, more elegant ways to achieve the same effect?
|[Prev in Thread]
||[Next in Thread]|
- Checking if new commands have been defined: Can you help me find a better approach?,
hans bennekop <=