all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: Eshell redefines a key when loading
@ 2006-02-22 19:58 Matthieu Lemerre
  2006-02-24 19:41 ` Richard Stallman
  0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Lemerre @ 2006-02-22 19:58 UTC (permalink / raw)



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

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

* Re: Bug: Eshell redefines a key when loading
  2006-02-22 19:58 Bug: Eshell redefines a key when loading Matthieu Lemerre
@ 2006-02-24 19:41 ` Richard Stallman
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Stallman @ 2006-02-24 19:41 UTC (permalink / raw)
  Cc: emacs-devel

    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:

It is trying to be harmless by default, but failing to do so correctly
in general.

    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.

I agree.  I will delete that.

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

end of thread, other threads:[~2006-02-24 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-22 19:58 Bug: Eshell redefines a key when loading Matthieu Lemerre
2006-02-24 19:41 ` Richard Stallman

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.