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

* Re: proposed `list-dynamic-libraries'
  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
  0 siblings, 1 reply; 12+ messages in thread
From: Chong Yidong @ 2011-05-08 20:50 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Emacs developers

Juanma Barranquero <lekktu@gmail.com> writes:

> 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" ;-)

I think it's fine to install, since we already have a
dynamic-library-alist variable anyway.  It would be nice to put it
somewhere that's not loaded by default, though, i.e. not simple.el...



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

* Re: proposed `list-dynamic-libraries'
  2011-05-08 20:50 ` Chong Yidong
@ 2011-05-08 20:54   ` Juanma Barranquero
  2011-05-09  6:32     ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Juanma Barranquero @ 2011-05-08 20:54 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Emacs developers

On Sun, May 8, 2011 at 22:50, Chong Yidong <cyd@stupidchicken.com> wrote:

> I think it's fine to install, since we already have a
> dynamic-library-alist variable anyway.  It would be nice to put it
> somewhere that's not loaded by default, though, i.e. not simple.el...

Then please suggest a place, I'm always at a loss to know where to put
things (often the name, one-line description and real use of a package
are at odds)...

    Juanma



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

* Re: proposed `list-dynamic-libraries'
  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:26       ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2011-05-09  6:32 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: cyd, emacs-devel

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Sun, 8 May 2011 22:54:17 +0200
> Cc: Emacs developers <emacs-devel@gnu.org>
> 
> On Sun, May 8, 2011 at 22:50, Chong Yidong <cyd@stupidchicken.com> wrote:
> 
> > I think it's fine to install, since we already have a
> > dynamic-library-alist variable anyway.  It would be nice to put it
> > somewhere that's not loaded by default, though, i.e. not simple.el...
> 
> Then please suggest a place, I'm always at a loss to know where to put
> things (often the name, one-line description and real use of a package
> are at odds)...

How about a new package under emacs-lisp/ or progmodes/ ?  Something
like shared-libraries.el?




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

* Re: proposed `list-dynamic-libraries'
  2011-05-09  6:32     ` Eli Zaretskii
@ 2011-05-09 14:16       ` Juanma Barranquero
  2011-05-09 14:53         ` Eli Zaretskii
  2011-05-09 14:26       ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Juanma Barranquero @ 2011-05-09 14:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: cyd, emacs-devel

On Mon, May 9, 2011 at 08:32, Eli Zaretskii <eliz@gnu.org> wrote:

> How about a new package

It's very little code, but I suppose it's perhaps the best option.

> under emacs-lisp/ or progmodes/?

emacs-lisp/, I think. AFAICS, it is not related to programming modes at all.

> Something like shared-libraries.el?

The variable is called `dynamic-library-alist', so
dynamic-libraries.el would make more sense IMHO.

    Juanma



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

* Re: proposed `list-dynamic-libraries'
  2011-05-09  6:32     ` Eli Zaretskii
  2011-05-09 14:16       ` Juanma Barranquero
@ 2011-05-09 14:26       ` Stefan Monnier
  2011-05-09 14:34         ` Juanma Barranquero
  1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2011-05-09 14:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Juanma Barranquero, cyd, emacs-devel

>> > I think it's fine to install, since we already have a
>> > dynamic-library-alist variable anyway.  It would be nice to put it
>> > somewhere that's not loaded by default, though, i.e. not simple.el...
>> 
>> Then please suggest a place, I'm always at a loss to know where to put
>> things (often the name, one-line description and real use of a package
>> are at odds)...

> How about a new package under emacs-lisp/ or progmodes/ ?  Something
> like shared-libraries.el?

How 'bout lisp/misc.el?


        Stefan



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

* Re: proposed `list-dynamic-libraries'
  2011-05-09 14:26       ` Stefan Monnier
@ 2011-05-09 14:34         ` Juanma Barranquero
  2011-05-09 15:37           ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Juanma Barranquero @ 2011-05-09 14:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, cyd, emacs-devel

On Mon, May 9, 2011 at 16:26, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> How 'bout lisp/misc.el?

;;; misc.el --- some nonstandard basic editing commands for Emacs

