* shell-like Emacs CLI, and my Usenet behaviour
@ 2013-08-18 19:27 Emanuel Berg
2013-08-18 20:55 ` mathias.dahl
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Emanuel Berg @ 2013-08-18 19:27 UTC (permalink / raw)
To: help-gnu-emacs
After getting into several firefights, not just here but all over
Usenet, I have decided to change my behaviour. So it happened,
that my laptop (an old warhorse Dell Inspiron 1300), fell out of
my backpack, and broke (but I salvaged the HDD), and I am a
non-religious, "rational" believer in karma, so I interpreted this
as a sign that I should change my behaviour, and not be so easily
provoked, or as confrontational/high-energy in style.
But, not dwelling on the past, I have been thinking if not Emacs
would benefit from a shell-like CLI, instead of hammering the RET
between each stage?
Is this a new idea or did anyone do work on it?
There are several advantages:
For a simple example, the advantage is speed, less typing, and no
visual "reorient" after the RET.
In a shell:
man emacs RET
In Emacs:
M-x man RET emacs RET
For a long, complicated command, apart from the advantages
mentioned, it is often the case you are benefited from seeing the
options, the previous arguments, and the tool name, when you type
the command - you don't get lost as in Emacs - wait... what am I
doing? what did I do one second ago?
The visual memory doesn't work with bits and pieces. To verify
this, take a look at (the shell command)
cp
and then the option
-r
compare this to:
cp -r
The difference is stunning!
What's more, for complicated commands with options and/or
arguments, it is easy to do a mistake. With C-p in zsh, you get
the last command (the entire command), and you can use the
lightning-fast Emacs-style cursor movement keystrokes to get to
the disfunctional part, and correct it.
Although I don't habitually do complicated commands in Emacs,
because I bind it to functions, aliases, and keystrokes,
*sometimes* I do, and then I am frustrated the Emacs CLI isn't as
flexible as the shell's.
Putting it the other way around, are there any advantages to the
Emacs way, or is it the way it is because of practical
considerations when it was implemented?
--
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-18 19:27 shell-like Emacs CLI, and my Usenet behaviour Emanuel Berg
@ 2013-08-18 20:55 ` mathias.dahl
2013-08-18 21:04 ` Pascal J. Bourguignon
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: mathias.dahl @ 2013-08-18 20:55 UTC (permalink / raw)
To: help-gnu-emacs
> I have been thinking if not Emacs would benefit from a shell-like CLI, instead of hammering the RET between each stage?
>
> Is this a new idea or did anyone do work on it?
>
> There are several advantages:
>
> For a simple example, the advantage is speed, less typing, and no visual "reorient" after the RET.
>
> In a shell:
>
> man emacs RET
>
> In Emacs:
>
> M-x man RET emacs RET
For some commands (interactive functions) you can get something like this in eshell (M-x eshell). In eshell, try for example this:
$ woman emacs RET
(I'm on a Windows box right now so I cannot test, but that should work)
However, that will only work (I think) for commands (and non-interactive functions as well) that take parameters, where Emacs will pass the arguments from the Eshell command line, to the command/function, as arguments. For commands that by explicit code asks the user for a value, it would not work without some clever hacks, I think.
Maybe someone more knowledgeable about the internals of calling commands can comment on this?
/Mathias
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-18 19:27 shell-like Emacs CLI, and my Usenet behaviour Emanuel Berg
2013-08-18 20:55 ` mathias.dahl
@ 2013-08-18 21:04 ` Pascal J. Bourguignon
2013-08-19 6:57 ` Rustom Mody
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Pascal J. Bourguignon @ 2013-08-18 21:04 UTC (permalink / raw)
To: help-gnu-emacs
Emanuel Berg <embe8573@student.uu.se> writes:
> After getting into several firefights, not just here but all over
> Usenet, I have decided to change my behaviour. So it happened,
> that my laptop (an old warhorse Dell Inspiron 1300), fell out of
> my backpack, and broke (but I salvaged the HDD), and I am a
> non-religious, "rational" believer in karma, so I interpreted this
> as a sign that I should change my behaviour, and not be so easily
> provoked, or as confrontational/high-energy in style.
>
> But, not dwelling on the past, I have been thinking if not Emacs
> would benefit from a shell-like CLI, instead of hammering the RET
> between each stage?
>
> Is this a new idea or did anyone do work on it?
>
> There are several advantages:
>
> For a simple example, the advantage is speed, less typing, and no
> visual "reorient" after the RET.
>
> In a shell:
>
> man emacs RET
man SPC emacs RET
> In Emacs:
>
> M-x man RET emacs RET
The only thing that's earned in typing SPC instead of RET is that it
doesn't lock you in the command man. Perhaps you wanted actually woman,
so you can C-a wo RET before the final RET.
Now since emacs is a modeless editor, you couldn't (a-priori) edit the
commands in the same buffer as the normal text, so you would have to
switch to a command buffer.
C-x b *command-buffer RET man SPC emacs RET C-x b pgm.txt RET
begins to feel much less interesting than:
M-x man RET emacs RET
otherwise, it is possible to edit commands directly in normal buffers.
In emacs, in most modes, C-x C-e is left bound to eval-last-sexp, so you
can always type (man "emacs") C-x C-e in any buffer.
You could write a command, bound for example to C-RET, that would take
the text on the current line and interpret it as an emacs command. So
you could type:
RET man SPC emacs C-RET
instead of
M-x man RET emacs RET
Still no obvious gain. Actually, it may be quite useful to have such a
command, or otherwise a way to insert command "buttons" in any text
buffer. It's rather easy to implement in emacs.
--
__Pascal Bourguignon__
http://www.informatimago.com/
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-18 19:27 shell-like Emacs CLI, and my Usenet behaviour Emanuel Berg
2013-08-18 20:55 ` mathias.dahl
2013-08-18 21:04 ` Pascal J. Bourguignon
@ 2013-08-19 6:57 ` Rustom Mody
2013-08-19 7:55 ` Thien-Thi Nguyen
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Rustom Mody @ 2013-08-19 6:57 UTC (permalink / raw)
To: help-gnu-emacs
On Monday, August 19, 2013 12:57:42 AM UTC+5:30, Emanuel Berg wrote:
> After getting into several firefights, not just here but all over
> Usenet, I have decided to change my behaviour.
Glad to have you back :-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-18 19:27 shell-like Emacs CLI, and my Usenet behaviour Emanuel Berg
` (2 preceding siblings ...)
2013-08-19 6:57 ` Rustom Mody
@ 2013-08-19 7:55 ` Thien-Thi Nguyen
2013-08-19 15:16 ` Barry Margolin
2013-08-21 13:59 ` Stefan Monnier
5 siblings, 0 replies; 12+ messages in thread
From: Thien-Thi Nguyen @ 2013-08-19 7:55 UTC (permalink / raw)
To: Emanuel Berg; +Cc: help-gnu-emacs
() Emanuel Berg <embe8573@student.uu.se>
() Sun, 18 Aug 2013 21:27:42 +0200
not be so easily provoked
it's never too late to grok in full
that it's never too late to mix push and pull
too much hair: do beware!
nice warm sweater: that's much better!
stretching, dying, and weaving the wool.
thi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-18 19:27 shell-like Emacs CLI, and my Usenet behaviour Emanuel Berg
` (3 preceding siblings ...)
2013-08-19 7:55 ` Thien-Thi Nguyen
@ 2013-08-19 15:16 ` Barry Margolin
2013-08-21 13:59 ` Stefan Monnier
5 siblings, 0 replies; 12+ messages in thread
From: Barry Margolin @ 2013-08-19 15:16 UTC (permalink / raw)
To: help-gnu-emacs
In article <87eh9qpznc.fsf@nl106-137-194.student.uu.se>,
Emanuel Berg <embe8573@student.uu.se> wrote:
> Putting it the other way around, are there any advantages to the
> Emacs way, or is it the way it is because of practical
> considerations when it was implemented?
The main advantage is that the user doesn't have to worry about
quoting/escaping arguments when they contain the character that would be
used as the parameter delimiter.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-18 19:27 shell-like Emacs CLI, and my Usenet behaviour Emanuel Berg
` (4 preceding siblings ...)
2013-08-19 15:16 ` Barry Margolin
@ 2013-08-21 13:59 ` Stefan Monnier
2013-08-21 17:50 ` Guido Van Hoecke
5 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2013-08-21 13:59 UTC (permalink / raw)
To: help-gnu-emacs
> man emacs RET
vs
> M-x man RET emacs RET
I largely agree.
There's also
M-: (man "emacs") RET
You could easily make the surrounding parentheses implicit (or
pre-inserted), so that would be
M-: man "emacs" RET
So the main remaining problem is the quotes.
After all, for other functions, you'd want
M-: describe-function 'car RET
-- Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-21 13:59 ` Stefan Monnier
@ 2013-08-21 17:50 ` Guido Van Hoecke
2013-08-21 22:58 ` Bob Proulx
0 siblings, 1 reply; 12+ messages in thread
From: Guido Van Hoecke @ 2013-08-21 17:50 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> man emacs RET
That's exactly how you type it with eshell.
I probably have missed part of the conversation, and apologize if that's
the case, but to me, there's no shell like eshell. You can mix external
commands ane internal emacs commands, either self-made or the ones part
of the distribution.
Guido.
> vs
>> M-x man RET emacs RET
>
> I largely agree.
> There's also
>
> M-: (man "emacs") RET
>
> You could easily make the surrounding parentheses implicit (or
> pre-inserted), so that would be
>
> M-: man "emacs" RET
>
> So the main remaining problem is the quotes.
> After all, for other functions, you'd want
>
> M-: describe-function 'car RET
>
>
> -- Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-21 17:50 ` Guido Van Hoecke
@ 2013-08-21 22:58 ` Bob Proulx
2013-08-22 6:40 ` Guido Van Hoecke
2013-08-22 22:42 ` W. Greenhouse
0 siblings, 2 replies; 12+ messages in thread
From: Bob Proulx @ 2013-08-21 22:58 UTC (permalink / raw)
To: help-gnu-emacs
Guido Van Hoecke wrote:
> Stefan Monnier writes:
> >> man emacs RET
>
> That's exactly how you type it with eshell.
>
> I probably have missed part of the conversation, and apologize if that's
> the case, but to me, there's no shell like eshell. You can mix external
> commands ane internal emacs commands, either self-made or the ones part
> of the distribution.
Is there an eshell keybinding or suggestion for keybinding so that
people could do M-X (where X is the binding) or C-x X and then invoke
it like in the above? (I am too time limited to look. And you seem
knowledgeable about eshell and will probably know without looking.)
Bob
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-21 22:58 ` Bob Proulx
@ 2013-08-22 6:40 ` Guido Van Hoecke
2013-08-22 22:42 ` W. Greenhouse
1 sibling, 0 replies; 12+ messages in thread
From: Guido Van Hoecke @ 2013-08-22 6:40 UTC (permalink / raw)
To: help-gnu-emacs
Bob Proulx <bob@proulx.com> writes:
> Guido Van Hoecke wrote:
>> Stefan Monnier writes:
>> >> man emacs RET
>>
>> That's exactly how you type it with eshell.
>>
>> I probably have missed part of the conversation, and apologize if that's
>> the case, but to me, there's no shell like eshell. You can mix external
>> commands ane internal emacs commands, either self-made or the ones part
>> of the distribution.
>
> Is there an eshell keybinding or suggestion for keybinding so that
> people could do M-X (where X is the binding) or C-x X and then invoke
> it like in the above? (I am too time limited to look. And you seem
> knowledgeable about eshell and will probably know without looking.)
I do not understand the need for such a key. Eshell creates a shell
buffer. You just switch to it and type your command, without M-X or
whatever. I've mapped following little method to F8, so whenever I want
my shell, I hit F8 and start banging awy.
(defun guivho-switch-to-or-open-eshell-window()
"switch to current *eshell* window, or start eshell in current window"
(interactive)
(if (get-buffer-window "*eshell*" t)
(select-window (get-buffer-window "*eshell*"))
(eshell)))
If you want several eshell buffers, you can use M-x rename-uniquely.
I hope this helps,
Guido
--
Look, we trade every day out there with hustlers, deal-makers, shysters,
con-men. That's the way businesses get started. That's the way this
country was built.
-- Hubert Allen
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-21 22:58 ` Bob Proulx
2013-08-22 6:40 ` Guido Van Hoecke
@ 2013-08-22 22:42 ` W. Greenhouse
2013-08-23 6:06 ` Guido Van Hoecke
1 sibling, 1 reply; 12+ messages in thread
From: W. Greenhouse @ 2013-08-22 22:42 UTC (permalink / raw)
To: help-gnu-emacs
Bob Proulx <bob@proulx.com> writes:
> Guido Van Hoecke wrote:
>> Stefan Monnier writes:
>> >> man emacs RET
>>
>> That's exactly how you type it with eshell.
>>
>> I probably have missed part of the conversation, and apologize if that's
>> the case, but to me, there's no shell like eshell. You can mix external
>> commands ane internal emacs commands, either self-made or the ones part
>> of the distribution.
>
> Is there an eshell keybinding or suggestion for keybinding so that
> people could do M-X (where X is the binding) or C-x X and then invoke
> it like in the above? (I am too time limited to look. And you seem
> knowledgeable about eshell and will probably know without looking.)
>
> Bob
Besides using eshell like a shell in a dedicated buffer,
`eshell-command' is nice to add to your repertoire of ways to invoke
processes interactively from Emacs. It runs eshell one-liners, similar
to `shell-command' and `async-shell-command'.
I like (global-set-key (kbd "M-!") 'eshell-command), since I pretty much
never want the standard, synchronous behavior of `shell-command'.
--
Regards,
WGG
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: shell-like Emacs CLI, and my Usenet behaviour
2013-08-22 22:42 ` W. Greenhouse
@ 2013-08-23 6:06 ` Guido Van Hoecke
0 siblings, 0 replies; 12+ messages in thread
From: Guido Van Hoecke @ 2013-08-23 6:06 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
On 23 August 2013 00:42, W. Greenhouse <wgreenhouse@riseup.net> wrote:
> Besides using eshell like a shell in a dedicated buffer,
> `eshell-command' is nice to add to your repertoire of ways to invoke
> processes interactively from Emacs. It runs eshell one-liners, similar
> to `shell-command' and `async-shell-command'.
>
> I like (global-set-key (kbd "M-!") 'eshell-command), since I pretty much
> never want the standard, synchronous behavior of `shell-command'.
Definitely never too old to learn :)
Thanks for the pointer,
Guido.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-08-23 6:06 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-18 19:27 shell-like Emacs CLI, and my Usenet behaviour Emanuel Berg
2013-08-18 20:55 ` mathias.dahl
2013-08-18 21:04 ` Pascal J. Bourguignon
2013-08-19 6:57 ` Rustom Mody
2013-08-19 7:55 ` Thien-Thi Nguyen
2013-08-19 15:16 ` Barry Margolin
2013-08-21 13:59 ` Stefan Monnier
2013-08-21 17:50 ` Guido Van Hoecke
2013-08-21 22:58 ` Bob Proulx
2013-08-22 6:40 ` Guido Van Hoecke
2013-08-22 22:42 ` W. Greenhouse
2013-08-23 6:06 ` Guido Van Hoecke
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).