From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: customizing key definitions with Customize Date: Wed, 14 May 2008 21:46:48 -0700 Message-ID: <002701c8b646$afedc3a0$0200a8c0@us.oracle.com> References: <000301c8b39e$ded16a50$0200a8c0@us.oracle.com><003701c8b438$9d6e9f20$0200a8c0@us.oracle.com><87r6c75brc.fsf@jurta.org> <87od79sttq.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1210826883 3548 80.91.229.12 (15 May 2008 04:48:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 May 2008 04:48:03 +0000 (UTC) Cc: emacs-devel@gnu.org To: , "'Juri Linkov'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 15 06:48:37 2008 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.50) id 1JwVOO-0004MW-Tt for ged-emacs-devel@m.gmane.org; Thu, 15 May 2008 06:48:37 +0200 Original-Received: from localhost ([127.0.0.1]:40802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwVNf-0004u1-CM for ged-emacs-devel@m.gmane.org; Thu, 15 May 2008 00:47:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JwVNY-0004rM-Fo for emacs-devel@gnu.org; Thu, 15 May 2008 00:47:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JwVNW-0004ny-A1 for emacs-devel@gnu.org; Thu, 15 May 2008 00:47:43 -0400 Original-Received: from [199.232.76.173] (port=37919 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JwVNW-0004np-0n for emacs-devel@gnu.org; Thu, 15 May 2008 00:47:42 -0400 Original-Received: from rgminet01.oracle.com ([148.87.113.118]:53232) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JwVNR-0002DK-Ig; Thu, 15 May 2008 00:47:37 -0400 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id m4F4lUif019150; Wed, 14 May 2008 22:47:30 -0600 Original-Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by rgmgw1.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id m4F4lTGA026891; Wed, 14 May 2008 22:47:30 -0600 Original-Received: from inet-141-146-46-1.oracle.com by acsmt351.oracle.com with ESMTP id 3672919581210826810; Wed, 14 May 2008 21:46:50 -0700 Original-Received: from dradamslap1 (/141.144.88.53) by bhmail.oracle.com (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 14 May 2008 21:46:50 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Aci14WeS7sF2CiUdRxqlv8LezUilIgAYbV7w X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:97181 Archived-At: > what the user will see: all current key bindings in this keymap > (this may be too many as some keymaps have dozens of key > bindings), > or an empty list with the single [Insert] button to add new key > bindings that will override the existing ones after saving the > Customization buffer. > > Perhaps we should handle this with two alternatives, like > customization of fonts. You can customize a font either in terms of > its appearance in the current kind of screen, or its general > conditions that apply to all kinds of screens. Perhaps we should handle it as I suggested: customize an option. A keymap-valued symbol is just a variable. Either such a variable could itself be made a user option or, as I showed, a separate but corresponding user option can be created. Both approaches can be treated the same way (e.g. as I indicated); it depends on what we want. If we want a given keymap variable itself to be completely customizable (i.e., for all of its keys), then we can just make it a defcustom of the sort I indicated. If we want some keymap variables not to be options, then we need not use defcustom for them. If we want a given keymap variable to have only some of its keys customizable (at least by default), then we can create a separate user option that corresponds to only those keys. The code I sent indicates how to do this. As I said, to make the option's customizable key definitions be the only ones in the keymap, it is enough to change the :set function I used so that it first empties the keymap, before it adds the customized keys. That is, if a keymap variable is to be completely customizable, then that is what we would want to do: make sure that :set not only adds bindings but also changes and deletes existing bindings. That is the same :set function I sent, but with the addition of a preliminary operation that empties the keymap, so that setting the option makes the keymap reflect just those key definitions that are present. Unlike faces, keymaps, apart from keymap-valued variables, do not have names, so the approach I suggested makes sense: customize keymap variables, not "first-class" keymap objects. We could instead entertain the idea of treating keymaps like faces - giving them names independently of using variables, but I don't see the point in that. It should be enough to turn, say, `lisp-mode-map' into a defcustom of the sort that I indicated, if we want to make it entirely customizable.