From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: Re: Simple and fast way to access interactive functions associated with a package Date: Mon, 15 Aug 2022 21:20:07 -0300 Message-ID: References: <44Ss7Mk4ALBre644NDAEBtjNM13vA-IwdWduG69XwvTqisLfikGRT311QWEpCmxRUpBtNn7omqx0Z7esDjZ29_SegF1L_T6tlGkUktDd2Hg=@proton.me> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15441"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "help-gnu-emacs@gnu.org" To: uzibalqa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 16 02:21:12 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oNkKV-0003sY-H1 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 16 Aug 2022 02:21:11 +0200 Original-Received: from localhost ([::1]:57936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNkKU-0000eT-G4 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 15 Aug 2022 20:21:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNkJi-0000c9-VB for help-gnu-emacs@gnu.org; Mon, 15 Aug 2022 20:20:23 -0400 Original-Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]:34593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNkJh-0002Nu-80 for help-gnu-emacs@gnu.org; Mon, 15 Aug 2022 20:20:22 -0400 Original-Received: by mail-io1-xd2f.google.com with SMTP id x64so7149322iof.1 for ; Mon, 15 Aug 2022 17:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc; bh=Kf3lcX6e4MYxpSWLbSwA3j9qUi03riambQO+WX2MHM4=; b=CwQ+HGrc6/aI1VUvYp+hpTr3CFUo/EFCENvvub2zzX+rju/TdmHsnmaabzg7MDUazN 9c5nKZ7Ag/bHe1Nr+xpKOSbYAXxENnWdWSGGsyRi0b4/PofaHV/9tj85TyAc6bM9V1jQ 7p/qHjNCexiH/3ZEf2GPf270aW42Gh6dLz67f8JISOfmQ3WNhExqoQGhEuz/uu8Oslyu EBRz8SXqOUwYJtpDDZCKW9ghz3BPBlTqTXFojkkNIsQVkvV4p+vf3N5AbUoD0YkRM6H7 /zLghUxjrVQ0fVh66tyNQKseFtti+J2nxGa5cCSSZcpUJ9Vqxd6OvAoR84ZHHVYbgEaM L4jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc; bh=Kf3lcX6e4MYxpSWLbSwA3j9qUi03riambQO+WX2MHM4=; b=SZd995+8Wc+qkvTEmiAFI9nh9vCE47zVU7v45zpCE2WNfYRElbpHWTLtjYMUHGHntx oV2Ga1FLQGj1LALRv5vGrMyp2yEppjJ5WNqmWznmvb9UCgiWHpQ0c5gVKfjq3xy29lzg nO0eFzhvx+w1jAaQfOM/NQ1AwVwC5g2elcGGO0EL5h2XPOoqK5WovcUVlPiNIPwIMKKo PVQPA9u5rzuIrdvEDdpmqtwoYpf7fetMs441J8J6Iy4EgGU25Vh3r6pRhVfnhiDXQpqr SnlpuuJ+0wOQEaTr5sJonHuQWuLogMytYDyr6GPreEAKC0QhcQWkoPd+SxybrnBEoGKr 0Zpw== X-Gm-Message-State: ACgBeo1EzWIFaR0WowhA0h0P9CJ2XCiJ2OmFRh05yFbpNPpb4UlBcsUf mEHvtNOJH+uB1PyTw8va4TMDWQo8C7TtA3iFkjk= X-Google-Smtp-Source: AA6agR76VtAXYck88co1b2+28oOgSBmbwNoaM4LssXo3R6BGEYpgIj2rFBz7rCZqs96Ms9L+YqjwtYpBP/MgFhs6V9c= X-Received: by 2002:a05:6638:160c:b0:343:4cdd:8fe5 with SMTP id x12-20020a056638160c00b003434cdd8fe5mr8825380jas.299.1660609219374; Mon, 15 Aug 2022 17:20:19 -0700 (PDT) In-Reply-To: <44Ss7Mk4ALBre644NDAEBtjNM13vA-IwdWduG69XwvTqisLfikGRT311QWEpCmxRUpBtNn7omqx0Z7esDjZ29_SegF1L_T6tlGkUktDd2Hg=@proton.me> Received-SPF: pass client-ip=2607:f8b0:4864:20::d2f; envelope-from=eduardoochs@gmail.com; helo=mail-io1-xd2f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138886 Archived-At: On Mon, 15 Aug 2022 at 18:40, uzibalqa via Users list for the GNU Emacs text editor wrote: > > I am using M-x protoc to show me the interactive functions provided by th= e 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 variab= les) and the packages they were defined in, > > nor are packages even first=E2=80=93class objects. There is just the glob= al 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 s= ymbols 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 whethe= r 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