[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generating a listing of all symbols (16K+) and labeling subsets
From: |
Hans BKK |
Subject: |
Re: Generating a listing of all symbols (16K+) and labeling subsets |
Date: |
Fri, 18 Apr 2014 18:23:24 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Fri, Apr 18, 2014 at 4:47 PM, Nicolas Richard wrote:
> Hans BKK 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.
I meant that after my code selects for display those symbols likely to
be of interest, I can leave the final "(t" case to simply not list
those likely to be irrelevant to my purpose.
> ;; the intersecton of the two previous sets:
> (yf/count-symbols (lambda (x) (and (fboundp x) (boundp x))))
> => 792
> (there's obviously some overlapping with bound and fbound symbols)
Yes, I'm testing for function first as I consider that primary.
Strange (to me) that such a high % of functions have no associated
value.
> 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))
cool - thanks
>> 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)
yes, but I'm looking for a way to ID them specifically within the
fbound cond rather than having them lumped in with the final (t
"other" grouping:
(cond
((fboundp sym) ; ALL functions
(cond
((commandp sym)
(cond
((keymapp sym)
(princ "=======\n")
(princ "\n")
(princ "command - keymap:\t\t\t\t\t")
(prin1 sym)
(princ "\n\n"))
((subrp (symbol-function sym))
(princ "=============================\n")
(princ "command - built-in primitive:\t\t")
(prin1 sym)
(princ "\n\n"))
((byte-code-function-p (symbol-function sym))
(princ "====================\n")
(princ "command - byte-code:\t\t\t")
(prin1 sym)
(princ "\n\n"))
((functionp sym)
(princ "================\n")
(princ "command - elisp:\t\t\t")
(prin1 sym)
(princ "\n\n"))
(t
(princ "===============\n")
(princ "other command:\t\t\t\t")
(prin1 sym)
(princ "\n\n"))
)
)
(t ; (non-command) functions
(cond
((keymapp sym)
(princ "==================\n")
(princ "\n")
(princ "function - keymap:\t\t\t\t")
(prin1 sym)
(princ "\n\n"))
((subrp (symbol-function sym))
(princ "==============================\n")
(princ "function - built-in primitive:\t\t")
(prin1 sym)
(princ "\n\n"))
((byte-code-function-p (symbol-function sym))
(princ "=====================\n")
(princ "function - byte-code:\t\t\t")
(prin1 sym)
(princ "\n\n"))
((functionp sym)
(princ "=================\n")
(princ "function - elisp:\t\t\t")
(prin1 sym)
(princ "\n\n"))
(t
(princ "=============================\n")
(princ "other ~function (macros +??):\t")
(prin1 sym)
(princ "\n\n"))
)
>> 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 ;)
I wish we lived in such a place 8-)
>> 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.
Note that in any given state,
(apropos-variable "." t)
shows much fewer results than the auto-completion listing from
M-x describe-variable
Since I'm only looking at the diff, the changes made by activating a
given feature or package, it doesn't matter if there's a lot of
less-meaningful kruft as long as it's kruft that doesn't change.
- Re: Generating a listing of all symbols (16K+) and labeling subsets, (continued)
- Re: Generating a listing of all symbols (16K+) and labeling subsets, Thien-Thi Nguyen, 2014/04/18
- Message not available
- Re: Generating a listing of all symbols (16K+) and labeling subsets, Robert Thorpe, 2014/04/19
- Generating a listing of all symbols (16K+) and labeling subsets, hansbkk, 2014/04/18
- Generating a listing of all symbols (16K+) and labeling subsets, Hans BKK, 2014/04/18
- Re: Generating a listing of all symbols (16K+) and labeling subsets, Hans BKK, 2014/04/18
- Re: Generating a listing of all symbols (16K+) and labeling subsets,
Hans BKK <=
- Re: Generating a listing of all symbols (16K+) and labeling subsets, Hans BKK, 2014/04/18
- Re: Generating a listing of all symbols (16K+) and labeling subsets, Hans BKK, 2014/04/19
- Re: Generating a listing of all symbols (16K+) and labeling subsets, Hans BKK, 2014/04/23
- Re: Generating a listing of all symbols (16K+) and labeling subsets, Hans BKK, 2014/04/23
- Re: Generating a listing of all symbols (16K+) and labeling subsets, Hans BKK, 2014/04/23