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: ffap bindings suggestion Date: Sun, 12 Feb 2006 07:51:25 -0800 Message-ID: References: <87lkwgd7bx.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1139761433 25378 80.91.229.2 (12 Feb 2006 16:23:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 12 Feb 2006 16:23:53 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 12 17:23:51 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F8K0m-0005nG-3P for ged-emacs-devel@m.gmane.org; Sun, 12 Feb 2006 17:23:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F8K0l-0003bj-9q for ged-emacs-devel@m.gmane.org; Sun, 12 Feb 2006 11:23:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F8JVu-0007Qz-W1 for emacs-devel@gnu.org; Sun, 12 Feb 2006 10:51:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F8JVo-0007LF-7O for emacs-devel@gnu.org; Sun, 12 Feb 2006 10:51:48 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F8JVn-0007K1-Fg for emacs-devel@gnu.org; Sun, 12 Feb 2006 10:51:43 -0500 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1F8Ja2-0003dA-U6 for emacs-devel@gnu.org; Sun, 12 Feb 2006 10:56:07 -0500 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.186.50]) by agminet01.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k1CFpgi3014282 for ; Sun, 12 Feb 2006 09:51:42 -0600 Original-Received: from rgmsgw301.us.oracle.com (localhost [127.0.0.1]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k1CFpfqL032207 for ; Sun, 12 Feb 2006 08:51:41 -0700 Original-Received: from dradamslap (dhcp-amer-csvpn-gw1-141-144-64-65.vpn.oracle.com [141.144.64.65]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id k1CFpeEp032195 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sun, 12 Feb 2006 08:51:41 -0700 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <87lkwgd7bx.fsf-monnier+emacs@gnu.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE 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:50406 Archived-At: In one of my libraries, I use a minor mode, and restore the original bindings when the mode is exited. I find that clean. However, the library currently just restores the vanilla Emacs (-q) bindings; it would of course be better to save the bindings at the time of entry into the mode, and restore those (original user bindings) when the mode is exited. I'm not referring here to a keymap that is local to the mode; in my case, the minor mode changes minibuffer key bindings. (Using a local keymap is obviously the way to go when appropriate.) Is there no recommended way (or recommended ways) to handle this? It's not uncommon for a library to let users adopt the library's suggested (multiple, often global) bindings in some easy way. Perhaps we should come up with a recommended way for libraries to do that. That way should, in the best case, let users get back their original bindings when they no longer want to use the features of the library. No ideas/opinions on this? Too general for me to answer. I'm not really sure what you're talking about. Make it more concrete. When minor mode is turned on: (substitute-key-definition 'scroll-up 'foobar-cmd minibuffer-local-completion-map global-map) When it is turned off: (substitute-key-definition 'scroll-up nil minibuffer-local-completion-map global-map) That's what I do: bind keys that are bound globally to `scroll-up' to `foobar-cmd' in minibuffer-local-completion-map. Then restore those keys to their original bindings in minibuffer-local-completion-map. I'm asking for a recommended way to accomplish this. I think you've already seen here some example code that modifies a keymap and then restores the original one, using inheritance (so the "save" and the "restore" of changed key-bindings are done in one step each). Could you please point to that information (discussion). I searched for "inherit" + "map", but I didn't notice it. Again, the need is to modify an existing keymap (such as minibuffer-local-completion-map), not to use another keymap. Existing code expects to use the existing map.