and all misc.el commands (except for the XKCD-inspired `butterfly')
are related to editing, which list-dynamic-libraries most definitely
is not.

But if you think it's a good place, there it goes.

    Juanma



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

* Re: proposed `list-dynamic-libraries'
  2011-05-09 14:16       ` Juanma Barranquero
@ 2011-05-09 14:53         ` Eli Zaretskii
  2011-05-09 15:03           ` Juanma Barranquero
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2011-05-09 14:53 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: cyd, emacs-devel

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Mon, 9 May 2011 16:16:49 +0200
> Cc: cyd@stupidchicken.com, emacs-devel@gnu.org
> 
> > Something like shared-libraries.el?
> 
> The variable is called `dynamic-library-alist', so
> dynamic-libraries.el would make more sense IMHO.

"Shared library" is the Posix terminology for that, and "shared" is 1
character shorter than "dynamic", which means we don't run the risk of
file-name clash on 8+3 filesystems if we want another
"dynamic-something" file there. ;-)

But that was just a suggestion.




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

* Re: proposed `list-dynamic-libraries'
  2011-05-09 14:53         ` Eli Zaretskii
@ 2011-05-09 15:03           ` Juanma Barranquero
  2011-05-09 15:24             ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Juanma Barranquero @ 2011-05-09 15:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: cyd, emacs-devel

On Mon, May 9, 2011 at 16:53, Eli Zaretskii <eliz@gnu.org> wrote:

> "Shared library" is the Posix terminology for that

Well, yeah, though currently POSIX shared libraries is exactly what
dynamic-library-alist is *not* being used for ;-)

> and "shared" is 1
> character shorter than "dynamic", which means we don't run the risk of
> file-name clash on 8+3 filesystems if we want another
> "dynamic-something" file there. ;-)

Like lisp/dynamic-setting.el, you mean?

> But that was just a suggestion.

shared-libraries.el is OK, though seems that Stefan prefers to put it
in misc.el. I don't really mind one way or another.

    Juanma



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

* Re: proposed `list-dynamic-libraries'
  2011-05-09 15:03           ` Juanma Barranquero
@ 2011-05-09 15:24             ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2011-05-09 15:24 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: cyd, emacs-devel

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Mon, 9 May 2011 17:03:57 +0200
> Cc: cyd@stupidchicken.com, emacs-devel@gnu.org
> 
> > and "shared" is 1
> > character shorter than "dynamic", which means we don't run the risk of
> > file-name clash on 8+3 filesystems if we want another
> > "dynamic-something" file there. ;-)
> 
> Like lisp/dynamic-setting.el, you mean?

Yep.



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

* Re: proposed `list-dynamic-libraries'
  2011-05-09 14:34         ` Juanma Barranquero
@ 2011-05-09 15:37           ` Stefan Monnier
  2011-05-09 15:53             ` Juanma Barranquero
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2011-05-09 15:37 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Eli Zaretskii, cyd, emacs-devel

>> How 'bout lisp/misc.el?

> ;;; misc.el --- some nonstandard basic editing commands for Emacs

> and all misc.el commands (except for the XKCD-inspired `butterfly')
> are related to editing, which list-dynamic-libraries most definitely
> is not.

> But if you think it's a good place, there it goes.

I don't think it matters much.  I'm just not expecting this
list-libraries to grow much in the future nor to be of regular use (it's
more like a debugging tool you might use occasionally).  The former
tells me that it might not deserve its own file, the latter tells me
that it doesn't matter if loading it causes unrelated code to be loaded
as well.


        Stefan



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

* Re: proposed `list-dynamic-libraries'
  2011-05-09 15:37           ` Stefan Monnier
@ 2011-05-09 15:53             ` Juanma Barranquero
  0 siblings, 0 replies; 12+ messages in thread
From: Juanma Barranquero @ 2011-05-09 15:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, cyd, emacs-devel

On Mon, May 9, 2011 at 17:37, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> The former
> tells me that it might not deserve its own file, the latter tells me
> that it doesn't matter if loading it causes unrelated code to be loaded
> as well.

Committed in misc.el.

    Juanma



^ 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.