all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How automatically/immediately run command in ansi-term *with* *arguments* ?
@ 2015-02-09  4:16 Chris Seberino
  2015-02-09 15:50 ` Barry Margolin
  2015-02-10 23:44 ` Michael Heerdegen
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Seberino @ 2015-02-09  4:16 UTC (permalink / raw
  To: help-gnu-emacs

I'm trying to set some shortcuts for shell commands.  I want to use ansi-term as it has colors and other niceties not found in shell if I use shell-command....

This works...

(ansi-term 'some_command_here')

This does *NOT*...

(ansi-term 'some_command_here arg1 arg2')

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.

cs


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How automatically/immediately run command in ansi-term *with* *arguments* ?
  2015-02-09  4:16 How automatically/immediately run command in ansi-term *with* *arguments* ? Chris Seberino
@ 2015-02-09 15:50 ` Barry Margolin
  2015-02-10 18:20   ` Subhan Michael Tindall
       [not found]   ` <mailman.19677.1423592437.1147.help-gnu-emacs@gnu.org>
  2015-02-10 23:44 ` Michael Heerdegen
  1 sibling, 2 replies; 5+ messages in thread
From: Barry Margolin @ 2015-02-09 15:50 UTC (permalink / raw
  To: help-gnu-emacs

In article <18d0a858-7d2b-42de-bc61-8e16ff376569@googlegroups.com>,
 Chris Seberino <cseberino@gmail.com> wrote:

> I'm trying to set some shortcuts for shell commands.  I want to use ansi-term 
> as it has colors and other niceties not found in shell if I use 
> shell-command....
> 
> This works...
> 
> (ansi-term 'some_command_here')
> 
> This does *NOT*...
> 
> (ansi-term 'some_command_here arg1 arg2')
> 
> 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.

The argument to ansi-term is a program, not a command. There doesn't 
seem to be a way to provide arguments to the program. Write a script 
that does what you want, and put that as the program argument.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: How automatically/immediately run command in ansi-term *with* *arguments* ?
  2015-02-09 15:50 ` Barry Margolin
@ 2015-02-10 18:20   ` Subhan Michael Tindall
       [not found]   ` <mailman.19677.1423592437.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Subhan Michael Tindall @ 2015-02-10 18:20 UTC (permalink / raw
  To: 'Barry Margolin', help-gnu-emacs@gnu.org

Kind of a long shot, & I'm not set up to test it,
But maybe you could put program arg1 arg2... in back-ticks? `program arg1 arg2` to force the grouping into a single 'program'?

> -----Original Message-----
> From: help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org
> [mailto:help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org] On
> Behalf Of Barry Margolin
> Sent: Monday, February 09, 2015 7:51 AM
> To: help-gnu-emacs@gnu.org
> Subject: Re: How automatically/immediately run command in ansi-term
> *with* *arguments* ?
> 
> In article <18d0a858-7d2b-42de-bc61-8e16ff376569@googlegroups.com>,
>  Chris Seberino <cseberino@gmail.com> wrote:
> 
> > I'm trying to set some shortcuts for shell commands.  I want to use
> > ansi-term as it has colors and other niceties not found in shell if I
> > use shell-command....
> >
> > This works...
> >
> > (ansi-term 'some_command_here')
> >
> > This does *NOT*...
> >
> > (ansi-term 'some_command_here arg1 arg2')
> >
> > 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.
> 
> The argument to ansi-term is a program, not a command. There doesn't
> seem to be a way to provide arguments to the program. Write a script that
> does what you want, and put that as the program argument.
> 
> --
> Barry Margolin, barmar@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***

This message is intended for the sole use of the individual and entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message.  Thank you.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How automatically/immediately run command in ansi-term *with* *arguments* ?
       [not found]   ` <mailman.19677.1423592437.1147.help-gnu-emacs@gnu.org>
@ 2015-02-10 20:49     ` Barry Margolin
  0 siblings, 0 replies; 5+ messages in thread
From: Barry Margolin @ 2015-02-10 20:49 UTC (permalink / raw
  To: help-gnu-emacs

In article <mailman.19677.1423592437.1147.help-gnu-emacs@gnu.org>,
 Subhan Michael Tindall <SubhanT@familycareinc.org> wrote:

> Kind of a long shot, & I'm not set up to test it,
> But maybe you could put program arg1 arg2... in back-ticks? `program arg1 
> arg2` to force the grouping into a single 'program'?

Backticks are processed by the shell. If it were using the shell, you 
would be able to do just "program arg1 arg2".

> 
> > -----Original Message-----
> > From: help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org
> > [mailto:help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org] On
> > Behalf Of Barry Margolin
> > Sent: Monday, February 09, 2015 7:51 AM
> > To: help-gnu-emacs@gnu.org
> > Subject: Re: How automatically/immediately run command in ansi-term
> > *with* *arguments* ?
> > 
> > In article <18d0a858-7d2b-42de-bc61-8e16ff376569@googlegroups.com>,
> >  Chris Seberino <cseberino@gmail.com> wrote:
> > 
> > > I'm trying to set some shortcuts for shell commands.  I want to use
> > > ansi-term as it has colors and other niceties not found in shell if I
> > > use shell-command....
> > >
> > > This works...
> > >
> > > (ansi-term 'some_command_here')
> > >
> > > This does *NOT*...
> > >
> > > (ansi-term 'some_command_here arg1 arg2')
> > >
> > > 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.
> > 
> > The argument to ansi-term is a program, not a command. There doesn't
> > seem to be a way to provide arguments to the program. Write a script that
> > does what you want, and put that as the program argument.
> > 
> > --
> > Barry Margolin, barmar@alum.mit.edu
> > Arlington, MA
> > *** PLEASE post questions in newsgroups, not directly to me ***
> 
> This message is intended for the sole use of the individual and entity to 
> which it is addressed and may contain information that is privileged, 
> confidential and exempt from disclosure under applicable law. If you are not 
> the intended addressee, nor authorized to receive for the intended addressee, 
> you are hereby notified that you may not use, copy, disclose or distribute to 
> anyone the message or any information contained in the message. If you have 
> received this message in error, please immediately advise the sender by reply 
> email and delete the message.  Thank you.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How automatically/immediately run command in ansi-term *with* *arguments* ?
  2015-02-09  4:16 How automatically/immediately run command in ansi-term *with* *arguments* ? Chris Seberino
  2015-02-09 15:50 ` Barry Margolin
@ 2015-02-10 23:44 ` Michael Heerdegen
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Heerdegen @ 2015-02-10 23:44 UTC (permalink / raw
  To: Chris Seberino; +Cc: help-gnu-emacs

Chris Seberino <cseberino@gmail.com> 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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-10 23:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-09  4:16 How automatically/immediately run command in ansi-term *with* *arguments* ? Chris Seberino
2015-02-09 15:50 ` Barry Margolin
2015-02-10 18:20   ` Subhan Michael Tindall
     [not found]   ` <mailman.19677.1423592437.1147.help-gnu-emacs@gnu.org>
2015-02-10 20:49     ` Barry Margolin
2015-02-10 23:44 ` Michael Heerdegen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.