From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: Enhancements to "minor-mode-map-alist" functionality. Date: Mon, 15 Apr 2002 08:34:51 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200204151234.g3FCYq500838@rum.cs.yale.edu> References: <5xbscpg7zl.fsf@kfs2.cua.dk> <200204131905.g3DJ5cC22812@aztec.santafe.edu> <5xbscnb2hh.fsf@kfs2.cua.dk> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1018874173 11105 127.0.0.1 (15 Apr 2002 12:36:13 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 15 Apr 2002 12:36:13 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16x5iO-0002t0-00 for ; Mon, 15 Apr 2002 14:36:12 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16x607-00040l-00 for ; Mon, 15 Apr 2002 14:54:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16x5iM-0004f9-00; Mon, 15 Apr 2002 08:36:10 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16x5h9-0004XB-00 for ; Mon, 15 Apr 2002 08:34:55 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g3FCYq500838; Mon, 15 Apr 2002 08:34:52 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: storm@cua.dk (Kim F. Storm) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2637 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2637 > The fundamental problem is that some modes (like viper and cua) makes > some quite fundamental changes to the way some of the standard keys > works [cua remaps C-c and C-x depending on the current state of the > mark (and other conditions), while viper operates in command or insert > mode]. BTW: some code in keyboard.c does something very much like function-key-map, except in a hard-coded way (drop down-mouse events if they're unbound, turn doube-clicks into single clicks if unbound, turn upper case into lower case if unbound, my own local code has added down-modifier and up-modifier events (I wanted to see if we could get a behavior similar to Windows' Alt-TAB thingy which requires catching the up-Alt event) and has correspondingly added code to drop those modifiers if they're not bound, ...). I was thinking of adding some kind of predicate binding, halfway between normal bindings and default bindings. Something like (define-key function-key-map [uppercase-p] 'map-to-lowercase) where uppercase-p is a function that takes an event and returns a boolean. In your case maybe you could save some keymap handling by doing something like (define-key cua-mode-map [conditional-control-x] 'cua-cut) where conditional-control-x returns non-nil iff the event is C-x and the mark is active. Or maybe in your specific case we could more simply reuse something existing: (define-key cua-mode-map [?\C-x] '(menu-item "cut" 'cua-cut :enable mark-active)) Making this work might be a simple matter of a few lines in get_keyelt. Stefan