From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: proposed `list-dynamic-libraries'
Date: Fri, 6 May 2011 17:46:42 +0200 [thread overview]
Message-ID: <BANLkTinn+LS8fqVqWboNvyo4pji=-rRhaQ@mail.gmail.com> (raw)
Would be OK to install this code, which adds a list-dynamic-libraries command?
(Currently it is useful only on Windows, because it's the only
platform supporting dynamic loading on demand.)
If so, which source file would be best? `list-processes' is in
simple.el, but I have a hard time understanding how can it be
considered a "basic editing command" ;-)
Juanma
(defvar list-dynamic-libraries--loaded-only-p)
(defun list-dynamic-libraries--refresh ()
"Recompute the list of dynamic libraries.
Internal use only."
(setq tabulated-list-entries nil)
(dolist (lib dynamic-library-alist)
(let* ((id (car lib))
(from (get id :loaded-from)))
(when (or from
(not list-dynamic-libraries--loaded-only-p))
(push (list id (vector (symbol-name id)
(or from "")
(mapconcat 'identity (cdr lib) ", ")))
tabulated-list-entries)))))
(defun list-dynamic-libraries (&optional loaded-only-p buffer)
"Display a list of all dynamic libraries known to Emacs.
\(These are the libraries listed in `dynamic-library-alist'.)
If optional argument LOADED-ONLY-P (interactively, prefix arg)
is non-nil, only libraries already loaded are listed.
Optional argument BUFFER specifies a buffer to use, instead of
\"*Dynamic Libraries*\".
The return value is always nil."
(interactive "P")
(unless (bufferp buffer)
(setq buffer (get-buffer-create "*Dynamic Libraries*")))
(with-current-buffer buffer
(tabulated-list-mode)
(setq tabulated-list-format
(let ((max-id-len 0) (max-name-len 0))
(dolist (lib dynamic-library-alist)
(let ((id-len (length (symbol-name (car lib))))
(name-len (apply 'max (mapcar 'length (cdr lib)))))
(when (> id-len max-id-len) (setq max-id-len id-len))
(when (> name-len max-name-len) (setq max-name-len name-len))))
(vector (list "Library" (1+ max-id-len) t)
(list "Loaded from" (1+ max-name-len) t)
(list "Candidate names" 0 t))))
(setq tabulated-list-sort-key (cons "Library" nil))
(add-hook 'tabulated-list-revert-hook
'list-dynamic-libraries--refresh nil t)
(tabulated-list-init-header)
(set (make-local-variable 'list-dynamic-libraries--loaded-only-p)
loaded-only-p)
(list-dynamic-libraries--refresh)
(tabulated-list-print))
(display-buffer buffer)
nil)
next reply other threads:[~2011-05-06 15:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 15:46 Juanma Barranquero [this message]
2011-05-08 20:50 ` proposed `list-dynamic-libraries' Chong Yidong
2011-05-08 20:54 ` Juanma Barranquero
2011-05-09 6:32 ` Eli Zaretskii
2011-05-09 14:16 ` Juanma Barranquero
2011-05-09 14:53 ` Eli Zaretskii
2011-05-09 15:03 ` Juanma Barranquero
2011-05-09 15:24 ` Eli Zaretskii
2011-05-09 14:26 ` Stefan Monnier
2011-05-09 14:34 ` Juanma Barranquero
2011-05-09 15:37 ` Stefan Monnier
2011-05-09 15:53 ` Juanma Barranquero
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTinn+LS8fqVqWboNvyo4pji=-rRhaQ@mail.gmail.com' \
--to=lekktu@gmail.com \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).