From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Spenser Truex Newsgroups: gmane.emacs.devel Subject: Define-keys will not work with eshell-mode-map and patch Date: Wed, 19 Dec 2018 15:12:34 -0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0000000000006937de057d682892" X-Trace: blaine.gmane.org 1545261137 30280 195.159.176.226 (19 Dec 2018 23:12:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Dec 2018 23:12:17 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 20 00:12:13 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gZl0f-0007kW-D3 for ged-emacs-devel@m.gmane.org; Thu, 20 Dec 2018 00:12:13 +0100 Original-Received: from localhost ([::1]:34583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZl2m-0000Rr-6x for ged-emacs-devel@m.gmane.org; Wed, 19 Dec 2018 18:14:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZl1j-0000OL-Cr for emacs-devel@gnu.org; Wed, 19 Dec 2018 18:13:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZl1h-0000Pg-7n for emacs-devel@gnu.org; Wed, 19 Dec 2018 18:13:19 -0500 Original-Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:35318) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZl1f-0000OB-8l for emacs-devel@gnu.org; Wed, 19 Dec 2018 18:13:15 -0500 Original-Received: by mail-lj1-x22a.google.com with SMTP id x85-v6so18908123ljb.2 for ; Wed, 19 Dec 2018 15:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=QvTI9nRBIgZEaRBjbkRjaqOD2qT1/MVWB9r4e3Jk1ug=; b=aoHMlpUZ07ibTLzUx5CLaVMqJGaSPwQSfn8RBEbekyIyJ4fjEQjbSMWRXQMQp5I47M lgUSbFFaKFZaKJDmtGQxK/lKBompbYhxGRHJRwB8eGW/QaXJ1EWyoMcroxhi/h/S7wOs 4+u+gkbposXUTunMFd1fiMYX+7oak0f2fM0MmQRT3RPFxhSau33QKNuS329/Xhdh+fbg MRPDdqa+bmo07QRRgDsrPOuCey4uMREcn4V+r6+4vWEb6sj5injOoazt6Jfgnu9o7BIy A9/hj7YQhu1F+I5Pyb833+PNE2KQwau9kqeaL/RaC2PuL5b2F3OioAMBh1RK0YEmVNGc fkaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=QvTI9nRBIgZEaRBjbkRjaqOD2qT1/MVWB9r4e3Jk1ug=; b=soXCPJpZQvUKWJytpKGiu05sSMXQfCE2rNINJkmHidQ+eo72tqhMpBPXThaq4TrNCx H5yoaLGJRympXMjaLZbeB0au8cdQpiem2i81B2i2cM5n5CVTcM1BhNqhHwRU+p6y3GN2 BQykUrzIu+lPi12gsJk5HxEoMv0PnqvG4b9xoQtNbCcQOiN3CfJu1mYJhkuqGHlHqAUd WjPQZjCLnXEcI1YCKUyOaXHni+daGaTepbeHL7foCvOZQntVvOuW082iNCMT2mOgljQ/ K/6r2dXGOVCskBgjMEIysdTzKkVDyZTKmKM5WwqC/jElIniUDlhb/VSC+eIqE/GN0fLB Vmlw== X-Gm-Message-State: AA+aEWaIXOyrD+4wHb5alHDTERMeXA+aoplvTjlSOoCZGlGpipBB0p6F 7ImnRuUzd1IhFPKb9cYHj6QQ+leWkgBgFK07SGs1uJN/ X-Google-Smtp-Source: AFSGD/W28NJFtHS2GTqPy0M9MUNUbw8ODKGwWqjZfvliBRD+AJIDb+MTpQJe3MkaPqlkPPQb179f97zgwXTUKKJ+04U= X-Received: by 2002:a2e:9107:: with SMTP id m7-v6mr639776ljg.23.1545261191588; Wed, 19 Dec 2018 15:13:11 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:231929 Archived-At: --0000000000006937de057d682892 Content-Type: multipart/alternative; boundary="0000000000006937dc057d682890" --0000000000006937dc057d682890 Content-Type: text/plain; charset="UTF-8" Hello, It isn't possible to bind keys to eshell-mode-map using define-keys like this: (define-key eshell-mode-map (kbd "") 'other-window) instead a user must use an add-hook (add-hook 'eshell-mode-hook (lambda () (define-key eshell-mode-map (kbd "") 'other-window) The cause of this can be seen in the patch: eshell-mode-map is set to nil initially "for the byte compiler," then made buffer local (amusingly commented out with FIXME: What the hell?!). This patch resolves the issue and manages to byte compile. What is the benefit to setting it to nil initially with respect to the byte compiler? The comment above the defvar Also what is the benefit of setting it locally when it is already defined globally? The new version byte compiles okay, and the above test cases work. The following also runs without issue: M-x emacs-byte-compile-and-load ;in the new esh-mode.el buffer (require 'esh-mode) I am skeptical that any performance benefit here is worth breaking the standard keybinding mechanism. --0000000000006937dc057d682890 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,
It= isn't possible to bind keys to eshell-mode-map using define-keys like = this:
(define-key eshell-mode-map (kbd "<C-f12>")= 'other-window)
instead a user must use an add-hook
(add-hook 'eshell-mode-hook (lambda () (define-key eshell-mode-map (kb= d "<C-f12>") 'other-window)
The cause of this= can be seen in the patch: eshell-mode-map is set to nil initially "fo= r the byte compiler," then made buffer local (amusingly commented out = with FIXME: What the hell?!). This patch resolves the issue and manages to = byte compile.

What is the benefit to setting it to= nil initially with respect to the byte compiler? The comment above the def= var Also what is the benefit of setting it locally when it is already defin= ed globally? The new version byte compiles okay, and the above test cases w= ork. The following also runs without issue:
M-x emacs-byte-compil= e-and-load ;in the new esh-mode.el buffer
(require 'esh-m= ode)

I am skeptical that any performance benefit h= ere is worth breaking the standard keybinding mechanism.
--0000000000006937dc057d682890-- --0000000000006937de057d682892 Content-Type: application/octet-stream; name=diff Content-Disposition: attachment; filename=diff Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jpvsfo3l0 MjEzYzIxMwo8IChkZWZ2YXIgZXNoZWxsLW1vZGUtbWFwIG5pbCkKLS0tCj4gKGRlZnZhciBlc2hl bGwtbW9kZS1tYXAgKG1ha2Utc3BhcnNlLWtleW1hcCkpCjMwMywzMDVjMzAzCjwgCjwgICA7OyBG SVhNRTogV2hhdCB0aGUgaGVsbCE/CjwgICAoc2V0cS1sb2NhbCBlc2hlbGwtbW9kZS1tYXAgKG1h a2Utc3BhcnNlLWtleW1hcCkpCi0tLQo+ICAgCg== --0000000000006937de057d682892--