From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Per-mode obarray for M-x Date: Sun, 06 Mar 2011 15:04:16 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1299451689 27714 80.91.229.12 (6 Mar 2011 22:48:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Mar 2011 22:48:09 +0000 (UTC) Cc: emacs-devel@gnu.org To: Scott Frazer Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 06 23:48:05 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PwMk8-00076q-S2 for ged-emacs-devel@m.gmane.org; Sun, 06 Mar 2011 23:48:05 +0100 Original-Received: from localhost ([127.0.0.1]:45994 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwKC0-00061o-FO for ged-emacs-devel@m.gmane.org; Sun, 06 Mar 2011 15:04:40 -0500 Original-Received: from [140.186.70.92] (port=52733 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwKBi-0005Wi-2R for emacs-devel@gnu.org; Sun, 06 Mar 2011 15:04:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwKBe-0006sV-Ky for emacs-devel@gnu.org; Sun, 06 Mar 2011 15:04:19 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:55912 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwKBe-0006sK-Cd for emacs-devel@gnu.org; Sun, 06 Mar 2011 15:04:18 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAAZ3c03O+Lo//2dsb2JhbACmYHW9coViBIUcj3E X-IronPort-AV: E=Sophos;i="4.62,272,1297054800"; d="scan'208";a="94713806" Original-Received: from 206-248-186-63.dsl.teksavvy.com (HELO ceviche.home) ([206.248.186.63]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 06 Mar 2011 15:04:17 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id F1B82660D6; Sun, 6 Mar 2011 15:04:16 -0500 (EST) In-Reply-To: (Scott Frazer's message of "Sun, 6 Mar 2011 08:04:42 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136823 Archived-At: > How hard would it be to make a per-mode obarray for M-x? Sort of like > the per-mode keymap and abbrev tables, I'd like to do "M-x command" > and have it act differently depending on the mode; e.g. "M-x html" in > a org-mode buffer would run org-export-as-html, but the 'default' > action in other buffers would be to run, say, htmlize-buffer. I don't think you really want separate obarrays for this, you can just use lists of symbols. But you'd want mode-local abbreviations, maybe, or mode-local preferred commands, so TAB first tries one of those and only if those fail does it fallback to the full set of commands. There was also a suggestion to give easier access to commands from "the same mode/package", so M-x context->unified RET in a diff-mode buffer would run diff-context->unified. That would not be too difficult to do on the M-x side: the main 2 difficulties are: - how to populate this list/set of mode-local commands. - add the corresponding functionality to execute-extended-command, which would better be done by first re-writing it in Elisp. Rewriting execute-extended-command in Elisp would make it a lot easier to play around with such things. Stefan