all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#33808:
@ 2018-12-19 23:32 Spenser Truex
  2019-03-29 15:56 ` bug#33808: Noam Postavsky
  2019-06-27 15:46 ` bug#33808: eshell keybinding Alex Branham
  0 siblings, 2 replies; 4+ messages in thread
From: Spenser Truex @ 2018-12-19 23:32 UTC (permalink / raw)
  To: 33808

Here I reproduce an email sent to emacs-devel@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#33808:
  2018-12-19 23:32 bug#33808: Spenser Truex
@ 2019-03-29 15:56 ` Noam Postavsky
  2019-06-27 15:46 ` bug#33808: eshell keybinding Alex Branham
  1 sibling, 0 replies; 4+ messages in thread
From: Noam Postavsky @ 2019-03-29 15:56 UTC (permalink / raw)
  To: Spenser Truex; +Cc: 33808

On Wed, 19 Dec 2018 at 19:39, Spenser Truex <struex0@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#33808: eshell keybinding
  2018-12-19 23:32 bug#33808: Spenser Truex
  2019-03-29 15:56 ` bug#33808: Noam Postavsky
@ 2019-06-27 15:46 ` Alex Branham
  2019-06-27 19:25   ` Noam Postavsky
  1 sibling, 1 reply; 4+ messages in thread
From: Alex Branham @ 2019-06-27 15:46 UTC (permalink / raw)
  To: 33808

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

Thanks,
Alex





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#33808: eshell keybinding
  2019-06-27 15:46 ` bug#33808: eshell keybinding Alex Branham
@ 2019-06-27 19:25   ` Noam Postavsky
  0 siblings, 0 replies; 4+ messages in thread
From: Noam Postavsky @ 2019-06-27 19:25 UTC (permalink / raw)
  To: Alex Branham; +Cc: 33808

merge 22792 33808
quit

Alex Branham <alex.branham@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-27 19:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-19 23:32 bug#33808: Spenser Truex
2019-03-29 15:56 ` bug#33808: Noam Postavsky
2019-06-27 15:46 ` bug#33808: eshell keybinding Alex Branham
2019-06-27 19:25   ` Noam Postavsky

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.