From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Scott Frazer Newsgroups: gmane.emacs.devel Subject: Per-mode obarray for M-x Date: Sun, 6 Mar 2011 08:04:42 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1299417302 30164 80.91.229.12 (6 Mar 2011 13:15:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Mar 2011 13:15:02 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 06 14:14:58 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 1PwDnW-0004HM-9P for ged-emacs-devel@m.gmane.org; Sun, 06 Mar 2011 14:14:58 +0100 Original-Received: from localhost ([127.0.0.1]:33057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwDnV-00066I-Ox for ged-emacs-devel@m.gmane.org; Sun, 06 Mar 2011 08:14:57 -0500 Original-Received: from [140.186.70.92] (port=35127 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwDdc-0002P1-MO for emacs-devel@gnu.org; Sun, 06 Mar 2011 08:04:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwDdb-000862-JK for emacs-devel@gnu.org; Sun, 06 Mar 2011 08:04:44 -0500 Original-Received: from mail-gx0-f169.google.com ([209.85.161.169]:50205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwDdb-00085v-GT for emacs-devel@gnu.org; Sun, 06 Mar 2011 08:04:43 -0500 Original-Received: by gxk2 with SMTP id 2so1718353gxk.0 for ; Sun, 06 Mar 2011 05:04:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=Bo12HIZY9NNhjq5The5bvQyQDwdQGyWXzBJLeBGcdCY=; b=hNg7fQmEMGWY+BjVM2NZ5SoXG3zXK009Qp/MfdZlPBRnptEdqQYvWNemKT+tne/xlu XETrGlHTLQBmM53Bm/5/UUFnHFXt3uTrTGW3g9J58901sPFlUrnwK1dQ/ZXhnXEyjkY4 EbWop7wV20aQUFqJTzxaD69xRnA7KNWVRM8Ss= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=OSlMhVqb9v28qQJcZSPgiFA7NnzUjvA0Cfg5Pugvu8L/Bnza1hF+sFcaSpXhc5GYYg Jd9i7N6AKGNwShZHic6ZybQpSx9gjc7z/oqsF3g6L/MVHps2Pc8gDZn1mbR+O2SFfLiK 4bFxgw+jsWps0I3Az2LdG1TcuB9a1ryp8VuOg= Original-Received: by 10.100.147.14 with SMTP id u14mr810815and.101.1299416682611; Sun, 06 Mar 2011 05:04:42 -0800 (PST) Original-Received: by 10.100.207.12 with HTTP; Sun, 6 Mar 2011 05:04:42 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.169 X-Mailman-Approved-At: Sun, 06 Mar 2011 08:14:52 -0500 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:136810 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. Here's why I'd like this. There are some commands I run somewhat often, but they have long and/or difficult to remember names. For example auto-revert-tail-mode. I am thinking as I type "Is it auto-revert-tail-mode or auto-tail-revert-mode?" I don't do it often enough to take up a valuable short key binding like "C-c t", and long key bindings can be just as difficult to remember. Even with minibuffer completion it interrupts my workflow, so I do "(defalias 'auto-revert-tail-mode 'tail)" and it becomes just "M-x tail". That's fine in this case, but you can see how I'm going to quickly run into problems since there is only one namespace. I understand this would be a huge undertaking if I wanted this to work in general elisp code, which is why prefixes are used in function names to create namespaces. But I just want it to work with M-x. I am willing to dig around and make a patch myself, but I'd like someone familiar with the internals to (a) tell me if it's extremely difficult and/or a bad idea, and if not (b) point me in the right direction. Regards, Scott