From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uday S Reddy Newsgroups: gmane.emacs.devel Subject: Re: Key bindings proposal Date: Tue, 27 Jul 2010 17:41:43 +0100 Message-ID: <19535.3143.113000.779009@gargle.gargle.HOWL> References: <19534.1494.627000.357123@gargle.gargle.HOWL> <87sk35upn2.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1280248929 22768 80.91.229.12 (27 Jul 2010 16:42:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Jul 2010 16:42:09 +0000 (UTC) Cc: Uday S Reddy , Teemu Likonen , "Stephen J. Turnbull" , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 27 18:42:06 2010 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 1OdnEE-0001Bm-EQ for ged-emacs-devel@m.gmane.org; Tue, 27 Jul 2010 18:42:06 +0200 Original-Received: from localhost ([127.0.0.1]:50339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdnED-0003jQ-QK for ged-emacs-devel@m.gmane.org; Tue, 27 Jul 2010 12:42:05 -0400 Original-Received: from [140.186.70.92] (port=52834 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdnE4-0003iL-WF for emacs-devel@gnu.org; Tue, 27 Jul 2010 12:41:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdnE3-0006du-KW for emacs-devel@gnu.org; Tue, 27 Jul 2010 12:41:56 -0400 Original-Received: from sun61.bham.ac.uk ([147.188.128.150]:58086) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdnE3-0006da-GB for emacs-devel@gnu.org; Tue, 27 Jul 2010 12:41:55 -0400 Original-Received: from [147.188.128.127] (helo=bham.ac.uk) by sun61.bham.ac.uk with esmtp (Exim 4.67) (envelope-from ) id 1OdnDy-0001se-NP; Tue, 27 Jul 2010 17:41:50 +0100 Original-Received: from mx1.cs.bham.ac.uk ([147.188.192.53]) by bham.ac.uk with esmtp (Exim 4.43) id 1OdnDt-0003Ya-E2; Tue, 27 Jul 2010 17:41:50 +0100 Original-Received: from acws-0068.cs.bham.ac.uk ([147.188.194.56]) by mx1.cs.bham.ac.uk with esmtp (Exim 4.51) id 1OdnDt-0002Yp-7R; Tue, 27 Jul 2010 17:41:45 +0100 Original-Newsgroups: gmane.emacs.devel In-Reply-To: X-Mailer: VM 8.1.92a under 23.1.1 (i386-mingw-nt5.1.2600) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:127878 Archived-At: Stefan Monnier writes: > Not at all. `remap' is typically not used by the user in his .emacs but > by major/minor modes to locally/temporarily replace particular commands > by other ones (and to do so in a declarative way ;-), so that if the > user (or some other mode) has rebound this command elsewhere, the > remapping still works as intended. Before that, packages used > substitute-key-definition for that purpose, but that was not as > declarative and it only adapted to changes in global bindings. Indeed. Not only is it declarative, but it is also object-oriented (or "subtyped" or "conformant"). When you bind [remap undo] to a mode-specific undo operation, you are inheriting the key binding made for undo somewhere else. At least for this operation, you are conforming to some global theme that has been established for the user. The world outside Emacs is heavily object-oriented. And, that has brought a tremendous amount of order to the world of user interfaces. We take it for granted that every application will have a suitable implementation for generic operations like "open", "close", "refresh" and "help". Unfortunately, all of this civilizational progress is passing Emacs by. Just a few weeks ago, somebody here was bemoaning how the inconsistency of "refresh" in Emacs modes drives him nuts. However, I think we can do better than remap. remap allows ad-hoc inheritance to grow up in fits and sneezes wherever it feels like. It is not proper subtyping. Oscar Fuentes had a proposal here on 7/17 which I am drawn to: > I possible solution for this problem is to use `actions'. An action is a > generic concept like `fordward-line', or `undo', or `save', or `yank' > (`paste', if you prefer.) `universal-argument', > `execute-extended-command' and `C-x' (whatever is officially called on > Emacs jargon) would be actions as well. > > Currently a mode defines its keymap relating keys to functions. An > action-aware mode relates actions to functions. At a higher level, there > is a mapping of keys into actions. When a mode is activated for a > buffer, the keymap is constructed looking up the corresponding keys > assigned to the actions the mode implements. A mode inherits the > key->action mapping from its parent mode, but can define its own actions > that overrides its parent's. It seems to me that these "actions" are a form of abstract operations. The actions implemented by a mode can be regarded as its interface. Some of these actions might have globally defined key bindings, some might be local, and some might have no key bindings. It might be possible to invoke actions with the M-x prefix or something like it. Emacs would immediately feel a lot more object-oriented than it currently does. Cheers, Uday