From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: How automatically/immediately run command in ansi-term *with* *arguments* ? Date: Wed, 11 Feb 2015 00:44:41 +0100 Message-ID: <87r3tx2uxi.fsf@web.de> References: <18d0a858-7d2b-42de-bc61-8e16ff376569@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423611929 27876 80.91.229.3 (10 Feb 2015 23:45:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Feb 2015 23:45:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Chris Seberino Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 11 00:45:21 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 1YLKUa-000201-PJ for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Feb 2015 00:45:20 +0100 Original-Received: from localhost ([::1]:42484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLKUa-0008TN-BU for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Feb 2015 18:45:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLKUM-0008R7-0n for help-gnu-emacs@gnu.org; Tue, 10 Feb 2015 18:45:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLKUI-0005jE-RD for help-gnu-emacs@gnu.org; Tue, 10 Feb 2015 18:45:05 -0500 Original-Received: from mout.web.de ([212.227.17.12]:61850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLKUI-0005fy-HJ for help-gnu-emacs@gnu.org; Tue, 10 Feb 2015 18:45:02 -0500 Original-Received: from drachen.dragon ([90.186.208.145]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0M0hbG-1XSoco3z82-00urTO; Wed, 11 Feb 2015 00:44:49 +0100 In-Reply-To: <18d0a858-7d2b-42de-bc61-8e16ff376569@googlegroups.com> (Chris Seberino's message of "Sun, 8 Feb 2015 20:16:36 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:wnfQgWJiM+I/10/+2V5dZfb0gfYOEc4xGJtvXjXZRLhyNzmJAWI 2F/M2rdTs1JcRvgjG5+XP/G15OuXXvTrKkxI16xg6HzIeHBqo1Uioq7F5OuIZzhstSmezh1 Uk+DeWl+CLHZp54VOx/ns9yWv7cE1PXSDEuXXGP0NLUxyLC8uHY6yX7QIycQV7YBd8v6Xfk cc8Y0Mb6LJqjz5tQkJbzQ== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.17.12 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:102624 Archived-At: Chris Seberino writes: > How get arguments to work? This would be quite a nice replacement for > shell-command if it could for people that like/need ansi-term. Try this, a hack, but seems to work here, no guarantee though: --8<---------------cut here---------------start------------->8--- (defun my-shell-command (cmd) (interactive (list (read-shell-command "Command: "))) (setq cmd (split-string cmd " ")) (require 'term) (let* ((buffer (apply #'term-ansi-make-term "*Shell Command*" (car cmd) nil (cdr cmd))) (proc (get-buffer-process buffer))) (set-process-sentinel proc (lambda (proc msg) (let ((buffer (process-buffer proc))) (when (memq (process-status proc) '(signal exit)) (with-current-buffer buffer (delete-process proc) (goto-char (point-min))))))) (switch-to-buffer buffer))) --8<---------------cut here---------------end--------------->8--- Michael.