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 09:35:56 -0800 Message-ID: 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 1356370596 11451 80.91.229.3 (24 Dec 2012 17:36:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Dec 2012 17:36:36 +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 18:36: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 1TnBxL-0008Ec-4H for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Dec 2012 18:36:51 +0100 Original-Received: from localhost ([::1]:58841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnBx6-0002E5-U6 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Dec 2012 12:36:36 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnBx3-0002Dp-9Y for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 12:36:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnBx1-0001by-8v for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 12:36:33 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnBx1-0001bn-61 for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 12:36:31 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TnBxW-0000QQ-7O for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 12:37: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 17:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13269 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.13563706201624 (code B ref -1); Mon, 24 Dec 2012 17:37:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Dec 2012 17:37:00 +0000 Original-Received: from localhost ([127.0.0.1]:58399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TnBxT-0000Q8-PR for submit@debbugs.gnu.org; Mon, 24 Dec 2012 12:37:00 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47716) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TnBxQ-0000Q0-3A for submit@debbugs.gnu.org; Mon, 24 Dec 2012 12:36:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnBwp-0001Xr-NQ for submit@debbugs.gnu.org; Mon, 24 Dec 2012 12:36:24 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:40184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnBwp-0001Xl-KJ for submit@debbugs.gnu.org; Mon, 24 Dec 2012 12:36:19 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnBwn-0002Cs-FN for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 12:36:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnBwk-0001Ui-4O for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 12:36:17 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:22599) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnBwj-0001UE-TT for bug-gnu-emacs@gnu.org; Mon, 24 Dec 2012 12:36:14 -0500 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qBOHaA4L024085 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Dec 2012 17:36:11 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qBOHaAEM029888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 24 Dec 2012 17:36:10 GMT Original-Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qBOHa98j013096 for ; Mon, 24 Dec 2012 11:36:09 -0600 Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 24 Dec 2012 09:36:09 -0800 X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac3h/SD5BzwNLWv4QeGMWbD9FflljQ== X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:69010 Archived-At: OK, I assume I must be doing something wrong, but I don't know what, and the doc does not seem to help. `visual-line-mode' is a non-global minor mode defined using `define-minor-mode' with a :keymap parameter. If I redefine the keymap using `C-M-x' on a (defvar visual-line-mode-map...), or using setq, the keymap is modified as I would expect. C-h v shows this clearly. But that has no effect on the key bindings in `visual-line-mode'. It seems like variable `visual-line-mode-map' is being ignored. Same thing if I evaluate the defvar in the same buffer as the mode (though I don't really expect it would be a local variable, and C-h v does not say it is local). And toggling the mode does not change anything. When I check the keymap itself, it is defined exactly according to my modification. But those keys are not available in the mode itself; instead, the original key bindings for the mode are still active. Likewise, if instead of evaluating the defvar I use this: (add-hook 'visual-line-mode-hook (lambda () (define-key "\C-e" 'foobar) ...)) That too modifies the value of variable `visual-line-mode-map' just as I expect, but it does not change the actual bindings available in in visual-line mode. What am I missing? The only thing I have found to work is to re-evaluate the `define-minor-mode' sexp after redefining the keymap, so that the redefinition picks up the new defvar. Obviously, that is not a reasonable solution, e.g., for a library or user who wants to modify the key bindings. It's as if the mode were defined once and for all using the value of the keymap at the time of `define-minor-mode', and not defined to point to the _variable_ `visual-line-mode-map'. Do I have to fiddle with `minor-mode-map-alist' or something? I do not see this problem with other minor modes, even though the value of that alist shows that the modes are associated with actual keymaps and not keymap variables. BTW, the doc in (elisp) Keymaps and Minor Modes seems incomplete. It says: "To set up a keymap for a minor mode, add an element to the alist `minor-mode-map-alist'." That does not seem right, or at least not complete. Using `define-minor-mode' with KEYMAP or :keymap should also be sufficient to set up a keymap for a minor mode. For a node that purports to cover the topic of keymaps and minor modes, this doc seems insufficient. (And `minor-mode-overriding-map-alist' is nil.) Please tell me what I am missing. I doubt that there is an Emacs bug here, but I don't know. Seems like one should be able to change a key binding in `visual-line-mode-map' and have that take effect. In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600) of 2012-12-18 on MS-W7-DANI Bzr revision: 111265 eliz@gnu.org-20121218190556-x9wmq083vwecgu0f Windowing system distributor `Microsoft Corp.', version 5.1.2600 Configured using: `configure --with-gcc (4.7) --no-opt --enable-checking --cflags -Ic:/emacs/libs/libXpm-3.5.10/include -Ic:/emacs/libs/libXpm-3.5.10/src -Ic:/emacs/libs/libpng-dev_1.4.3-1_win32/include -Ic:/emacs/libs/zlib-dev_1.2.5-2_win32/include -Ic:/emacs/libs/giflib-4.1.4-1-lib/include -Ic:/emacs/libs/jpeg-6b-4-lib/include -Ic:/emacs/libs/tiff-3.8.2-1-lib/include -Ic:/emacs/libs/libxml2-2.7.8-w32-bin/include/libxml2 -Ic:/emacs/libs/gnutls-3.0.9-w32-bin/include -Ic:/emacs/libs/libiconv-1.9.2-1-lib/include'