emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug: Eshell redefines a key when loading


From: Matthieu Lemerre
Subject: Bug: Eshell redefines a key when loading
Date: Wed, 22 Feb 2006 20:58:00 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Hello,

I found the following bug in Emacs, that I can reproduce as follow:

-Start emacs -Q
-M-x global-set-key M-! eshell-command RET
-M-! ls RET
-C-h k M-! 

The first M-! runs eshell-command, but not the following ones.

The reason is that upon loading, the M-! key is redefined by the
following bit of code in eshell.el:

    (defcustom eshell-prefer-to-shell nil
      "*If non-nil, \\[shell-command] will use Eshell instead of shell-mode."
      :set (lambda (symbol value)
         ;; modifying the global keymap directly is odious, but how
         ;; else to achieve the takeover?
         (if value
             (progn
               (define-key global-map [(meta ?!)] 'eshell-command)
    ;;;            (define-key global-map [(meta ?|)] 'eshell-command-on-region)
               )
           (define-key global-map [(meta ?!)] 'shell-command)
    ;;;        (define-key global-map [(meta ?|)] 'shell-command-on-region)
           )
         (set symbol value))
      :type 'boolean
      :require 'eshell
      :group 'eshell)

The bugfix could be to remove the global binding to shell-command
here.

But I don't really see the point in this option. It seems to be more
natural, if you prefer to use eshell-command ovec shell-command, to
bind the key yourself.

Or maybe this option should do the following instead:

    (defalias 'shell-command #'eshell-command)

Which would enable to use eshell-command instead of shell-command
everywhere (for instance in dired), which seems more reasonable if the
user, as the option name states, prefers eshell to shell.

As I don't know the right fix, I haven't sent a patch; but I can if it
helps you.

Thanks,
Matthieu Lemerre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]