help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: repeat the last single shell command


From: Barry Margolin
Subject: Re: repeat the last single shell command
Date: Thu, 18 Jul 2013 10:45:58 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.1333.1374153910.12400.help-gnu-emacs@gnu.org>,
 Tassilo Horn <tsdh@gnu.org> wrote:

> Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
> 
> >> Yes, it works, but that's pretty much the same of M-p. I'd like to
> >> know if there's some shortcut, let's say like M-!!, to immediatly
> >> repeat the last command. Otherwise I have to define a function.
> >
> > I think M-! M-p RET is simple enough, but you can do this:
> >
> > (defun yf/last-history-element-and-exit ()
> >   "Select the last history element."
> >   (interactive)
> >   (goto-history-element 1)
> >   (exit-minibuffer))
> > (define-key minibuffer-local-shell-command-map (kbd "!") 
> > 'yf/last-history-element-and-exit)
> 
> Nice idea, but then you can't enter ! anymore in a shell command.

It's not too often that one needs that character in shell one-liners. 
But if you do, you can always type it with C-q !.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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