[Top][All Lists]

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

Re: tags for functions

From: Ted Zlatanov
Subject: Re: tags for functions
Date: Fri, 30 Jan 2009 09:29:15 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux)

On Thu, 29 Jan 2009 21:32:59 +0100 Lennart Borgman <address@hidden> wrote: 

LB> On Thu, Jan 29, 2009 at 2:43 AM, Stefan Monnier
LB> <address@hidden> wrote:
>>> Juri's solution is slow, as Lennart noted, due to the `documentation'
>>> issue you mentioned.  I said I think a defun-after-hook would be the
>>> best solution.  Maybe it should be combined with a etc/DOC scan to find
>>> all the existing keywords quickly.
>> In any case, we don't want to collect/store this info all the time: we
>> only want to pay for it when this data is actually used.

LB> Is there really any reason not to just collect it while compiling
LB> (using :keywords)? Beside the human work needed ... ;-)

LB> (let ((n 0))
LB>   (defun my-keyw ()
LB>     (let (keywordlist docstr)
LB>       (mapatoms
LB>        (lambda (symbol)
LB>          (when (functionp symbol)
LB>            (setq n (1+ n))
LB>            (put symbol 'my-keyw (list 'test 'ing)))))))

LB>   (benchmark 1 '(my-keyw))
LB>   (message "n=%s" n))

LB> This takes 0.2 s for 12000 functions.

Modifying docstrings is much easier, and does not involve any code
changes anywhere, so I would prefer it as a way of declaring keywords.


reply via email to

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