]> code.delx.au - gnu-emacs/blob - etc/emacs.bash
Document that `completion-ignore-case' is nil on MS-Windows.
[gnu-emacs] / etc / emacs.bash
1 ### emacs.bash --- contact/resume an existing Emacs, or start a new one
2
3 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 ## Free Software Foundation, Inc.
5
6 ## Author: Noah Friedman
7
8 ## This file is part of GNU Emacs.
9
10 ## GNU Emacs is free software: you can redistribute it and/or modify
11 ## it under the terms of the GNU General Public License as published by
12 ## the Free Software Foundation, either version 3 of the License, or
13 ## (at your option) any later version.
14
15 ## GNU Emacs is distributed in the hope that it will be useful,
16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ## GNU General Public License for more details.
19
20 ## You should have received a copy of the GNU General Public License
21 ## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23 ### Commentary:
24
25 ## This defines a bash command named `edit' which contacts/resumes an
26 ## existing emacs or starts a new one if none exists.
27
28 ## One way or another, any arguments are passed to emacs to specify files
29 ## (provided you have loaded `resume.el').
30
31 ## This function assumes the emacs program is named `emacs' and is somewhere
32 ## in your load path. If either of these is not true, the most portable
33 ## (and convenient) thing to do is to make an alias called emacs which
34 ## refers to the real program, e.g.
35 ##
36 ## alias emacs=/usr/local/bin/gemacs
37
38 function edit ()
39 {
40 local windowsys="${WINDOW_PARENT+sun}"
41
42 windowsys="${windowsys:-${DISPLAY+x}}"
43
44 if [ -n "${windowsys:+set}" ]; then
45 # Do not just test if these files are sockets. On some systems
46 # ordinary files or fifos are used instead. Just see if they exist.
47 if [ -e "${HOME}/.emacs_server" -o -e "/tmp/emacs${UID}/server" ]; then
48 emacsclient "$@"
49 return $?
50 else
51 echo "edit: starting emacs in background..." 1>&2
52 fi
53
54 case "${windowsys}" in
55 x ) (emacs "$@" &) ;;
56 sun ) echo "unsupported window system"; return 1 ;;
57 esac
58 else
59 if jobs %emacs 2> /dev/null ; then
60 echo "$(pwd)" "$@" >| ${HOME}/.emacs_args && fg %emacs
61 else
62 emacs "$@"
63 fi
64 fi
65 }
66
67
68 # arch-tag: 1e1b74b9-bf2c-4b23-870f-9eebff7515cb
69 ### emacs.bash ends here