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: Nicolas Richard
Subject: Re: repeat the last single shell command
Date: Thu, 18 Jul 2013 15:52:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Tassilo Horn <tsdh@gnu.org> writes:
> Here's an improved version that does handle ! (or whatever char you've
> bound `yf/last-history-element-and-exit' to) only special if it's the
> first char entered at the prompt.

Agreed. Perhaps one of (eq last-command 'shell-command) or (equal ""
(minibuffer-contents-no-properties)) might be used as a more specific
test too, e.g. :

--8<---------------cut here---------------start------------->8---
(defun yf/last-history-element-and-exit ()
  "Select the last history element."
  (interactive)
  (if (not (eq last-command 'shell-command))
      (self-insert-command 1)
    (goto-history-element 1)
    (exit-minibuffer)))
--8<---------------cut here---------------end--------------->8---

-- 
Nico.



reply via email to

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