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: "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer) Date: Tue, 09 Sep 2014 00:20:55 +0100 Message-ID: <87a969g0mg.fsf@robertthorpeconsulting.com> References: <87egvp4b1d.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410218593 21315 80.91.229.3 (8 Sep 2014 23:23:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Sep 2014 23:23:13 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 09 01:23:05 2014 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 1XR8H3-0003q1-HX for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Sep 2014 01:23:05 +0200 Original-Received: from localhost ([::1]:46135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR8H3-00065C-0Y for geh-help-gnu-emacs@m.gmane.org; Mon, 08 Sep 2014 19:23:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR8Fv-0005yX-08 for help-gnu-emacs@gnu.org; Mon, 08 Sep 2014 19:22:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XR8F1-0006UI-Az for help-gnu-emacs@gnu.org; Mon, 08 Sep 2014 19:21:54 -0400 Original-Received: from outbound-smtp01.blacknight.com ([81.17.249.7]:40236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XR8F1-0006U0-4g for help-gnu-emacs@gnu.org; Mon, 08 Sep 2014 19:20:59 -0400 Original-Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp01.blacknight.com (Postfix) with ESMTP id 44E59992A9 for ; Mon, 8 Sep 2014 23:19:32 +0000 (UTC) Original-Received: (qmail 9177 invoked from network); 8 Sep 2014 23:20:57 -0000 Original-Received: from unknown (HELO RTLaptop) (rt@robertthorpeconsulting.com@[109.78.125.124]) by 81.17.254.9 with ESMTPSA (DHE-RSA-AES128-SHA encrypted, authenticated); 8 Sep 2014 23:20:57 -0000 In-Reply-To: <87egvp4b1d.fsf@debian.uxu> (message from Emanuel Berg on Sat, 06 Sep 2014 06:39:58 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 81.17.249.7 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:99709 Archived-At: Emanuel Berg writes: > Robert Thorpe writes: > >> You could modify these or advice them. Or you could >> rebind RET. For example, suppose you create a new >> "pseudo-command" called "buf". You write: "buf ls >> RET" in the shell buffer. Your function finds the >> "buf" at the beginning of the command string. It then >> cuts out the rest and sends it to shell-command which >> puts it in a separate buffer. > > Welcome back Mr. Thorpe, yes, but that would be > in-Emacs, right? If so, isn't the eshell better? Yes, but eshell has some disadvantages. The error messages aren't very clear. That's a problem for me because I make a lot of mistakes using the shell. Also, I sometimes use MS Windows where it's useful to have M-x shell go to the Windows shell (cmd.exe). Some other people may want to do it because they use a different shell and eshell mostly immitates bash. Looking at the code a bit more I think it's best to do it this way: * Rebind RET to a new function (only in shell mode, not in comint). * In the new function filter out all the special commands & deal with them. * In the new function pass through everything else to comint-send-input. BR, Robert Thorpe