unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim X <timx@nospam.dev.null>
Subject: Re: "more", "ls -l", and column 80 in shell
Date: Sun, 25 Jun 2006 12:39:53 +1000	[thread overview]
Message-ID: <87zmg27ybq.fsf@tiger.rapttech.com.au> (raw)
In-Reply-To: e7kl44$t8p$1@reader2.panix.com

dkcombs@panix.com (David Combs) writes:

> In article <87slm4p8sx.fsf@tiger.rapttech.com.au>,
> Tim X  <timx@nospam.dev.null> wrote:
>>...
>
>>Some basic rules of thumb and advice which I hope will help
>>
>>1. Don't try to use emacs as if it was equivalent to one of the
>>   standard shells like bash, tcsh or (gasp) csh. While emacs provides
>
> M-x shell
>    (then, in *shell*):
> tcsh
>
> Works *absolutely* fine -- ie the same as in a dtterm (no emacs).
>
No, its not the same as in a term because it is initialised as a dumb
terminal - i.e. it does not have any concept of a "screen" (rows,
columns). This was the OPs initial problem and why programs like less
don't operate correctly. Also, on most Linux systems, the shell used
will be bash, which has most of the features of tcsh these days, so
little will be gained IMO by running a second shell inside the
original one.



> (of course, no "more", etc, but grep, find, etc all work
>       exactly as expected.  Likewise pushd, popd, dirs, etc.
>     (Although from time to time it gets confused, at which
>       point you simply do  M-x dirs )

This is no different to just M-x shell unless your default shell is a
very old or basic sh or similar. Even then, these commands should
still work fine.

If the shell constantly loses track of directory locations etc, it
might be worth looking at the various variables which are used to
match the commands and which the inferior shell process uses to keep
track of the directory. i.e.

Variables `shell-cd-regexp', `shell-chdrive-regexp', `shell-pushd-regexp'
and `shell-popd-regexp' are used to match their respective commands,
while `shell-pushd-tohome', `shell-pushd-dextract' and `shell-pushd-dunique'
control the behavior of the relevant command.


>>   various ways of doing interaction at this level, you are much
>>   better off using equivalent emacs features when possible i.e.
>>   dired, 
>       of course (plus with dired-x, too).
>
> M-x locate, M-x grep, M-x cd etc. 
> Huh?
>
Not sure what the Huh? refers to. 

> About M-x grep, I find it very useful to use normal
>    grep/egrep/etc, *with -n*, and on *at least 2 files*
>     (eg if just one to be grepped, then append /dev/null to
>       get to the 2-or-more-files -- so as to get file-names
>       at the left of the grep-output)
>    and then, if desired, hack that file to remove lines,
>      add marks to certain lines, etc,
>    and THEN do M-x grep, and change the offered args to
>     "`cat mygrep.out`"

I find using direds facilities makes this very easy.

>
>>
>>2. When using one of emacs' shell interfaces, keep in mind that it is
>>   often necessary to have some escape key sequence to either access
>>   shell commands that conflict with normal emacs interpreted commands
>
> I don't understand, so: Please expain, ie show examples where necessary.
>
>
>>   or you need to use an escape sequence within the shell buffer to
>                            HUH?  Explain?
>

Think about it for a second. Your in M-x shell and you want to
interrupt a process you have started in that shell. Normally, when in
a terminal, you could send a C-c, but within emacs M-x shell, emacs
will grab the first C-c, so you need to send it again. However, in M-x
term, the situation is reversed. You need to send a different prefix
(escape) to access emacs commands that are not part of term mode. 

>>   access emacs commands. Also, note that some shell interfaces, like
>>   M-x term have different operating modes - a line mode and a
>>   terminal mode.
>>
Actually, I should have said a line mode and a character mode.


What I was trying to point out tot he OP is that emacs has at least
three different shell interfaces and they all have their strengths and
weaknesses. Therefore, it is important to know what does what in order
to select the best shell for the job you want to do. For example, the
problem the OP was having with a screen oriented program indicated M-x
term would probably be a better choice than M-x shell, which is good
for simple line oriented programs than don't need the concept of a
screen. Likewise, M-x eshell offers other strengths, such as being
able to execute elisp from the command line and call emacs functions
to operate on the place/directory where you are etc.

Tim
-- 
tcross (at) rapttech dot com dot au

  reply	other threads:[~2006-06-25  2:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-15 22:44 "more", "ls -l", and column 80 in shell RjjdBae
2006-06-15 23:46 ` Barry Margolin
2006-06-16  6:48   ` Tim X
2006-06-16 14:42 ` RjjdBae
2006-06-17  6:58   ` Tim X
2006-06-25  0:24     ` David Combs
2006-06-25  2:39       ` Tim X [this message]
2006-06-25  8:45         ` Peter Dyballa
2006-06-17  8:18   ` Peter Dyballa
     [not found]   ` <mailman.2970.1150533187.9609.help-gnu-emacs@gnu.org>
2006-06-25  0:30     ` David Combs
2006-06-25  8:35       ` Peter Dyballa
     [not found]       ` <mailman.3300.1151224578.9609.help-gnu-emacs@gnu.org>
2006-06-25  9:42         ` Tim X
2006-06-25 15:30           ` Peter Dyballa
     [not found]           ` <mailman.3306.1151249429.9609.help-gnu-emacs@gnu.org>
2006-06-25 21:44             ` Miles Bader
2006-06-25 22:58               ` Peter Dyballa
     [not found]               ` <mailman.3321.1151276298.9609.help-gnu-emacs@gnu.org>
2006-06-26  0:37                 ` Miles Bader
2006-06-26  8:33                   ` Peter Dyballa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zmg27ybq.fsf@tiger.rapttech.com.au \
    --to=timx@nospam.dev.null \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).