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

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

Re: Generating a listing of all symbols (16K+) and labeling subsets


From: Nicolas Richard
Subject: Re: Generating a listing of all symbols (16K+) and labeling subsets
Date: Fri, 18 Apr 2014 22:47:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.90 (gnu/linux)

Hans BKK <hansbkk@gmail.com> writes:
> On Fri, Apr 18, 2014 at 11:27 AM, Nicolas Richard
>> Some symbols are just symbols. every time the lisp reader reads
>> something, symbols are interned.
>>
>> Currently I have 76920 symbols in obarray.
>
> Aha. OK, so those "just symbols" can go to dev null.

I don't know what that should mean. Some symbols will never be reused,
some I don't know if they will be reused, some are still used (e.g.
because they serve as identifier), and many probably serve a purpose I
am not aware of.

If you like numbers, here are some :
(yf/count-symbols)
=> 77064

(yf/count-symbols #'fboundp)
=> 27896

(yf/count-symbols #'boundp)
=> 13713

;; the intersecton of the two previous sets:
(yf/count-symbols (lambda (x) (and (fboundp x) (boundp x))))
=> 792

(yf/count-symbols
 (lambda (x)
   (and
    (symbol-plist x)
    (not (fboundp x))
    (not (boundp x)))))
=> 3136

(yf/count-symbols #'facep)
=> 673
(there's obviously some overlapping with bound and fbound symbols)

(yf/count-symbols #'keywordp)
=> 1510

So, are all the other symbols unneeded ? Dunno.

FWIW, here's the yf/count-symbols that I used:
(defun yf/count-symbols (&optional predicate)
  (let ((count 0))
    (mapatoms
     (lambda (x)
       (when (or (not predicate)
                 (funcall predicate x))
         (incf count))))
    count))

> Question remains - how to separate out and ID - in the absence of a
> predicate - any that actually may be of interest remaining in my
> current "other" - which I presume macros should be, and having got
> code for keymaps already above.

macros are fboundp.
(defmacro asymbollikenoother () t)
(fboundp 'asymbollikenoother)
=> t

>
>> If you want to have a report of useful symbols used in a package you can
>> do e.g. for smerge-mode:
>> M-x apropos RET ^smerge- RET
>
> Thanks for that, looks useful. But looks to only pick up those
> starting with the package string?

That was the idea, yes. Most packages are namespaced that way, those
that aren't probably should not exist in an ideal world ;)

> And I think apropos only displays a
> limited subset, e.g. only Customized variables? and/or only those with
> docstrings?

C-h f a p r o p o s RET 
=>
Show all meaningful Lisp symbols whose names match PATTERN.
Symbols are shown if they are defined as functions, variables, or
faces, or if they have nonempty property lists.

> In this context I'm aiming more for an all-in-one standard "state
> report" I can diff between any arbitrary emacs-config-A and
> emacs-config-B, showing all changes, including to existing system
> variables.

I'm not sure if you can get meaningful data, doing that.

-- 
Nico.



reply via email to

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