all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Simple and fast way to access interactive functions associated with a package
@ 2022-08-15 21:39 uzibalqa via Users list for the GNU Emacs text editor
  2022-08-16  0:20 ` Eduardo Ochs
  0 siblings, 1 reply; 2+ messages in thread
From: uzibalqa via Users list for the GNU Emacs text editor @ 2022-08-15 21:39 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

I am using M-x protoc to show me the interactive functions provided by the package protoc. Is it possible

to have a shortcut for displaying protoc related functions without having to write protoc TAB after calling M-x?

For instance, the following fails

(global-set-key (kbd "H-x") (kbd "M-x protoc"))

As I understand, there exists no association between functions (or variables) and the packages they were defined in,

nor are packages even first–class objects. There is just the global environment and whatever functions (and variables)

that have been defined therein.

By convention one names the functions and variables defined in a package with a prefix that contains or is at least

similar to the package name. Perhaps one could manage the list of known symbols using mapatoms, searching for

those that are fboundp and have the prefix one are looking for.

But I do not know how an actual implementation could look like. Or whether it is a good plan.

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

* Re: Simple and fast way to access interactive functions associated with a package
  2022-08-15 21:39 Simple and fast way to access interactive functions associated with a package uzibalqa via Users list for the GNU Emacs text editor
@ 2022-08-16  0:20 ` Eduardo Ochs
  0 siblings, 0 replies; 2+ messages in thread
From: Eduardo Ochs @ 2022-08-16  0:20 UTC (permalink / raw)
  To: uzibalqa; +Cc: help-gnu-emacs@gnu.org

On Mon, 15 Aug 2022 at 18:40, uzibalqa via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> I am using M-x protoc to show me the interactive functions provided by the package protoc. Is it possible
>
> to have a shortcut for displaying protoc related functions without having to write protoc TAB after calling M-x?
>
> For instance, the following fails
>
> (global-set-key (kbd "H-x") (kbd "M-x protoc"))
>
> As I understand, there exists no association between functions (or variables) and the packages they were defined in,
>
> nor are packages even first–class objects. There is just the global environment and whatever functions (and variables)
>
> that have been defined therein.
>
> By convention one names the functions and variables defined in a package with a prefix that contains or is at least
>
> similar to the package name. Perhaps one could manage the list of known symbols using mapatoms, searching for
>
> those that are fboundp and have the prefix one are looking for.
>
> But I do not know how an actual implementation could look like. Or whether it is a good plan.


Hi Uzibalqa,

are you looking for hints on how to write these functions yourself?
If yes, then:

  1. You can define something like this:

       (global-set-key (kbd "H-x")
         (lambda () (interactive (insert "protoc-"))))

     and then type `M-x H-x' to get the effect of `M-x protoc-';

  2. Hyperbole seems to have a way of simulating keypresses that is
     much better - for some value of "much better", of course - than
     this:

       (execute-kbd-macro (read-kbd-macro "M-x protoc-"))

     I _guess_ that a Hyperbole button like {M-x protoc-} may do what
     you need - so we only need someone who knows how call the innards
     of Hyperbole from Lisp, and who can show us how to write an elisp
     function that would behave as if the user had typed `M-x protoc-'.
     All my attempts to learn how the inner parts of Hyperbole work
     have failed VERY miserably, so I'm burnt out and I can't help you
     with that, but I would love to see a solution.

  3. Try to pretty-print the results of:

       (apropos-internal "^protoc-.*$" 'commandp)
       (mapcar 'car load-history)
       (assoc (symbol-file 'find-file 'defun) load-history)

     Eev has some functions to inspect the global obarray that are
     based on the three sexps above, but most people consider eev too
     weird.

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev



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

end of thread, other threads:[~2022-08-16  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-15 21:39 Simple and fast way to access interactive functions associated with a package uzibalqa via Users list for the GNU Emacs text editor
2022-08-16  0:20 ` Eduardo Ochs

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.