[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "more", "ls -l", and column 80 in shell
From: |
Tim X |
Subject: |
Re: "more", "ls -l", and column 80 in shell |
Date: |
Sat, 17 Jun 2006 16:58:54 +1000 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
"RjjdBae" <rjjd@tds.net> writes:
> I use "more" in the shell window because I use the shell window, and I
> want to pause output conveniently.
>
> The first time I heard of eshell and term is today! I tried each:
> eshell exits when I execute a script that contains an "exit". term
> doesn't pass ^H to emacs. And eshell didn't get my .cshrc right; some
> commands didn't work, e.g. "set".
>
> The only problems I have with shell is this column 80 thing,
> current-directory's getting lost, and having to execute "dirs" upon
> changing directory from within a script.
>
> So, any thoughts on how I can tell whatever generates the <RET> not to
> be afraid to put one in column 80?
>
It is a bit difficult to provide accurate advice here as it isn't
clear exactly what you are trying to do. From what you have outlined,
I also suspect you really need to read the emacs manual and use the
various C-h options to know what the features and limitations are of
the various emacs interfaces tot he underlying OS.
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
various ways of doing interaction at this level, you are much
better off using equivalent emacs features when possible i.e.
dired, M-x locate, M-x grep, M-x cd etc.
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
or you need to use an escape sequence within the shell buffer to
access emacs commands. Also, note that some shell interfaces, like
M-x term have different operating modes - a line mode and a
terminal mode.
3. M-x shell is a *very* basic shell interface along the lines of a
dumb terminal. It is designed for doing very simple quick shell
level operations. It will not work reliably (if at all) with any
script or program which relies on the characteristics of more
intelligent shells that use terminfo/termcap etc.
4. M-x term is a more sophisticated shell interface that is able to
handle terminal IO a bit more intelligently. It supports both line
and character type interaction and can be used to run things like
top.
5. M-x eshell is a shell written in emacs lisp. It has significant
limitations over shells like bash, but has the advantage of a
direct interface into the emacs interpreter. You can easily extend
eshell with simple elisp functions and have direct access to elisp
functions from the eshell command line.
>From your description, I don't really understand what the issue is you
are trying to resolve. I develop quite a lot of scripts under emacs
and don't seem to have the issues you have, but I operate in a
completely different way, so I probably don't trip over the same
limitations you do.
For example, your description of losing directories when changing
directories within a script has me a bit confused. A script executes
in its own shell - it does inherit various settings and values from
the parent, but when the script completes execution, the subshell it
was executing within will also exit and any variables modified during
the script execution will be lost unless you have used the shells
"export" function and even then, the values may not persist as
exported shell values usually only affect sub-shells and not parent
shells.
I suspect you may need to re-examine some of your assumptions as well
and verify them correct. It is extremely easy to see a
behavior/problem and convince yourself it is due to one thing when in
fact it is something else. For example, I've not noticed a problem
with executing scripts under eshell that wold cause eshell to exit
just because the sub-shell executing the script exits. However, I have
seen parent shells exit when a sub-shell process exits with a failure
because the shell (talking bash here) has set -e in its configuration.
I also suspect your conclusion that the problems are due to the script
not being able to execute a newline at column 80 is incorrect. There
is a very slim chance that maybe in your configuration emacs fill mode
may be causing some unexpected behavior, but I strongly doubt it. I
often execute scripts which have lines longer than 80 characters
without any problems at all. However, please note that as we are
talking about emacs, the worlds most configurable and customisable
kitchen sink, its impossible to be certain.
I'd suggest going back to basics and possibly providing more specific
details of what you are attempting to do and the behavior you are
observing. Either someone will recognise the problem and know the
solution or know of a different way of approaching the task which
avoids the problem altogether.
HTH
Tim
--
tcross (at) rapttech dot com dot au
- "more", "ls -l", and column 80 in shell, RjjdBae, 2006/06/15
- Re: "more", "ls -l", and column 80 in shell, Barry Margolin, 2006/06/15
- Re: "more", "ls -l", and column 80 in shell, RjjdBae, 2006/06/16
- Re: "more", "ls -l", and column 80 in shell,
Tim X <=
- Re: "more", "ls -l", and column 80 in shell, David Combs, 2006/06/24
- Re: "more", "ls -l", and column 80 in shell, Tim X, 2006/06/24
- Re: "more", "ls -l", and column 80 in shell, Peter Dyballa, 2006/06/25
- Re: "more", "ls -l", and column 80 in shell, Peter Dyballa, 2006/06/17
- Message not available
- Re: "more", "ls -l", and column 80 in shell, David Combs, 2006/06/24
- Re: "more", "ls -l", and column 80 in shell, Peter Dyballa, 2006/06/25
- Message not available
- Re: "more", "ls -l", and column 80 in shell, Tim X, 2006/06/25
- Re: "more", "ls -l", and column 80 in shell, Peter Dyballa, 2006/06/25
- Message not available
- Re: "more", "ls -l", and column 80 in shell, Miles Bader, 2006/06/25
- Re: "more", "ls -l", and column 80 in shell, Peter Dyballa, 2006/06/25