From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: How to get all commands defined in a specified file (or files)? Date: Mon, 11 Nov 2024 22:18:36 +0200 Message-ID: <86ttcdikwz.fsf@gnu.org> References: <87zfm5woji.fsf@mbork.pl> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8428"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 11 21:19:04 2024 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 1tAasK-00020V-8d for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 11 Nov 2024 21:19:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAas0-000596-OB; Mon, 11 Nov 2024 15:18:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAary-00058i-Fj for help-gnu-emacs@gnu.org; Mon, 11 Nov 2024 15:18:42 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAary-0008FK-7m for help-gnu-emacs@gnu.org; Mon, 11 Nov 2024 15:18:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9jpFeYaOSD2exJr+WL9vykQjsFmmUD3B8/561NVWQV8=; b=o+7jyJfmz5PM Km+m5ywq24BYSuC7Vr/H2nHffEGkerq1HLjh6jOuyVDZABCrv6UJfCcu+uel6MVIvEWyJlCNxPulH YAylC6/Pv3ps6RtHlBxMBVUalvj0WgOYv+8oqvm3UiirXBsn5aX7S825Wf83NxdUGlivytx/hqpUM jVyuHaYPx8YSA/fiYBCfIhd7n0eIYLreSdo2uPV7sbWtVgUv7de1cD8+tgcq/GxUY4wMMWy+6Hnu7 6OgURtabqDe06MDoZx3veTeYYBxwVpt4zd1YwErzT2FUklkLyG3WXUPieVfs+mz9jxRDJGY6OZd7V XRGiODbTZML4LzDXtNKm4w==; In-Reply-To: <87zfm5woji.fsf@mbork.pl> 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148316 Archived-At: > From: mbork@mbork.pl > Date: Mon, 11 Nov 2024 20:36:33 +0100 > > Hi all, > > say that I'd like to define a `execute-extended-command' alternative > which would only allow to run commands defined in a specified file. How > can I get all such commands? I know about `symbol-file', but I don't > know how it works (and it's complicated enough that I'm not sure I want > to study it ATM;-) - I tried to instrument it for edebug, but a quick > run revealed only that it's pretty mysterious). I also looked at the > property plist of a function name and saw that the filename is not kept > there. Any hints? We have a facility to mark commands as relevant to a major mode or a list of major modes. If your file defines a major mode, you can use this for doing what you want. See the command execute-extended-command-for-buffer. A more general facility is the variable read-extended-command-predicate.