[Top][All Lists]

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

Re: repeat the last single shell command

From: Tassilo Horn
Subject: Re: repeat the last single shell command
Date: Thu, 18 Jul 2013 16:22:39 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Nicolas Richard <> writes:

> Tassilo Horn <> writes:
>> You can capture the last shell command using an advice, and have a
>> command for repeating it, though.
> Since a history is maintained accross invocations, there must be a
> variable holding that, already. Its name is shell-command-history ;
> its (car) holds the last command.

Indeed, so

--8<---------------cut here---------------start------------->8---
(defun th-repeat-last-shell-command ()
  (if (car shell-command-history)
      (apply #'shell-command (car shell-command-history))
    (message "There's no last shell command!")))
--8<---------------cut here---------------end--------------->8---

is enough.


reply via email to

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