annotate etc/emacs.bash @ 95719:2d181ef95a03

Fix typo.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 09 Jun 2008 15:25:27 +0000
parents cbf5528cf447
children 4f618405b3d2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
75457
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
1 ### emacs.bash --- contact/resume an existing Emacs, or start a new one
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
2
79776
1dd7437446ea Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78271
diff changeset
3 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
75457
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
4 ## Free Software Foundation, Inc.
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
5
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
6 ## Author: Noah Friedman
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
7
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
8 ## This file is part of GNU Emacs.
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
9
95004
cbf5528cf447 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
10 ## GNU Emacs is free software: you can redistribute it and/or modify
75457
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
11 ## it under the terms of the GNU General Public License as published by
95004
cbf5528cf447 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
cbf5528cf447 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
13 ## (at your option) any later version.
75457
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
14
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
15 ## GNU Emacs is distributed in the hope that it will be useful,
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
18 ## GNU General Public License for more details.
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
19
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
20 ## You should have received a copy of the GNU General Public License
95004
cbf5528cf447 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
21 ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
75457
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
22
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
23 ### Commentary:
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
24
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
25 ## This defines a bash command named `edit' which contacts/resumes an
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
26 ## existing emacs or starts a new one if none exists.
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
27
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
28 ## One way or another, any arguments are passed to emacs to specify files
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
29 ## (provided you have loaded `resume.el').
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
30
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
31 ## This function assumes the emacs program is named `emacs' and is somewhere
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
32 ## in your load path. If either of these is not true, the most portable
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
33 ## (and convenient) thing to do is to make an alias called emacs which
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
34 ## refers to the real program, e.g.
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
35 ##
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
36 ## alias emacs=/usr/local/bin/gemacs
25853
Dave Love <fx@gnu.org>
parents:
diff changeset
37
Dave Love <fx@gnu.org>
parents:
diff changeset
38 function edit ()
Dave Love <fx@gnu.org>
parents:
diff changeset
39 {
Dave Love <fx@gnu.org>
parents:
diff changeset
40 local windowsys="${WINDOW_PARENT+sun}"
Dave Love <fx@gnu.org>
parents:
diff changeset
41
Dave Love <fx@gnu.org>
parents:
diff changeset
42 windowsys="${windowsys:-${DISPLAY+x}}"
Dave Love <fx@gnu.org>
parents:
diff changeset
43
Dave Love <fx@gnu.org>
parents:
diff changeset
44 if [ -n "${windowsys:+set}" ]; then
Dave Love <fx@gnu.org>
parents:
diff changeset
45 # Do not just test if these files are sockets. On some systems
Dave Love <fx@gnu.org>
parents:
diff changeset
46 # ordinary files or fifos are used instead. Just see if they exist.
59923
615a90f44f52 Update the name of the socket of the Emacs server.
Eli Zaretskii <eliz@gnu.org>
parents: 52401
diff changeset
47 if [ -e "${HOME}/.emacs_server" -o -e "/tmp/emacs${UID}/server" ]; then
25853
Dave Love <fx@gnu.org>
parents:
diff changeset
48 emacsclient "$@"
Dave Love <fx@gnu.org>
parents:
diff changeset
49 return $?
Dave Love <fx@gnu.org>
parents:
diff changeset
50 else
Dave Love <fx@gnu.org>
parents:
diff changeset
51 echo "edit: starting emacs in background..." 1>&2
Dave Love <fx@gnu.org>
parents:
diff changeset
52 fi
Dave Love <fx@gnu.org>
parents:
diff changeset
53
Dave Love <fx@gnu.org>
parents:
diff changeset
54 case "${windowsys}" in
Dave Love <fx@gnu.org>
parents:
diff changeset
55 x ) (emacs "$@" &) ;;
84724
ccaac0911639 Adapt for removal of emacstool.
Glenn Morris <rgm@gnu.org>
parents: 78271
diff changeset
56 sun ) echo "unsupported window system"; return 1 ;;
25853
Dave Love <fx@gnu.org>
parents:
diff changeset
57 esac
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 25853
diff changeset
58 else
25853
Dave Love <fx@gnu.org>
parents:
diff changeset
59 if jobs %emacs 2> /dev/null ; then
Dave Love <fx@gnu.org>
parents:
diff changeset
60 echo "$(pwd)" "$@" >| ${HOME}/.emacs_args && fg %emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
61 else
Dave Love <fx@gnu.org>
parents:
diff changeset
62 emacs "$@"
Dave Love <fx@gnu.org>
parents:
diff changeset
63 fi
Dave Love <fx@gnu.org>
parents:
diff changeset
64 fi
Dave Love <fx@gnu.org>
parents:
diff changeset
65 }
Dave Love <fx@gnu.org>
parents:
diff changeset
66
Dave Love <fx@gnu.org>
parents:
diff changeset
67
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
68 # arch-tag: 1e1b74b9-bf2c-4b23-870f-9eebff7515cb
75457
873c558e1383 Add FSF copyright and GPL. Copyright years from those where this file
Glenn Morris <rgm@gnu.org>
parents: 59923
diff changeset
69 ### emacs.bash ends here