[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Esc-d deletes too much in a shell script
From: |
Peter Dyballa |
Subject: |
Esc-d deletes too much in a shell script |
Date: |
Sun, 16 Apr 2006 21:54:34 +0200 |
Hello!
In a (Bourne) shell script I was editing the "envelope" of a set of
echo statements because it was too long (copied from another file),
so I pressed Esc-d at the point where the superfluity began -- and
too much was deleted!
Before it was:
1 #!/bin/sh
2 #
3 # @(#) tcshrc-script.sh 1.0 -*- coding: iso-8859-15; -*-
4 # Time-stamp: <2006-04-16 21:18:52 pete>
5 #
6
########################################################################
#####
7 #
8 # Purpose: provide DISPLAY variable to MacTeX commands for (t)
csh in Terminal
9 #
10 #
11 # Theory of operation
12 #
13 # In order to prepare a running tcsh in Terminal with a
*PRELIMINARY* value for
14 # DISPLAY these lines are added to .login.
15 # Too, a shell alias, updisp, is added that can be executed in
Terminal in case
16 # the DISPLAY value after launching X11 is different from the
preliminary one,
17 # so that it is updated and corrected.
18 #
19
########################################################################
#####
20 #
21 echo "^^^^^^^^^ $0 ^^^^^^^^^"
22 Datum=`date "+%+"`
23 Fund=0
24 if [ -e .login ]; then # has .login already the alias
updisp defined?
25 Fund=`grep -w updisp .login | grep -w alias | tr -d ' ' |
grep -v '^#' | wc -l`
26 if [ $Fund -gt 0 ]; then
27 mv .login ".login-${Datum}" # then save .login
28 cp ".login-${Datum}" .login # prepare a copy of
original .login
29 fi
30 fi
31 if [ $Fund -eq 0 ]; then
32 cat <<-' EOF' | sed -e "s/%%Datum%%/$Datum/" >> .login
33 #
34 # This change was added on %%Datum%%
35 #
36 if (! $?DISPLAY) then
37 set PID=`ps -lwx | egrep -w 'X11|XDarwin' | grep -v grep
| awk '{print $2}' | head -1`
38 if ($?PID) then
39 setenv DISPLAY `ps -wwwe -p $PID | grep DISPLAY | sed
-e 's/^.*DISPLAY=\([^ ]*\) .*$/\1/'`
40 else
41 Anzahl=`top -FRl 1 | grep Finder | wc -l` # OR
loginwindo OR ATSServer OR SystemUIServer OR Dock ...
42 @ Anzahl --
43 setenv DISPLAY :${Anzahl}
44 fi
45 fi
46 alias updisp 'setenv DISPLAY `defaults read "${HOME}/.MacOSX/
environment" DISPLAY`'
47 #
48 # End of change from %%Datum%%
49 EOF
50 else
51 echo "############################################"
52 echo "Your .login might already contain all things"
53 echo "needed to make MacTeX work in X11 ..."
54 echo "But you better check this!"
55 echo "################################################"
56 fi
57 #
58 echo "\$\$\$\$\$\$\$\$\$ $0 \$\$\$\$\$\$\$\$\$"
Another such case happens at line #21 in the above example. When the
cursor is for example in column #24 of this line and I press Esc-d,
again too much is deleted. Here is the state after:
########################################################################
#####
#
echo "^^^^^^^^^ $0 ^^^^^=`date "+%+"`
Fund=0
if [ -e .login ]; then # has .login already the alias updisp
defined?
Outside of "words" of `^´ or `#´ Esc-d deletes correctly till the end
of the word, i.e. up to but not including the `"´. GNU Emacs was
launched with -Q when it fails to delete-word in lines #21, 51, 55,
and 58 of the above example.
In GNU Emacs 22.0.50.1 (powerpc-apple-darwin8.5.0, X toolkit, Xaw3d
scroll bars)
of 2006-04-13 on localhost
X server distributor `The XFree86 Project, Inc', version 11.0.40400000
configured using `configure '--without-sound' '--without-pop' '--with-
xpm' '--with-jpeg' '--with-tiff' '--with-gif' '--with-png' '--enable-
locallisppath=/Library/Application Support/Emacs/calendar22:/Library/
Application Support/Emacs/preview:/Library/Application Support/Emacs/
auctex/images:/Library/Application Support/Emacs/auctex:/Library/
Application Support/Emacs' 'CFLAGS=-ggdb -O2 -pipe -faltivec -
maltivec -mabi=altivec -mcpu=7450 -no-cpp-precomp -fomit-frame-
pointer -foptimize-register-move -fcprop-registers -frename-registers
-freorder-blocks -fpeephole -mpowerpc-gfxopt -mpowerpc-gpopt -
DUSE_ATSUI' 'CPPFLAGS=-I/usr/local/include -I/sw/include/libpng12 -I/
sw/lib/pango-ft219/include -I/sw/include/pango-1.0 -I/sw/lib/
freetype219/include -I/sw/include' 'LDFLAGS=-dead_strip -L/usr/X11R6/
lib -L/usr/local/lib -L/sw/lib/ncurses -L/sw/lib/freetype219/lib -L/
sw/lib/pango-ft219/lib -L/sw/lib''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: de_DE.UTF-8
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: de_DE.UTF-8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
Major mode: Shell-script
Minor modes in effect:
display-time-mode: t
show-paren-mode: t
tooltip-mode: t
auto-compression-mode: t
tool-bar-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
line-number-mode: t
transient-mark-mode: t
--
Greetings
Pete
These are my principles and if you don't like them... well, I have
others. - Groucho Marx
- Esc-d deletes too much in a shell script,
Peter Dyballa <=
- Re: Esc-d deletes too much in a shell script, Eli Zaretskii, 2006/04/17
- Re: Esc-d deletes too much in a shell script, Peter Dyballa, 2006/04/17
- Re: Esc-d deletes too much in a shell script, Eli Zaretskii, 2006/04/17
- Re: Esc-d deletes too much in a shell script, Stefan Monnier, 2006/04/17
- Re: Esc-d deletes too much in a shell script, Peter Dyballa, 2006/04/17
- Re: Esc-d deletes too much in a shell script, Stefan Monnier, 2006/04/17
- Re: Esc-d deletes too much in a shell script, Peter Dyballa, 2006/04/17
- Re: Esc-d deletes too much in a shell script, Stefan Monnier, 2006/04/17
- Re: Esc-d deletes too much in a shell script, Peter Dyballa, 2006/04/17
Re: Esc-d deletes too much in a shell script, Richard Stallman, 2006/04/17