GNU bug report logs - #33808
eshell keybinding

Previous Next

Package: emacs;

Reported by: Spenser Truex <struex0 <at> gmail.com>

Date: Thu, 20 Dec 2018 00:39:02 UTC

Severity: minor

Tags: fixed, patch

Merged with 22792

Found in version 25.0.91

Fixed in version 28.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33808 in the body.
You can then email your comments to 33808 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#33808; Package emacs. (Thu, 20 Dec 2018 00:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Spenser Truex <struex0 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 20 Dec 2018 00:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Spenser Truex <struex0 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Date: Wed, 19 Dec 2018 15:32:50 -0800
Here I reproduce an email sent to emacs-devel <at> gnu.org and I suggest
edits to the eshell manual
https://www.gnu.org/software/emacs/manual/eshell.html which currently
lacks information on keybinding. This is unfortunate as eshell suffers
from a major bug related to keybinding.
>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.

And my recommended edit (to be put under the "5.4 Key rebinding" heading):
Eshell currently suffers (version 27) from a bug concerning keybinding such that
>(define-key eshell-mode-map (kbd "key") 'command)
cannot be used before the hooks are run. Use
>(add-hook 'eshell-mode-hook
>    (lambda ()
>        (define-key eshell-mode-map (kbd "key1") 'command1)
>         (define-key eshell-mode-map (kbd "key2") 'command2))
instead.




Set bug title to 'eshell keybinding'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 20 Dec 2018 17:51:01 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 20 Dec 2018 17:51:01 GMT) Full text and rfc822 format available.

Set bug forwarded-to-address to 'http://lists.gnu.org/r/emacs-devel/2018-12/msg00382.html'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 20 Dec 2018 17:51:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33808; Package emacs. (Fri, 29 Mar 2019 15:57:02 GMT) Full text and rfc822 format available.

Message #14 received at 33808 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Spenser Truex <struex0 <at> gmail.com>
Cc: 33808 <at> debbugs.gnu.org
Subject: Re: bug#33808:
Date: Fri, 29 Mar 2019 11:56:08 -0400
On Wed, 19 Dec 2018 at 19:39, Spenser Truex <struex0 <at> gmail.com> wrote:

> >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.

It's not quite enough, because eshell-mode defines some more keys, so
settings like

(define-key eshell-command-map [(control ?a)] 'my-eshell-bol)

would still get overridden every time eshell starts. And there are
additional key definitions in other eshell files. The definitions set
up by eshell-command seem the most tricky to fix (probably requires
splitting out to a separate keymap):

    (defun eshell-return-exits-minibuffer ()
      (define-key eshell-mode-map [(control ?g)] 'abort-recursive-edit)
      (define-key eshell-mode-map [return] 'exit-minibuffer)
      ...)

    (defun eshell-command (&optional command arg)
       ...
        ;; Enable `eshell-mode' only in this minibuffer.
        (minibuffer-with-setup-hook #'(lambda ()
                                        (eshell-mode)
                                        (eshell-return-exits-minibuffer))


> And my recommended edit (to be put under the "5.4 Key rebinding" heading):
> Eshell currently suffers (version 27) from a bug concerning keybinding such that
> >(define-key eshell-mode-map (kbd "key") 'command)
> cannot be used before the hooks are run.

We don't document bugs in the manual.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33808; Package emacs. (Thu, 27 Jun 2019 15:47:02 GMT) Full text and rfc822 format available.

Message #17 received at 33808 <at> debbugs.gnu.org (full text, mbox):

From: Alex Branham <alex.branham <at> gmail.com>
To: 33808 <at> debbugs.gnu.org
Subject: eshell keybinding
Date: Thu, 27 Jun 2019 10:46:22 -0500
I think this is the same bug as bug#22792. Can someone with more
debbugs-foo than me please merge these?

Thanks,
Alex




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33808; Package emacs. (Thu, 27 Jun 2019 19:26:01 GMT) Full text and rfc822 format available.

Message #20 received at 33808 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Alex Branham <alex.branham <at> gmail.com>
Cc: 33808 <at> debbugs.gnu.org
Subject: Re: bug#33808: eshell keybinding
Date: Thu, 27 Jun 2019 15:25:03 -0400
merge 22792 33808
quit

Alex Branham <alex.branham <at> gmail.com> writes:

> I think this is the same bug as bug#22792. Can someone with more
> debbugs-foo than me please merge these?

Done.




Unset bug forwarded-to-address Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 27 Jun 2019 19:38:02 GMT) Full text and rfc822 format available.

Merged 22792 33808. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 27 Jun 2019 19:38:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Alex Branham <alex.branham <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 28 Jun 2019 18:15:03 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 16 Aug 2019 00:57:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 22792 <at> debbugs.gnu.org and Manuel Uberti - Boccaperta <manuel <at> boccaperta.com> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 16 Aug 2019 00:57:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 Sep 2019 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 25 May 2020 00:29:03 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 27.1. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 25 May 2020 00:29:03 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 28.1. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 25 May 2020 00:29:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Jun 2020 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 308 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.