unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: "André Alexandre Gomes" <andremegafone@gmail.com>
Cc: Alex Branham <alex.branham@gmail.com>, 41370@debbugs.gnu.org
Subject: bug#41370: 27.0.91; Eshell and exit-minibuffer
Date: Wed, 20 May 2020 13:31:12 -0400	[thread overview]
Message-ID: <85k116o6n3.fsf@gmail.com> (raw)
In-Reply-To: <875zcui7m4.fsf@gmail.com> ("André Alexandre Gomes"'s message of "Sun, 17 May 2020 22:17:39 +0100")

tags 41370 + confirmed
quit

André Alexandre Gomes <andremegafone@gmail.com> writes:

> - M-x eshell-command
> - M-n (empty input ring)
> - M-x eshell
> - pwd
> - nothing happens 
>
> This message appears:
> "exit-minibuffer: No catch for tag: exit, nil"

This is because eshell-command calls eshell-return-exits-minibuffer
which does

    (define-key eshell-mode-map [(control ?m)] 'exit-minibuffer)

This was okay in 26.3 because eshell-mode created its keymap from
scratch every time.  That's no longer the case since [1: 1ee0192b792]
(bugs #22792 and #33808).

[1: 1ee0192b792]: 2019-08-15 20:49:15 -0400
  Fix eshell-mode-map initialization
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1ee0192b792124663a0a40a729dd83c047d21535

I think that should be reverted from emacs-27, and the patch below can
fix it for master:

--- i/lisp/eshell/eshell.el
+++ w/lisp/eshell/eshell.el
@@ -265,14 +265,18 @@ eshell
       (eshell-mode))
     buf))
 
-(defun eshell-return-exits-minibuffer ()
-  ;; This is supposedly run after enabling esh-mode, when eshell-mode-map
-  ;; already exists.
-  (defvar eshell-mode-map)
-  (define-key eshell-mode-map [(control ?g)] 'abort-recursive-edit)
-  (define-key eshell-mode-map [(control ?m)] 'exit-minibuffer)
-  (define-key eshell-mode-map [(control ?j)] 'exit-minibuffer)
-  (define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer))
+(define-minor-mode eshell-command-mode
+  "Minor mode for `eshell-command' input.
+\\{eshell-command-mode-map}"
+  :keymap (let ((map (make-sparse-keymap)))
+            (define-key map [(control ?g)] 'abort-recursive-edit)
+            (define-key map [(control ?m)] 'exit-minibuffer)
+            (define-key map [(control ?j)] 'exit-minibuffer)
+            (define-key map [(meta control ?m)] 'exit-minibuffer)
+            map))
+
+(define-obsolete-function-alias 'eshell-return-exits-minibuffer
+  #'eshell-command-mode "28.1")
 
 (defvar eshell-non-interactive-p nil
   "A variable which is non-nil when Eshell is not running interactively.
@@ -292,7 +296,7 @@ eshell-command
     ;; Enable `eshell-mode' only in this minibuffer.
     (minibuffer-with-setup-hook #'(lambda ()
                                     (eshell-mode)
-                                    (eshell-return-exits-minibuffer))
+                                    (eshell-command-mode +1))
       (unless command
         (setq command (read-from-minibuffer "Emacs shell command: "))
 	(if (eshell-using-module 'eshell-hist)





  reply	other threads:[~2020-05-20 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 21:17 bug#41370: 27.0.91; Eshell and exit-minibuffer André Alexandre Gomes
2020-05-20 17:31 ` Noam Postavsky [this message]
2020-05-20 18:04   ` Eli Zaretskii
2020-05-25  0:28     ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=85k116o6n3.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=41370@debbugs.gnu.org \
    --cc=alex.branham@gmail.com \
    --cc=andremegafone@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).