[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Define-keys will not work with eshell-mode-map and patch

From: Spenser Truex
Subject: Define-keys will not work with eshell-mode-map and patch
Date: Wed, 19 Dec 2018 15:12:34 -0800

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 (kbd "<C-f12>") '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.

Attachment: diff
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]