unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer)
       [not found] <mailman.8358.1409958182.1147.help-gnu-emacs@gnu.org>
@ 2014-09-06  4:39 ` Emanuel Berg
  2014-09-07 20:42   ` Marcin Borkowski
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Emanuel Berg @ 2014-09-06  4:39 UTC (permalink / raw)
  To: help-gnu-emacs

Robert Thorpe <rt@robertthorpeconsulting.com> 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?

OT (or on topic):

I would like a shell prompt in Emacs, but not like the
IELM, instead as M-x, only the whole command and
arguments!

I did a thing on this with the help of an individual on
this list:

http://user.it.uu.se/~embe8573/conf/emacs-init/shell-cli.el

It works for most cases... Try: man ls, find-file
file.txt - only with replace regexp and such sometimes
it works, sometimes not, I think because of quoting.

Anyway such a feature should definitely be included in
vanilla Emacs. For long commands it is just so much
better to write it on one plate, instead of RET-ing it
away on bit at a time, only at the second argument you
have already forgotten what you were doing --- and, it
is much easier to correct mistakes on the whole line
than - yeah, how do you do that (repeat, but almost) in
Emacs if a command didn't work and you know it is
because of the second of third argument?

Just think you had to do that in the shell - write one
command/argument at a time, and RET for each?

-- 
underground experts united


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

* Re: "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer)
  2014-09-06  4:39 ` "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer) Emanuel Berg
@ 2014-09-07 20:42   ` Marcin Borkowski
       [not found]   ` <mailman.8415.1410122578.1147.help-gnu-emacs@gnu.org>
  2014-09-08 23:20   ` "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer) Robert Thorpe
  2 siblings, 0 replies; 6+ messages in thread
From: Marcin Borkowski @ 2014-09-07 20:42 UTC (permalink / raw)
  To: help-gnu-emacs

Dnia 2014-09-06, o godz. 06:39:58
Emanuel Berg <embe8573@student.uu.se> napisał(a):

> OT (or on topic):
> 
> I would like a shell prompt in Emacs, but not like the
> IELM, instead as M-x, only the whole command and
> arguments!

M-: anybody?

;-)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



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

* Re: "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer)
       [not found]   ` <mailman.8415.1410122578.1147.help-gnu-emacs@gnu.org>
@ 2014-09-07 21:36     ` Emanuel Berg
  2014-09-08  4:51       ` "M-x shell" Alex Kost
       [not found]       ` <mailman.8436.1410151900.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Emanuel Berg @ 2014-09-07 21:36 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:

> M-: anybody?

It is not the same. You have to put parenthesis around
everything and quotation marks around data. Try it
yourself, with my solution, this works:

man ls

But with M-: or eval-expression that'll be:

(man "ls")

And then, I don't see a real advantage to:

M-x man RET ls RET

-- 
underground experts united


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

* Re: "M-x shell"
  2014-09-07 21:36     ` Emanuel Berg
@ 2014-09-08  4:51       ` Alex Kost
       [not found]       ` <mailman.8436.1410151900.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Alex Kost @ 2014-09-08  4:51 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg (2014-09-08 01:36 +0400) wrote:

> Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
>
>> M-: anybody?
>
> It is not the same. You have to put parenthesis around
> everything and quotation marks around data. Try it
> yourself, with my solution, this works:
>
> man ls

[...]

"man ls" works in eshell ("M-x eshell").



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

* Re: "M-x shell"
       [not found]       ` <mailman.8436.1410151900.1147.help-gnu-emacs@gnu.org>
@ 2014-09-08 21:41         ` Emanuel Berg
  0 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2014-09-08 21:41 UTC (permalink / raw)
  To: help-gnu-emacs

Alex Kost <alezost@gmail.com> writes:

> "man ls" works in eshell ("M-x eshell")

Yes, if you have eshell accept oneliners in the
metabuffer I'm happy!

-- 
underground experts united


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

* Re: "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer)
  2014-09-06  4:39 ` "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer) Emanuel Berg
  2014-09-07 20:42   ` Marcin Borkowski
       [not found]   ` <mailman.8415.1410122578.1147.help-gnu-emacs@gnu.org>
@ 2014-09-08 23:20   ` Robert Thorpe
  2 siblings, 0 replies; 6+ messages in thread
From: Robert Thorpe @ 2014-09-08 23:20 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

> Robert Thorpe <rt@robertthorpeconsulting.com> 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



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

end of thread, other threads:[~2014-09-08 23:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.8358.1409958182.1147.help-gnu-emacs@gnu.org>
2014-09-06  4:39 ` "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer) Emanuel Berg
2014-09-07 20:42   ` Marcin Borkowski
     [not found]   ` <mailman.8415.1410122578.1147.help-gnu-emacs@gnu.org>
2014-09-07 21:36     ` Emanuel Berg
2014-09-08  4:51       ` "M-x shell" Alex Kost
     [not found]       ` <mailman.8436.1410151900.1147.help-gnu-emacs@gnu.org>
2014-09-08 21:41         ` Emanuel Berg
2014-09-08 23:20   ` "M-x shell" (was: Re: Redirecting the output of a commend in "shell" into a buffer) Robert Thorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).