From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Richard Newsgroups: gmane.emacs.help Subject: Re: repeat the last single shell command Date: Thu, 18 Jul 2013 15:52:46 +0200 Message-ID: <877ggox9e9.fsf@yahoo.fr> References: <87fvvcxcn1.fsf@yahoo.fr> <874nbst2zs.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1374155655 28880 80.91.229.3 (18 Jul 2013 13:54:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Jul 2013 13:54:15 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 18 15:54:17 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uzoeu-0000lE-BR for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Jul 2013 15:54:16 +0200 Original-Received: from localhost ([::1]:58766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uzoeu-0004nI-1S for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Jul 2013 09:54:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzodG-0002eX-Kd for help-gnu-emacs@gnu.org; Thu, 18 Jul 2013 09:52:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzodE-0004wz-52 for help-gnu-emacs@gnu.org; Thu, 18 Jul 2013 09:52:34 -0400 Original-Received: from mxin.ulb.ac.be ([164.15.128.112]:47051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzodD-0004wd-VR; Thu, 18 Jul 2013 09:52:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAN/x51GkD4Nx/2dsb2JhbABaxE6BInSCJQEFJ1IQCAMOEyUPAQRJE4d9ARKlMYdGAYk1kA8Hg3wDl12GEIs9gxQ6 Original-Received: from geodiff-mac3.ulb.ac.be (HELO geodiff-mac3) ([164.15.131.113]) by smtp.ulb.ac.be with ESMTP; 18 Jul 2013 15:52:30 +0200 In-Reply-To: <874nbst2zs.fsf@thinkpad.tsdh.de> (Tassilo Horn's message of "Thu, 18 Jul 2013 15:24:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 164.15.128.112 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92232 Archived-At: Tassilo Horn 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.