From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: editing previous command in the *shell* buffer Date: Wed, 29 Apr 2015 01:20:43 +0100 Message-ID: <877fsvwzs4.fsf@robertthorpeconsulting.com> References: <36243f68-c9ad-4185-af20-215cceecf0b3@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1430266876 22576 80.91.229.3 (29 Apr 2015 00:21:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Apr 2015 00:21:16 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: cplum987@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 29 02:21:06 2015 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 1YnFkQ-0001tN-2a for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Apr 2015 02:21:06 +0200 Original-Received: from localhost ([::1]:36289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnFkO-0002H2-Uy for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2015 20:21:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnFkC-0002Dc-8M for help-gnu-emacs@gnu.org; Tue, 28 Apr 2015 20:20:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnFk6-0006KI-50 for help-gnu-emacs@gnu.org; Tue, 28 Apr 2015 20:20:52 -0400 Original-Received: from outbound-smtp04.blacknight.com ([81.17.249.35]:52099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnFk5-0006K7-VI for help-gnu-emacs@gnu.org; Tue, 28 Apr 2015 20:20:46 -0400 Original-Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp04.blacknight.com (Postfix) with ESMTPS id 96BCD98B57 for ; Wed, 29 Apr 2015 00:20:44 +0000 (UTC) Original-Received: (qmail 15700 invoked from network); 29 Apr 2015 00:20:44 -0000 Original-Received: from unknown (HELO RTLaptop) (rt@robertthorpeconsulting.com@[109.76.131.218]) by 81.17.254.9 with ESMTPSA (DHE-RSA-AES128-SHA encrypted, authenticated); 29 Apr 2015 00:20:44 -0000 In-Reply-To: <36243f68-c9ad-4185-af20-215cceecf0b3@googlegroups.com> (cplum987@gmail.com) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 81.17.249.35 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:104055 Archived-At: cplum987@gmail.com writes: > [BTW, I meant C-r, not C-s. My brain can never recall why my fingers type.] > > M-r seems to be a step in the right direction. However, you don't know > what command line it will grab until after you press . As an > example, I just tried "M-r cd". It found a command with "CD" in > the middle of it. I wanted the one that started with "cd". It's a regex as Barry Margolin mentioned, that's one way to narrow things down. Another is to search further. M-r initiates a backwards regex isearch of history. When you meet a match C-r will continue the search back to the next match. (Typing M-r again switches from regex search to normal search). There are quite a few other commands available. See (info "(emacs) Shell Ring") > With xemacs, "cd M-p" would have found the most recent occurrence of a > command that started with "cd", and entered it as the current command > so I can edit it (it doesn't take you to the location in *shell* of > the match like C-r does). No need to press first and hope it > grabs the right one. Also, each time I type M-p after that, it will > grab an even older instance of a command that starts with those same > chars. So I just type the first few chars of the command, and then > type M-p until xemacs finds the one I want. This sounds useful. There's probably a package on Melpa or Marmalade to do it. But I don't know precisely where to start looking. BR, Robert Thorpe