all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Define-keys will not work with eshell-mode-map and patch
@ 2018-12-19 23:12 Spenser Truex
  0 siblings, 0 replies; only message in thread
From: Spenser Truex @ 2018-12-19 23:12 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1017 bytes --]

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 (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 #1.2: Type: text/html, Size: 1280 bytes --]

[-- Attachment #2: diff --]
[-- Type: application/octet-stream, Size: 199 bytes --]

213c213
< (defvar eshell-mode-map nil)
---
> (defvar eshell-mode-map (make-sparse-keymap))
303,305c303
< 
<   ;; FIXME: What the hell!?
<   (setq-local eshell-mode-map (make-sparse-keymap))
---
>   

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-19 23:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-19 23:12 Define-keys will not work with eshell-mode-map and patch Spenser Truex

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.