all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* proposed `list-dynamic-libraries'
@ 2011-05-06 15:46 Juanma Barranquero
  2011-05-08 20:50 ` Chong Yidong
  0 siblings, 1 reply; 12+ messages in thread
From: Juanma Barranquero @ 2011-05-06 15:46 UTC (permalink / raw
  To: Emacs developers

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)



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-05-09 15:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-06 15:46 proposed `list-dynamic-libraries' Juanma Barranquero
2011-05-08 20:50 ` 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

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.