* Optimal emacs shell for coding @ 2008-08-11 11:38 Jonathan Groll 2008-08-11 12:05 ` Peter Dyballa 2008-08-11 15:06 ` Thien-Thi Nguyen 0 siblings, 2 replies; 27+ messages in thread From: Jonathan Groll @ 2008-08-11 11:38 UTC (permalink / raw) To: help-gnu-emacs I know of only three ways to get an emacs shell: M-x terminal-emulator M-x shell M-x eshell (There is also M-x shell-command RET) Question is, which one is best for coding? Lately I've found myself opening up an xterm session to do miscellaneous coding support tasks - and am mostly struggling with different readline history keybindings (eg. I'm used to entering C-r at a shell to get (reverse-i-search) - obviously in an emacs shell this will have a dfferent outcome to what I desire! Any recommendations? Many thanks, Jonathan Groll. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-11 11:38 Optimal emacs shell for coding Jonathan Groll @ 2008-08-11 12:05 ` Peter Dyballa 2008-08-11 15:06 ` Thien-Thi Nguyen 1 sibling, 0 replies; 27+ messages in thread From: Peter Dyballa @ 2008-08-11 12:05 UTC (permalink / raw) To: Jonathan Groll; +Cc: help-gnu-emacs Am 11.08.2008 um 13:38 schrieb Jonathan Groll: > Question is, which one is best for coding? Bigger question is: what do you mean with "coding?" For coding, i.e., writing code to be compiled, interpreted, or executed, you don't need a shell. Even vi could be OK for this purpose ... -- Greetings Pete Time is an illusion. Lunchtime, doubly so. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-11 11:38 Optimal emacs shell for coding Jonathan Groll 2008-08-11 12:05 ` Peter Dyballa @ 2008-08-11 15:06 ` Thien-Thi Nguyen 1 sibling, 0 replies; 27+ messages in thread From: Thien-Thi Nguyen @ 2008-08-11 15:06 UTC (permalink / raw) To: Jonathan Groll; +Cc: help-gnu-emacs () Jonathan Groll <lists@groll.co.za> () Mon, 11 Aug 2008 13:38:54 +0200 Any recommendations? I consider Emacs the optimal shell. Some keybindings i find especially useful: (global-set-key "\M-m" 'compile) (define-key minibuffer-local-map "\M-m" 'exit-minibuffer) Left thumb on meta, and `m', `p', `n' (as needed) and finally `m' w/ the right hand. thi ^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <mailman.16366.1218454746.18990.help-gnu-emacs@gnu.org>]
* Re: Optimal emacs shell for coding [not found] <mailman.16366.1218454746.18990.help-gnu-emacs@gnu.org> @ 2008-08-11 13:30 ` Xah 2008-08-11 15:24 ` Lennart Borgman (gmail) ` (3 more replies) 2008-08-11 13:40 ` Mike Treseler 1 sibling, 4 replies; 27+ messages in thread From: Xah @ 2008-08-11 13:30 UTC (permalink / raw) To: help-gnu-emacs On Aug 11, 4:38 am, Jonathan Groll <li...@groll.co.za> wrote: > I know of only three ways to get an emacs shell: > > M-x terminal-emulator > M-x shell > M-x eshell > (There is also M-x shell-command RET) > > Question is, which one is best for coding? Lately I've found myself > opening up an xterm session to do miscellaneous coding support tasks - > and am mostly struggling with different readline history keybindings > (eg. I'm used to entering C-r at a shell to get (reverse-i-search) - > obviously in an emacs shell this will have a dfferent outcome to what > I desire! > > Any recommendations? They really all have different purposs. • M-x shell-command lets you run a single shell cammand. • M-x shell command line interface to OS. • M-x terminal-emulator This is actually a terminal emulator. For example, you can start a telnet or ssh or top in it. You can also start a vi, or even emacs itself within. You cannot run these problems with M-x shell, for example. • M-x eshell This is just like shell, except it's written in elisp. The purpose is so that you can have access to the familiar unix shell in different OSes such as MS Windows. In general, the shell-command and shell is most useful. Run eshell if you are in Windows and don't have cygwin installed and want to run unix commands such as ls, cd, mkdir, etc. If you need to run telnet, ssh, top, or any program that fills a screen, you'll need to run term. I don't particular recommend it because once in term, many default keybindings of emacs won't work because it pretends to be a term emu. If you want to run ssh etc, best to start in a real term emulator. For more tips, see http://xahlee.org/emacs/emacs_unix.html Xah ∑ http://xahlee.org/ ☄ ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-11 13:30 ` Xah @ 2008-08-11 15:24 ` Lennart Borgman (gmail) [not found] ` <mailman.16375.1218468298.18990.help-gnu-emacs@gnu.org> ` (2 subsequent siblings) 3 siblings, 0 replies; 27+ messages in thread From: Lennart Borgman (gmail) @ 2008-08-11 15:24 UTC (permalink / raw) To: Xah; +Cc: help-gnu-emacs Xah wrote: > In general, the shell-command and shell is most useful. Run eshell if > you are in Windows and don't have cygwin installed and want to run > unix commands such as ls, cd, mkdir, etc. If you need to run telnet, Have you tried for example "grep" from within eshell? Quite nice. ^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <mailman.16375.1218468298.18990.help-gnu-emacs@gnu.org>]
* Re: Optimal emacs shell for coding [not found] ` <mailman.16375.1218468298.18990.help-gnu-emacs@gnu.org> @ 2008-08-11 15:49 ` Xah 2008-08-11 16:47 ` Lennart Borgman (gmail) [not found] ` <mailman.16385.1218473260.18990.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 27+ messages in thread From: Xah @ 2008-08-11 15:49 UTC (permalink / raw) To: help-gnu-emacs On Aug 11, 8:24 am, "Lennart Borgman (gmail)" <lennart.borg...@gmail.com> wrote: > Xahwrote: > > In general, the shell-command and shell is most useful. Run eshell if > > you are in Windows and don't have cygwin installed and want to run > > unix commands such as ls, cd, mkdir, etc. If you need to run telnet, > > Have you tried for example "grep" from within eshell? Quite nice. Let me see... ----------------------------- Welcome to the Emacs shell ~/web/emacs $ which grep eshell/grep is a compiled Lisp function in `em-unix.el' ~/web/emacs $ ls | grep lin elisp_link_report.el modernization.html elisp_link_report.el~ modernization_html_mail.html elisp_link_report.html modernization_meta_key.html elisp_make_link.html ms_keyboard emacs_installing_packages.html wrap-url2.html.gz emacs_manual_problem.html xah_emacs_linkify.el emacs_n_unicode.html xah_emacs_linkify.el~ ~/web/emacs $ ----------------------------- LOL. Get back to work Len. Xah ∑ http://xahlee.org/ ☄ ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-11 15:49 ` Xah @ 2008-08-11 16:47 ` Lennart Borgman (gmail) [not found] ` <mailman.16385.1218473260.18990.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 27+ messages in thread From: Lennart Borgman (gmail) @ 2008-08-11 16:47 UTC (permalink / raw) To: Xah; +Cc: help-gnu-emacs Xah wrote: > On Aug 11, 8:24 am, "Lennart Borgman (gmail)" > <lennart.borg...@gmail.com> wrote: >> Xahwrote: >>> In general, the shell-command and shell is most useful. Run eshell if >>> you are in Windows and don't have cygwin installed and want to run >>> unix commands such as ls, cd, mkdir, etc. If you need to run telnet, >> Have you tried for example "grep" from within eshell? Quite nice. > > Let me see... > > ----------------------------- > > Welcome to the Emacs shell > > > ~/web/emacs $ which grep > eshell/grep is a compiled Lisp function in `em-unix.el' > ~/web/emacs $ ls | grep lin > elisp_link_report.el modernization.html > elisp_link_report.el~ > modernization_html_mail.html > elisp_link_report.html > modernization_meta_key.html > elisp_make_link.html ms_keyboard > emacs_installing_packages.html wrap-url2.html.gz > emacs_manual_problem.html xah_emacs_linkify.el > emacs_n_unicode.html xah_emacs_linkify.el~ > ~/web/emacs $ > > ----------------------------- > > LOL. > > Get back to work Len. Why do you think predictable behaviour is nice? ;-) Ok, you discovered the bug so it is your turn to file a bug report again ... ^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <mailman.16385.1218473260.18990.help-gnu-emacs@gnu.org>]
* Re: Optimal emacs shell for coding [not found] ` <mailman.16385.1218473260.18990.help-gnu-emacs@gnu.org> @ 2008-08-12 8:06 ` Tim X 2008-08-12 12:06 ` Lennart Borgman (gmail) 2008-08-12 18:30 ` Eli Zaretskii 0 siblings, 2 replies; 27+ messages in thread From: Tim X @ 2008-08-12 8:06 UTC (permalink / raw) To: help-gnu-emacs "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes: > Xah wrote: >> On Aug 11, 8:24 am, "Lennart Borgman (gmail)" >> <lennart.borg...@gmail.com> wrote: >>> Xahwrote: >>>> In general, the shell-command and shell is most useful. Run eshell if >>>> you are in Windows and don't have cygwin installed and want to run >>>> unix commands such as ls, cd, mkdir, etc. If you need to run telnet, >>> Have you tried for example "grep" from within eshell? Quite nice. >> >> Let me see... >> >> ----------------------------- >> >> Welcome to the Emacs shell >> >> >> ~/web/emacs $ which grep >> eshell/grep is a compiled Lisp function in `em-unix.el' >> ~/web/emacs $ ls | grep lin >> elisp_link_report.el modernization.html >> elisp_link_report.el~ >> modernization_html_mail.html >> elisp_link_report.html >> modernization_meta_key.html >> elisp_make_link.html ms_keyboard >> emacs_installing_packages.html wrap-url2.html.gz >> emacs_manual_problem.html xah_emacs_linkify.el >> emacs_n_unicode.html xah_emacs_linkify.el~ >> ~/web/emacs $ >> >> ----------------------------- >> >> LOL. >> >> Get back to work Len. > > > Why do you think predictable behaviour is nice? ;-) > > Ok, you discovered the bug so it is your turn to file a bug report again ... don't think its a bug. This is eshell not handling redirection correclty and is something that cannot be easily fixed. Bottom line, don't use redirection in eshell. Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 8:06 ` Tim X @ 2008-08-12 12:06 ` Lennart Borgman (gmail) 2008-08-12 18:33 ` Eli Zaretskii 2008-08-12 18:30 ` Eli Zaretskii 1 sibling, 1 reply; 27+ messages in thread From: Lennart Borgman (gmail) @ 2008-08-12 12:06 UTC (permalink / raw) Cc: help-gnu-emacs Tim X wrote: >>> ~/web/emacs $ which grep >>> eshell/grep is a compiled Lisp function in `em-unix.el' >>> ~/web/emacs $ ls | grep lin >>> elisp_link_report.el modernization.html >>> elisp_link_report.el~ >>> modernization_html_mail.html >>> elisp_link_report.html >>> modernization_meta_key.html >>> elisp_make_link.html ms_keyboard >>> emacs_installing_packages.html wrap-url2.html.gz >>> emacs_manual_problem.html xah_emacs_linkify.el >>> emacs_n_unicode.html xah_emacs_linkify.el~ >>> ~/web/emacs $ > > don't think its a bug. This is eshell not handling redirection correclty > and is something that cannot be easily fixed. Bottom line, don't use > redirection in eshell. If you look carefully at the output you can see that what is not handled is the parameters to "ls". If you try "ls -1" it will work. So, yes it is a problem with redirection, but only with the (implicit) arguments to the first program. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 12:06 ` Lennart Borgman (gmail) @ 2008-08-12 18:33 ` Eli Zaretskii 2008-08-12 18:40 ` Lennart Borgman (gmail) 0 siblings, 1 reply; 27+ messages in thread From: Eli Zaretskii @ 2008-08-12 18:33 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 12 Aug 2008 14:06:02 +0200 > From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> > CC: help-gnu-emacs@gnu.org > > If you look carefully at the output you can see that what is not handled > is the parameters to "ls". If you try "ls -1" it will work. What "parameters to ls"? "ls" was invoked without any parameters. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 18:33 ` Eli Zaretskii @ 2008-08-12 18:40 ` Lennart Borgman (gmail) 2008-08-12 18:52 ` Eli Zaretskii 0 siblings, 1 reply; 27+ messages in thread From: Lennart Borgman (gmail) @ 2008-08-12 18:40 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs Eli Zaretskii wrote: >> Date: Tue, 12 Aug 2008 14:06:02 +0200 >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >> CC: help-gnu-emacs@gnu.org >> >> If you look carefully at the output you can see that what is not handled >> is the parameters to "ls". If you try "ls -1" it will work. > > What "parameters to ls"? "ls" was invoked without any parameters. If you from a shell do ls | grep then normally ls implicitly gets the -1 parameter (as I understands it), but that does not happen currently in eshell. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 18:40 ` Lennart Borgman (gmail) @ 2008-08-12 18:52 ` Eli Zaretskii 2008-08-12 19:02 ` Lennart Borgman (gmail) 0 siblings, 1 reply; 27+ messages in thread From: Eli Zaretskii @ 2008-08-12 18:52 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 12 Aug 2008 20:40:35 +0200 > From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> > CC: help-gnu-emacs@gnu.org > > Eli Zaretskii wrote: > >> Date: Tue, 12 Aug 2008 14:06:02 +0200 > >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> > >> CC: help-gnu-emacs@gnu.org > >> > >> If you look carefully at the output you can see that what is not handled > >> is the parameters to "ls". If you try "ls -1" it will work. > > > > What "parameters to ls"? "ls" was invoked without any parameters. > > If you from a shell do > > ls | grep > > then normally ls implicitly gets the -1 parameter No, it doesn't. Please try and see for yourself (I just did). ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 18:52 ` Eli Zaretskii @ 2008-08-12 19:02 ` Lennart Borgman (gmail) 2008-08-12 19:11 ` ken ` (2 more replies) 0 siblings, 3 replies; 27+ messages in thread From: Lennart Borgman (gmail) @ 2008-08-12 19:02 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs Eli Zaretskii wrote: >> Date: Tue, 12 Aug 2008 20:40:35 +0200 >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >> CC: help-gnu-emacs@gnu.org >> >> Eli Zaretskii wrote: >>>> Date: Tue, 12 Aug 2008 14:06:02 +0200 >>>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >>>> CC: help-gnu-emacs@gnu.org >>>> >>>> If you look carefully at the output you can see that what is not handled >>>> is the parameters to "ls". If you try "ls -1" it will work. >>> What "parameters to ls"? "ls" was invoked without any parameters. >> If you from a shell do >> >> ls | grep >> >> then normally ls implicitly gets the -1 parameter > > No, it doesn't. Please try and see for yourself (I just did). We are miscommunicating. Exactly what are you saying? I am saying that if I from a shell outside of Emacs do ls than I get several files listed on each row while the output from ls | grep some-file implies that ls got the implicit argument -1 when used in the pipe. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 19:02 ` Lennart Borgman (gmail) @ 2008-08-12 19:11 ` ken 2008-08-12 19:28 ` Lennart Borgman (gmail) 2008-08-12 19:16 ` Eli Zaretskii [not found] ` <mailman.16490.1218568567.18990.help-gnu-emacs@gnu.org> 2 siblings, 1 reply; 27+ messages in thread From: ken @ 2008-08-12 19:11 UTC (permalink / raw) To: Lennart Borgman (gmail); +Cc: help-gnu-emacs -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/12/2008 03:02 PM Lennart Borgman (gmail) wrote: | Eli Zaretskii wrote: |>> Date: Tue, 12 Aug 2008 20:40:35 +0200 |>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> |>> CC: help-gnu-emacs@gnu.org |>> |>> Eli Zaretskii wrote: |>>>> Date: Tue, 12 Aug 2008 14:06:02 +0200 |>>>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> |>>>> CC: help-gnu-emacs@gnu.org |>>>> |>>>> If you look carefully at the output you can see that what is not |>>>> handled is the parameters to "ls". If you try "ls -1" it will work. |>>> What "parameters to ls"? "ls" was invoked without any parameters. |>> If you from a shell do |>> |>> ls | grep |>> |>> then normally ls implicitly gets the -1 parameter |> |> No, it doesn't. Please try and see for yourself (I just did). | | | We are miscommunicating. Exactly what are you saying? | | I am saying that if I from a shell outside of Emacs do | | ls | | than I get several files listed on each row while the output from | | ls | grep some-file | | implies that ls got the implicit argument -1 when used in the pipe. Lennart, You're correct: ls followed by a pipe puts each file on a line by itself... easily demonstrated by "ls|less", "ls|more", "ls|wc -l", "ls|grep -E $", and others. Weird, but true. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFIoeBa8CeNiFrQkecRAu3UAKCONy17ZkSqEpx9Y+mswYDBTmJhSwCfdJgT ePFlKRA1jfkvRy1/xgSoO8c= =vgsE -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 19:11 ` ken @ 2008-08-12 19:28 ` Lennart Borgman (gmail) 0 siblings, 0 replies; 27+ messages in thread From: Lennart Borgman (gmail) @ 2008-08-12 19:28 UTC (permalink / raw) To: gebser; +Cc: help-gnu-emacs ken wrote: > | I am saying that if I from a shell outside of Emacs do > | > | ls > | > | than I get several files listed on each row while the output from > | > | ls | grep some-file > | > | implies that ls got the implicit argument -1 when used in the pipe. > > Lennart, > > You're correct: ls followed by a pipe puts each file on a line by > itself... easily demonstrated by "ls|less", "ls|more", "ls|wc -l", > "ls|grep -E $", and others. > > Weird, but true. That is the magic behind thinking, some people have find that this is useful and implemented it ... ;-) ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 19:02 ` Lennart Borgman (gmail) 2008-08-12 19:11 ` ken @ 2008-08-12 19:16 ` Eli Zaretskii [not found] ` <mailman.16490.1218568567.18990.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 27+ messages in thread From: Eli Zaretskii @ 2008-08-12 19:16 UTC (permalink / raw) To: help-gnu-emacs > Date: Tue, 12 Aug 2008 21:02:21 +0200 > From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> > CC: help-gnu-emacs@gnu.org > > Eli Zaretskii wrote: > >> Date: Tue, 12 Aug 2008 20:40:35 +0200 > >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> > >> CC: help-gnu-emacs@gnu.org > >> > >> Eli Zaretskii wrote: > >>>> Date: Tue, 12 Aug 2008 14:06:02 +0200 > >>>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> > >>>> CC: help-gnu-emacs@gnu.org > >>>> > >>>> If you look carefully at the output you can see that what is not handled > >>>> is the parameters to "ls". If you try "ls -1" it will work. > >>> What "parameters to ls"? "ls" was invoked without any parameters. > >> If you from a shell do > >> > >> ls | grep > >> > >> then normally ls implicitly gets the -1 parameter > > > > No, it doesn't. Please try and see for yourself (I just did). > > > We are miscommunicating. Maybe you are; I am not ;-) > I am saying that if I from a shell outside of Emacs do > > ls > > than I get several files listed on each row while the output from > > ls | grep some-file > > implies that ls got the implicit argument -1 when used in the pipe. And I'm saying that you are wrong: -1 is not implied in a pipeline from the shell prompt, either. Please try that and see for yourself. I tried that both on GNU/Linux and in a Windows command prompt window, and GNU `ls' does not imply -1 in either case. ^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <mailman.16490.1218568567.18990.help-gnu-emacs@gnu.org>]
* Re: Optimal emacs shell for coding [not found] ` <mailman.16490.1218568567.18990.help-gnu-emacs@gnu.org> @ 2008-08-13 1:01 ` Chris F.A. Johnson 2008-08-13 8:20 ` Tim X 1 sibling, 0 replies; 27+ messages in thread From: Chris F.A. Johnson @ 2008-08-13 1:01 UTC (permalink / raw) To: help-gnu-emacs On 2008-08-12, Eli Zaretskii wrote: ... > And I'm saying that you are wrong: -1 is not implied in a pipeline > from the shell prompt, either. Please try that and see for yourself. > I tried that both on GNU/Linux and in a Windows command prompt window, > and GNU `ls' does not imply -1 in either case. If the output is not going to a terminal, ls will print one file per line. This is as required by POSIX and how every version of ls behaves. At the shell prompt (GNU/Linux, FreeBSD, etc., etc...) $ touch qwerty uiop asdf ghjkl zxcv bnml $ ls asdf bnml ghjkl qwerty uiop zxcv $ ls | cat asdf bnml ghjkl qwerty uiop zxcv Emacs eshell behaves incorrectly: $ ls asdf bnml ghjkl qwerty uiop zxcv $ ls | cat asdf bnml ghjkl qwerty uiop zxcv -- Chris F.A. Johnson, webmaster <http://Woodbine-Gerrard.com> =================================================================== Author: Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress) ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding [not found] ` <mailman.16490.1218568567.18990.help-gnu-emacs@gnu.org> 2008-08-13 1:01 ` Chris F.A. Johnson @ 2008-08-13 8:20 ` Tim X 2008-08-13 11:21 ` Thierry Volpiatto 1 sibling, 1 reply; 27+ messages in thread From: Tim X @ 2008-08-13 8:20 UTC (permalink / raw) To: help-gnu-emacs Eli Zaretskii <eliz@gnu.org> writes: >> Date: Tue, 12 Aug 2008 21:02:21 +0200 >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >> CC: help-gnu-emacs@gnu.org >> >> Eli Zaretskii wrote: >> >> Date: Tue, 12 Aug 2008 20:40:35 +0200 >> >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >> >> CC: help-gnu-emacs@gnu.org >> >> >> >> Eli Zaretskii wrote: >> >>>> Date: Tue, 12 Aug 2008 14:06:02 +0200 >> >>>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >> >>>> CC: help-gnu-emacs@gnu.org >> >>>> >> >>>> If you look carefully at the output you can see that what is not handled >> >>>> is the parameters to "ls". If you try "ls -1" it will work. >> >>> What "parameters to ls"? "ls" was invoked without any parameters. >> >> If you from a shell do >> >> >> >> ls | grep >> >> >> >> then normally ls implicitly gets the -1 parameter >> > >> > No, it doesn't. Please try and see for yourself (I just did). >> >> >> We are miscommunicating. > > Maybe you are; I am not ;-) > >> I am saying that if I from a shell outside of Emacs do >> >> ls >> >> than I get several files listed on each row while the output from >> >> ls | grep some-file >> >> implies that ls got the implicit argument -1 when used in the pipe. > > And I'm saying that you are wrong: -1 is not implied in a pipeline > from the shell prompt, either. Please try that and see for yourself. > I tried that both on GNU/Linux and in a Windows command prompt window, > and GNU `ls' does not imply -1 in either case. > Exactly. An you can do another test. Just do ls | less all the files are on one line each. this is standard behavior for ls if you pipe or redirect it away from a tty. It only formats multi-column output if the output device is a tty, unless you provide the switch to force single column output. Note also that usually, the number of columns is a function of the longest filename and the display width. The concept of 'width' has no meaning with respect to stdout or when redirecting via | or > etc. Note that this is 'normal' behavior - if programs output multiple items per line, it would screw up programs that you pipe into. Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-13 8:20 ` Tim X @ 2008-08-13 11:21 ` Thierry Volpiatto 0 siblings, 0 replies; 27+ messages in thread From: Thierry Volpiatto @ 2008-08-13 11:21 UTC (permalink / raw) To: help-gnu-emacs Tim X <timx@nospam.dev.null> writes: > Eli Zaretskii <eliz@gnu.org> writes: > >>> Date: Tue, 12 Aug 2008 21:02:21 +0200 >>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >>> CC: help-gnu-emacs@gnu.org >>> >>> Eli Zaretskii wrote: >>> >> Date: Tue, 12 Aug 2008 20:40:35 +0200 >>> >> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >>> >> CC: help-gnu-emacs@gnu.org >>> >> >>> >> Eli Zaretskii wrote: >>> >>>> Date: Tue, 12 Aug 2008 14:06:02 +0200 >>> >>>> From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> >>> >>>> CC: help-gnu-emacs@gnu.org >>> >>>> >>> >>>> If you look carefully at the output you can see that what is not handled >>> >>>> is the parameters to "ls". If you try "ls -1" it will work. >>> >>> What "parameters to ls"? "ls" was invoked without any parameters. >>> >> If you from a shell do >>> >> >>> >> ls | grep >>> >> >>> >> then normally ls implicitly gets the -1 parameter >>> > >>> > No, it doesn't. Please try and see for yourself (I just did). >>> >>> >>> We are miscommunicating. >> >> Maybe you are; I am not ;-) >> >>> I am saying that if I from a shell outside of Emacs do >>> >>> ls >>> >>> than I get several files listed on each row while the output from >>> >>> ls | grep some-file >>> >>> implies that ls got the implicit argument -1 when used in the pipe. >> >> And I'm saying that you are wrong: -1 is not implied in a pipeline >> from the shell prompt, either. Please try that and see for yourself. >> I tried that both on GNU/Linux and in a Windows command prompt window, >> and GNU `ls' does not imply -1 in either case. >> > Exactly. An you can do another test. Just do > > ls | less > > all the files are on one line each. this is standard behavior for ls if > you pipe or redirect it away from a tty. It only formats multi-column > output if the output device is a tty, unless you provide the switch to > force single column output. Note also that usually, the number of > columns is a function of the longest filename and the display width. The > concept of 'width' has no meaning with respect to stdout or when > redirecting via | or > etc. > > Note that this is 'normal' behavior - if programs output multiple items > per line, it would screw up programs that you pipe into. > > Tim Sorry, i insert again this reply here, i think i did a mistake and reply on another topic. As Lennart said you call ls with -1 arg or you can always call ls with this arg setting it like that: ,---- | (setq eshell-ls-initial-args '(-1)) `---- now when you call for example "ls | wc -l" , you will have the good number of lines. It would be cool to have a function to call in some hook to call ls -1 only if there is a "|" after ls, this function do that but i need a hook to call it: ,---- | (defun eshell-set-ls () | (let ((com-line | (eshell-parse-arguments (re-search-backward "ls") (line-end-position)))) | (if (equal (nth 1 com-line) '(eshell-operator "|")) | (setq eshell-ls-initial-args '(-1)) | (setq eshell-ls-initial-args nil)))) `---- -- A + Thierry Volpiatto Location: Saint-Cyr-Sur-Mer - France ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 8:06 ` Tim X 2008-08-12 12:06 ` Lennart Borgman (gmail) @ 2008-08-12 18:30 ` Eli Zaretskii 2008-08-12 19:14 ` David Hansen [not found] ` <mailman.16492.1218569015.18990.help-gnu-emacs@gnu.org> 1 sibling, 2 replies; 27+ messages in thread From: Eli Zaretskii @ 2008-08-12 18:30 UTC (permalink / raw) To: help-gnu-emacs > From: Tim X <timx@nospam.dev.null> > Date: Tue, 12 Aug 2008 18:06:59 +1000 > > >> ~/web/emacs $ which grep > >> eshell/grep is a compiled Lisp function in `em-unix.el' > >> ~/web/emacs $ ls | grep lin > >> elisp_link_report.el modernization.html > >> elisp_link_report.el~ > >> modernization_html_mail.html > >> elisp_link_report.html > >> modernization_meta_key.html > >> elisp_make_link.html ms_keyboard > >> emacs_installing_packages.html wrap-url2.html.gz > >> emacs_manual_problem.html xah_emacs_linkify.el > >> emacs_n_unicode.html xah_emacs_linkify.el~ > >> ~/web/emacs $ > >> > >> ----------------------------- > >> > >> LOL. > >> > >> Get back to work Len. > > > > > > Why do you think predictable behaviour is nice? ;-) > > > > Ok, you discovered the bug so it is your turn to file a bug report again ... > > don't think its a bug. This is eshell not handling redirection correclty > and is something that cannot be easily fixed. Bottom line, don't use > redirection in eshell. FWIW, I don't see anything wrong with the above: just unwrap the obviously wrapped lines, and you will see that everything is honky-dory. ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-12 18:30 ` Eli Zaretskii @ 2008-08-12 19:14 ` David Hansen [not found] ` <mailman.16492.1218569015.18990.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 27+ messages in thread From: David Hansen @ 2008-08-12 19:14 UTC (permalink / raw) To: help-gnu-emacs On Tue, 12 Aug 2008 21:30:55 +0300 Eli Zaretskii wrote: >> From: Tim X <timx@nospam.dev.null> >> Date: Tue, 12 Aug 2008 18:06:59 +1000 >> >> >> ~/web/emacs $ which grep >> >> eshell/grep is a compiled Lisp function in `em-unix.el' >> >> ~/web/emacs $ ls | grep lin >> >> elisp_link_report.el modernization.html >> >> elisp_link_report.el~ >> >> modernization_html_mail.html >> >> elisp_link_report.html >> >> modernization_meta_key.html >> >> elisp_make_link.html ms_keyboard >> >> emacs_installing_packages.html wrap-url2.html.gz >> >> emacs_manual_problem.html xah_emacs_linkify.el >> >> emacs_n_unicode.html xah_emacs_linkify.el~ >> >> ~/web/emacs $ >> >> >> >> ----------------------------- >> >> >> >> LOL. >> >> >> >> Get back to work Len. >> > >> > >> > Why do you think predictable behaviour is nice? ;-) >> > >> > Ok, you discovered the bug so it is your turn to file a bug report again ... >> >> don't think its a bug. This is eshell not handling redirection correclty >> and is something that cannot be easily fixed. Bottom line, don't use >> redirection in eshell. > > FWIW, I don't see anything wrong with the above: just unwrap the > obviously wrapped lines, and you will see that everything is > honky-dory. But it's different from how bash + ls behave in a "normal" terminal. When stdout for the `ls' command is not a tty it prints one file per line (IMHO the right way). David ^ permalink raw reply [flat|nested] 27+ messages in thread
[parent not found: <mailman.16492.1218569015.18990.help-gnu-emacs@gnu.org>]
* Re: Optimal emacs shell for coding [not found] ` <mailman.16492.1218569015.18990.help-gnu-emacs@gnu.org> @ 2008-08-12 20:08 ` Rupert Swarbrick 0 siblings, 0 replies; 27+ messages in thread From: Rupert Swarbrick @ 2008-08-12 20:08 UTC (permalink / raw) To: help-gnu-emacs [-- Attachment #1.1: Type: text/plain, Size: 965 bytes --] >>> >>> >> ~/web/emacs $ which grep ... >>> >> emacs_n_unicode.html xah_emacs_linkify.el~ >>> >> ~/web/emacs $ ... >>> > >>> > >>> > Why do you think predictable behaviour is nice? ;-) >>> > >>> > Ok, you discovered the bug so it is your turn to file a bug report again ... >>> >>> don't think its a bug. This is eshell not handling redirection correclty >>> and is something that cannot be easily fixed. Bottom line, don't use >>> redirection in eshell. >> >> FWIW, I don't see anything wrong with the above: just unwrap the >> obviously wrapped lines, and you will see that everything is >> honky-dory. > > But it's different from how bash + ls behave in a "normal" terminal. > When stdout for the `ls' command is not a tty it prints one file per > line (IMHO the right way). > > David Well, I just dug out coreutils' sources. In ls.c, line 1423 in the function decode_switches, the magic reveals itself: [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: Type: text/x-c++src, Size: 688 bytes --] switch (ls_mode) { case LS_MULTI_COL: /* This is for the `dir' program. */ format = many_per_line; set_quoting_style (NULL, escape_quoting_style); break; case LS_LONG_FORMAT: /* This is for the `vdir' program. */ format = long_format; set_quoting_style (NULL, escape_quoting_style); break; case LS_LS: /* This is for the `ls' program. */ if (isatty (STDOUT_FILENO)) { format = many_per_line; /* See description of qmark_funny_chars, above. */ qmark_funny_chars = true; } else { format = one_per_line; qmark_funny_chars = false; } break; default: abort (); } [-- Attachment #1.3: Type: text/plain, Size: 170 bytes --] (If my gnus-foo worked, otherwise I'll post the snippet in a sec) Presumably, isatty(STDOUT_FILENO) is returning true for some reason when called under eshell? Rupert [-- Attachment #2: Type: application/pgp-signature, Size: 314 bytes --] ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-11 13:30 ` Xah 2008-08-11 15:24 ` Lennart Borgman (gmail) [not found] ` <mailman.16375.1218468298.18990.help-gnu-emacs@gnu.org> @ 2008-08-11 19:18 ` Eli Zaretskii 2008-08-12 8:02 ` Tim X 3 siblings, 0 replies; 27+ messages in thread From: Eli Zaretskii @ 2008-08-11 19:18 UTC (permalink / raw) To: help-gnu-emacs > From: Xah <xahlee@gmail.com> > Date: Mon, 11 Aug 2008 06:30:02 -0700 (PDT) > > Run eshell if you are in Windows and don't have cygwin installed and > want to run unix commands such as ls, cd, mkdir, etc. Actually, Cygwin is not the only Unixy shell in town, and ls does not need a Unixy shell to be run on Windows, to say nothing of cd and mkdir. So to be useful _and_ correct, this should be rephrased as Rin Eshell if you are on Windows and don't have a Unixy shell (sh.exe) installed. Of course, Eshell is much more than just a Unixy shell emulation, so even the above is misleading... ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-11 13:30 ` Xah ` (2 preceding siblings ...) 2008-08-11 19:18 ` Eli Zaretskii @ 2008-08-12 8:02 ` Tim X 3 siblings, 0 replies; 27+ messages in thread From: Tim X @ 2008-08-12 8:02 UTC (permalink / raw) To: help-gnu-emacs Xah <xahlee@gmail.com> writes: > On Aug 11, 4:38 am, Jonathan Groll <li...@groll.co.za> wrote: >> I know of only three ways to get an emacs shell: >> >> M-x terminal-emulator >> M-x shell >> M-x eshell >> (There is also M-x shell-command RET) >> >> Question is, which one is best for coding? Lately I've found myself >> opening up an xterm session to do miscellaneous coding support tasks - >> and am mostly struggling with different readline history keybindings >> (eg. I'm used to entering C-r at a shell to get (reverse-i-search) - >> obviously in an emacs shell this will have a dfferent outcome to what >> I desire! >> It depends on what you want to do. If I'm writing shell scripts, I will open an emacs buffer to put the script in and then run the script in whichever other shell is most appropriate (depending on things such as whether I plan to use redirection (don't use eshell), run with little interaction (probably just use run-shell) or if I require ansi, ncurses or other screen/terminal support, M-x term. >> Any recommendations? > > They really all have different purposs. > > > • M-x shell-command > lets you run a single shell cammand. > > • M-x shell > command line interface to OS. > > • M-x terminal-emulator > > This is actually a terminal emulator. > For example, you can start a telnet or ssh or top in it. > You can also start a vi, or even emacs itself within. > > You cannot run these problems with M-x shell, for example. > > • M-x eshell > This is just like shell, except it's written in elisp. > The purpose is so that you can have access to the familiar unix shell > in different OSes such as MS Windows. > > In general, the shell-command and shell is most useful. Run eshell if > you are in Windows and don't have cygwin installed and want to run > unix commands such as ls, cd, mkdir, etc. If you need to run telnet, > ssh, top, or any program that fills a screen, you'll need to run term. > I don't particular recommend it because once in term, many default > keybindings of emacs won't work because it pretends to be a term emu. > If you want to run ssh etc, best to start in a real term emulator. M-x term does re-define some key sequences so that they don't conflict with, in particular, shell control sequences such as Ctrl C. However, yu also have line mode and character mode, which enables you to switch from keyboard input being sent as characters to the command line to being able to move around in the buffer and do things like cut and paste etc, which you can then use in another buffer. Eshell can cause confusion because it cannot handle redirection correctly. This can give some unexpected results and you don't necessarily get any eror message warning you. I once ran a simple shell script that grabbed some xml using wget and then displayed it on the screen. When I ran it under eshell, I thought the service I was trying to access was not working because nothing was being displayed to the screen. I then realised that the data was being returned, but eshell wasn't handling the redirection to stdout correctly. However, if you keep this in mind, eshell is very useful and you can execute emacs lisp directly from the command line, plus all the key-bindings are as you wold expect them to be. Note also that with reference to running programs like telnet, rlogin ssh and top, there are facilities available to do this from within emacs. Emacs has M-x telnet, M-x rlogin and there are at least two ssh.el packages out there. You can also set the rlogin-program variable to use ssh rather than rlogini. For top, their is view-process.el (quite old) and in the CVS version of emacs proced, which is like a top for emacs. and of course, there is tramp, which can allow you to edit files and run remote processes from inside emacs. to provide more specific help on what would be most useful, we would need more details regarding what it is you want to do and what platform your running on. HTH Tim -- tcross (at) rapttech dot com dot au ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding [not found] <mailman.16366.1218454746.18990.help-gnu-emacs@gnu.org> 2008-08-11 13:30 ` Xah @ 2008-08-11 13:40 ` Mike Treseler 2008-08-11 16:44 ` weber 1 sibling, 1 reply; 27+ messages in thread From: Mike Treseler @ 2008-08-11 13:40 UTC (permalink / raw) To: help-gnu-emacs Jonathan Groll wrote: > I know of only three ways to get an emacs shell: > M-x terminal-emulator > M-x shell > M-x eshell > (There is also M-x shell-command RET) ... > Any recommendations? > > Many thanks, > Jonathan Groll. > I use M-x shell for vhdl simulation/debug sessions. I like having both unix history *and* emacs search/editing of the old commands. Sometimes I use a little xterm on the side. -- Mike Treseler ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-11 13:40 ` Mike Treseler @ 2008-08-11 16:44 ` weber 2008-08-12 6:33 ` Mike Treseler 0 siblings, 1 reply; 27+ messages in thread From: weber @ 2008-08-11 16:44 UTC (permalink / raw) To: help-gnu-emacs On Aug 11, 10:40 am, Mike Treseler <mtrese...@gmail.com> wrote: > Jonathan Groll wrote: > > I know of only three ways to get an emacs shell: > > M-x terminal-emulator > > M-x shell > > M-x eshell > > (There is also M-x shell-command RET) > ... > > Any recommendations? > > > Many thanks, > > Jonathan Groll. > > I use M-x shell for vhdl simulation/debug sessions. > I like having both unix history > *and* emacs search/editing of the old commands. > Sometimes I use a little xterm on the side. > > -- Mike Treseler Do you have any personal functions for working with vhdl and/or vhdl simulation/synthesis tools? Curiosly, weber ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: Optimal emacs shell for coding 2008-08-11 16:44 ` weber @ 2008-08-12 6:33 ` Mike Treseler 0 siblings, 0 replies; 27+ messages in thread From: Mike Treseler @ 2008-08-12 6:33 UTC (permalink / raw) To: help-gnu-emacs weber wrote: > Do you have any personal functions for working with vhdl and/or vhdl > simulation/synthesis tools? vhdl-mode covers design entry and simulation make very well. I copy/paste vsim commands from my code comments to M-x shell. My special sauce for synthesis is here: http://mysite.verizon.net/miketreseler/ I may make vhdl-mode templates someday. -- Mike Treseler ^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2008-08-13 11:21 UTC | newest] Thread overview: 27+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-08-11 11:38 Optimal emacs shell for coding Jonathan Groll 2008-08-11 12:05 ` Peter Dyballa 2008-08-11 15:06 ` Thien-Thi Nguyen [not found] <mailman.16366.1218454746.18990.help-gnu-emacs@gnu.org> 2008-08-11 13:30 ` Xah 2008-08-11 15:24 ` Lennart Borgman (gmail) [not found] ` <mailman.16375.1218468298.18990.help-gnu-emacs@gnu.org> 2008-08-11 15:49 ` Xah 2008-08-11 16:47 ` Lennart Borgman (gmail) [not found] ` <mailman.16385.1218473260.18990.help-gnu-emacs@gnu.org> 2008-08-12 8:06 ` Tim X 2008-08-12 12:06 ` Lennart Borgman (gmail) 2008-08-12 18:33 ` Eli Zaretskii 2008-08-12 18:40 ` Lennart Borgman (gmail) 2008-08-12 18:52 ` Eli Zaretskii 2008-08-12 19:02 ` Lennart Borgman (gmail) 2008-08-12 19:11 ` ken 2008-08-12 19:28 ` Lennart Borgman (gmail) 2008-08-12 19:16 ` Eli Zaretskii [not found] ` <mailman.16490.1218568567.18990.help-gnu-emacs@gnu.org> 2008-08-13 1:01 ` Chris F.A. Johnson 2008-08-13 8:20 ` Tim X 2008-08-13 11:21 ` Thierry Volpiatto 2008-08-12 18:30 ` Eli Zaretskii 2008-08-12 19:14 ` David Hansen [not found] ` <mailman.16492.1218569015.18990.help-gnu-emacs@gnu.org> 2008-08-12 20:08 ` Rupert Swarbrick 2008-08-11 19:18 ` Eli Zaretskii 2008-08-12 8:02 ` Tim X 2008-08-11 13:40 ` Mike Treseler 2008-08-11 16:44 ` weber 2008-08-12 6:33 ` Mike Treseler
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).