all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Spenser Truex <struex0@gmail.com>
Cc: 33808@debbugs.gnu.org
Subject: bug#33808:
Date: Fri, 29 Mar 2019 11:56:08 -0400	[thread overview]
Message-ID: <CAM-tV--PXUBiQf8_ZFCbdEkvHJOmqWYmJp1wjNVgFJWt5PQOFg@mail.gmail.com> (raw)
In-Reply-To: <CA+rK5a4xbjSmA44=YXZ1M3C4yCrvY1LAwTnJpzMUxeLi_OUSQw@mail.gmail.com>

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.





  reply	other threads:[~2019-03-29 15:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-19 23:32 bug#33808: Spenser Truex
2019-03-29 15:56 ` Noam Postavsky [this message]
2019-06-27 15:46 ` bug#33808: eshell keybinding Alex Branham
2019-06-27 19:25   ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM-tV--PXUBiQf8_ZFCbdEkvHJOmqWYmJp1wjNVgFJWt5PQOFg@mail.gmail.com \
    --to=npostavs@gmail.com \
    --cc=33808@debbugs.gnu.org \
    --cc=struex0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.