From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#13269: 24.3.50; modifying bindings in `visual-line-mode-map' has no effect Date: Mon, 24 Dec 2012 11:24:51 -0800 Message-ID: <720047F541044758A7AA47005253712C@us.oracle.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1356377137 30109 80.91.229.3 (24 Dec 2012 19:25:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Dec 2012 19:25:37 +0000 (UTC) To: <13269@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 24 20:25:52 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TnDen-0008Sp-Kj for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Dec 2012 20:25:49 +0100 Original-Received: from localhost ([::1]:49706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnDeZ-0004Q8-H6 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Dec 2012 14:25:35 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnDeV-0004Q1-St for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 14:25:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnDeU-0003t0-Ne for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 14:25:31 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnDeU-0003su-Ji for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 14:25:30 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TnDez-0002tm-SP for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 14:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Dec 2012 19:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13269 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13269-submit@debbugs.gnu.org id=B13269.135637714411114 (code B ref 13269); Mon, 24 Dec 2012 19:26:01 +0000 Original-Received: (at 13269) by debbugs.gnu.org; 24 Dec 2012 19:25:44 +0000 Original-Received: from localhost ([127.0.0.1]:58443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TnDeg-0002tB-II for submit@debbugs.gnu.org; Mon, 24 Dec 2012 14:25:43 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:39805) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TnDed-0002t3-DT for 13269@debbugs.gnu.org; Mon, 24 Dec 2012 14:25:40 -0500 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qBOJP6jj008361 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <13269@debbugs.gnu.org>; Mon, 24 Dec 2012 19:25:07 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qBOJP5Is015076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <13269@debbugs.gnu.org>; Mon, 24 Dec 2012 19:25:06 GMT Original-Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qBOJP5vf027570 for <13269@debbugs.gnu.org>; Mon, 24 Dec 2012 13:25:05 -0600 Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Dec 2012 11:25:04 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac3h/SD5BzwNLWv4QeGMWbD9FflljQAC0ObA X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:69015 Archived-At: My bad. Using the add-hook to change bindings does work OK. (Though I forgot to include the map var in the add-hook sexp that I wrote in the report.) And I guess this is why evalling the defvar has no effect: The defvar value starts from a virgin map, so the var then points to a different keymap object (i.e., cons cell) than it did initially, when it was used to define the mode. I did not realize that that would be a problem. I thought that the mode function looked up the variable value to get the actual keymap. If I do the add-hook or just (define-key visual-line-mode-map "\C-e" 'foobar) then the binding does take effect. Doing that, the var still points to the same keymap object, i.e., the same cons as originally, and the define-key just adds or modifies a binding there. If my understanding is now correct, this is a gotcha that should clarified in the doc. The minor mode does not go through the variable at all, it goes directly to the keymap value (i.e., the cons cell) that the variable had at the time the mode was defined. This is not obvious, given that `define-minor-mode' is a macro, so does not in general evaluate its args. It is not clear from the doc that the keymap object itself is what is used by the mode and not first the variable. The doc does not say that the KEYMAP arg or :keymap parameter is _evaluated_, but it does kind of suggest it indirectly: Optional KEYMAP is the default keymap bound to the mode keymap. If non-nil, it should be a variable name (whose value is a keymap), or an expression that returns either a keymap or a list of arguments for `easy-mmode-define-keymap'. If you supply a KEYMAP argument that is not a symbol, this macro defines the variable MODE-map and gives it the value that KEYMAP specifies. First, "it should be a variable name" is wrong, since a variable name is a string, the `symbol-name' of the variable (which is a symbol). You cannot pass a variable name for KEYMAP. Second, "variable name (whose value is a keymap)" is wrong. The name has no value (except itself: the same string). It is the variable's value that is a keymap, not the variable's name's value. This text is generally confusing. It should simply say that KEYMAP is _evaluated_ when the mode is defined, and the resulting value must be either a keymap or "a list of arguments for `easy-mmode-define-keymap'." Less verbose, correct, and clear. All the talk about a variable and its name is noise and confusing (and wrong as written). HTH. If you think I have still not understood correctly, please set me straight. Thx.