From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Generating a listing of all symbols (16K+) and labeling subsets
Date: Fri, 18 Apr 2014 12:09:59 +0200 [thread overview]
Message-ID: <87lhv3uex4.fsf@gmail.com> (raw)
In-Reply-To: 87sipb5ckz.fsf@zigzag.favinet
Thien-Thi Nguyen <ttn@gnu.org> writes:
> () hansbkk@gmail.com
> () Thu, 17 Apr 2014 22:09:35 -0400
>
> I'd specifically like to ask about the logic of the
> categorizing breakdown and for better taxonomy terms.
>
> It is a category error to categorize Emacs Lisp symbols into
> (single) buckets, unless you wish to defer understanding. :-D
I wrote something similar (but much simpler) recently for getting a list
of all mode commands with keybindings, and detecting keybinding
conflicts between two modes:
* Compare Keymaps
#+begin_src emacs-lisp
(defun omm-get-cmd-symbols-with-keys (rgxp mode &optional req)
"Return alist of (key . sym) pairs where sym matches RGXP.
Require REQ and load MODE in temp buffer before doing the real
work. Push the intermediary results of `mapatoms' to
`omm-tmp-storage'.
Usage example:
(pp (omm-get-cmd-symbols-with-keys
\"\\(^org-\\|^orgtbl-\\)\" 'org-mode 'org))"
(setq omm-tmp-storage nil)
(mapatoms
(lambda (--sym)
(eval
`(and (commandp --sym)
(string-match ,rgxp (symbol-name --sym))
(with-temp-buffer
(when ,req
(require (quote ,req)))
(funcall (quote ,mode))
(let ((cmd-key (substitute-command-keys
(concat
"\\[" (symbol-name --sym) "]"))))
(push
(cons
(if (string-match "^M-x " cmd-key)
nil cmd-key)
--sym)
omm-tmp-storage)))))))
(delq nil
(mapcar
(lambda (--pair) (if (car --pair) --pair nil))
(delq nil omm-tmp-storage))))
#+end_src
#+begin_src emacs-lisp
(defun omm-get-keybinding-conflicts (cmd-syms1 cmd-syms2)
"Return alist with common keys of CMD-SYMS1 and CMD-SYMS2.
The return-list consists of sublists of this form
(event definition-map1 definition-map2)
Usage example:
(pp (omm-get-keybinding-conflicts
(omm-get-cmd-symbols-with-keys \"^magit-\" 'magit-mode)
(omm-get-cmd-symbols-with-keys \"^dired-\" 'dired-mode)))"
(let ((keys2 (map 'car cmd-syms2))) ; FIXME with org-mode-map
(delq nil
(mapcar
(lambda (--pair)
(when (member (car --pair) keys2)
(list (car --pair)
(cdr --pair)
(cdr (assoc (car --pair) cmd-syms2)))))
cmd-syms1))))
#+end_src
--
cheers,
Thorsten
next prev parent reply other threads:[~2014-04-18 10:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 2:09 Generating a listing of all symbols (16K+) and labeling subsets hansbkk
2014-04-18 7:19 ` Thien-Thi Nguyen
2014-04-18 10:09 ` Thorsten Jolitz [this message]
[not found] ` <mailman.19825.1397815734.10748.help-gnu-emacs@gnu.org>
2014-04-18 15:00 ` Hans BKK
[not found] ` <mailman.19813.1397805348.10748.help-gnu-emacs@gnu.org>
2014-04-18 14:55 ` Hans BKK
2014-04-18 15:27 ` Nicolas Richard
2014-04-19 16:34 ` Robert Thorpe
-- strict thread matches above, loose matches on Subject: below --
2014-04-18 2:34 hansbkk
2014-04-18 5:15 Hans BKK
2014-04-18 19:01 ` Hans BKK
2014-04-18 20:47 ` Nicolas Richard
2014-04-19 1:23 ` Hans BKK
2014-04-19 2:16 ` John Mastro
2014-04-19 2:25 ` Hans BKK
2014-04-19 2:50 ` Hans BKK
2014-04-19 4:24 ` Drew Adams
2014-04-19 20:15 ` Hans BKK
2014-04-23 4:11 ` Hans BKK
2014-04-23 7:40 ` Florian v. Savigny
[not found] ` <<874n1klchv.fsf@bertrandrussell.Speedport_W_723V_1_32_000>
2014-04-23 15:07 ` Drew Adams
2014-04-23 13:22 ` Hans BKK
2014-04-24 2:30 ` Hans BKK
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lhv3uex4.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.