]> code.delx.au - gnu-emacs/commitdiff
Merged from miles@gnu.org--gnu-2005 (patch 469)
authorKaroly Lorentey <lorentey@elte.hu>
Tue, 5 Jul 2005 22:22:24 +0000 (22:22 +0000)
committerKaroly Lorentey <lorentey@elte.hu>
Tue, 5 Jul 2005 22:22:24 +0000 (22:22 +0000)
Patches applied:

 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-469
   Update from CVS

git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-372

92 files changed:
README.multi-tty [new file with mode: 0644]
admin/notes/BRANCH
etc/ONEWS
etc/TODO
info/COPYING [deleted file]
lib-src/emacsclient.c
lisp/bindings.el
lisp/cus-face.el
lisp/double.el
lisp/faces.el
lisp/files.el
lisp/font-lock.el
lisp/frame.el
lisp/help-fns.el
lisp/international/encoded-kb.el
lisp/international/iso-transl.el
lisp/international/mule-cmds.el
lisp/international/mule.el
lisp/ldefs-boot.el
lisp/loadup.el
lisp/obsolete/iso-acc.el
lisp/server.el
lisp/simple.el
lisp/startup.el
lisp/subr.el
lisp/talk.el
lisp/term/AT386.el
lisp/term/internal.el
lisp/term/iris-ansi.el
lisp/term/lk201.el
lisp/term/mac-win.el
lisp/term/news.el
lisp/term/rxvt.el
lisp/term/sun.el
lisp/term/tvi970.el
lisp/term/wyse50.el
lisp/term/x-win.el
lisp/term/xterm.el
lisp/version.el
lisp/x-dnd.el
lispref/elisp-covers.texi [deleted file]
mac/makefile.MPW
src/.arch-inventory
src/.gdbinit
src/Makefile.in
src/alloc.c
src/cm.c
src/cm.h
src/coding.c
src/coding.h
src/config.in
src/data.c
src/dispextern.h
src/dispnew.c
src/emacs.c
src/fileio.c
src/fontset.c
src/frame.c
src/frame.h
src/fringe.c
src/indent.c
src/intervals.h
src/keyboard.c
src/keyboard.h
src/keymap.c
src/lisp.h
src/lread.c
src/macterm.c
src/macterm.h
src/minibuf.c
src/msdos.c
src/process.c
src/puresize.h
src/scroll.c
src/sysdep.c
src/syssignal.h
src/term.c
src/termchar.h
src/termhooks.h
src/termopts.h
src/w32term.c
src/w32term.h
src/window.c
src/window.h
src/xdisp.c
src/xfaces.c
src/xfns.c
src/xmenu.c
src/xselect.c
src/xsmfns.c
src/xterm.c
src/xterm.h

diff --git a/README.multi-tty b/README.multi-tty
new file mode 100644 (file)
index 0000000..d722df7
--- /dev/null
@@ -0,0 +1,1114 @@
+                       -*- coding: utf-8; mode: text; -*-
+GOAL
+----
+
+This branch implements support for opening multiple, different tty
+devices and simultaneous X and tty frames from a single Emacs session.
+
+Some use cases:
+Emacs is notoriously slow at startup, so most people use another
+editor or emacsclient for quick editing jobs from the console.
+Unfortunately, emacsclient was very awkward to use, because it did not
+support opening a new Emacs frame on the current virtual console.
+Now, with multi-tty support, it can do that.  (Emacsclient starts up
+faster than vi!)
+
+Some Gnus users (including me) run Gnus in an X frame in its own Emacs
+instance, which they typically leave running for weeks.  It would be
+nice if they could connect to this instance from a remote ssh session
+and check their messages without opening a remote X frame or resorting
+to gnus-slave.
+
+WHO IS DOING IT
+---------------
+
+I'm Károly Lőrentey.  My address: lorentey@elte.hu.
+
+Comments, bug reports, suggestions and patches are welcome; send them
+to multi-tty@lists.fnord.hu.
+
+The following is a (sadly incomplete) list of people who have
+contributed to the project by testing, submitting patches, bug
+reports, and suggestions.  Thanks!
+
+ARISAWA Akihiro <ari at mbf dot ocn dot ne dot jp>
+Vincent Bernat <bernat at luffy dot cx>
+Han Boetes <han at mijncomputer dot nl>
+Robert J. Chassell <bob at rattlesnake dot com>
+Romain Francoise <romain at orebokech dot com>
+Ami Fischman <ami at fischman dot org>
+Friedrich Delgado Friedrichs <friedel at nomaden dot org>
+IRIE Tetsuya <irie at t dot email dot ne dot jp>
+Yoshiaki Kasahara <kasahara at nc dot kyushu-u dot ac dot jp>
+Jurej Kubelka <Juraj dot Kubelka at email dot cz>
+David Lichteblau <david at lichteblau dot com>
+Xavier Mallard <zedek at gnu-rox dot org>
+Istvan Marko <mi-mtty at kismala dot com>
+Ted Morse <morse at ciholas dot com>
+Dan Nicolaescu <dann at ics dot uci dot edu>
+Gergely Nagy <algernon at debian dot org>
+Mark Plaksin <happy at mcplaksin dot org>
+Francisco Borges <borges at let dot rug dot nl>
+Frank Ruell <stoerte at dreamwarrior dot net>
+Dan Waber <dwaber at logolalia dot com>
+and many others.
+
+Richard Stallman was kind enough to review an earlier version of my
+patches.
+
+
+MAILING LISTS
+-------------
+
+The multi-tty mailing list (discussion & bug reports):
+
+       Address:        multi-tty@lists.fnord.hu
+       Signup:         http://lists.fnord.hu/mailman/listinfo/multi-tty
+       Archive:        http://news.gmane.org/gmane.emacs.multi-tty/
+
+Commit notifications (read-only):
+
+        Address:       multi-tty-commits@lists.fnord.hu
+       Signup:         http://lists.fnord.hu/mailman/listinfo/multi-tty-commits
+
+
+STATUS
+------
+
+The branch is now very stable and almost full-featured.  All of the
+major problems have been fixed, only a few minor issues remain.  (It
+still needs to be ported to Windows/Mac/DOS, though.)  Both multiple
+tty device support and simultaneous X and tty frame support works
+fine.  Emacsclient has been extended to support opening new tty and X
+frames.  It has been changed open new Emacs frames by default.
+
+The multi-tty branch has been scheduled for inclusion in the next
+major release of Emacs (version 23).  I expect the merge into the
+development trunk to occur sometime during next year (2005), after the
+merge of the Unicode branch.
+
+Tested on GNU/Linux, Solaris 8, FreeBSD and OpenBSD.  Please let me
+know if you succeed or fail to use it on other platforms---I'll have a
+few tricky test cases for you.
+
+Known problems:
+
+        * GTK support.  If you compile your Emacs with the GTK
+          toolkit, some functionality of multi-tty will be lost.
+          Current releases of GTK have limitations and bugs that
+          prevent full-blown multi-display support in Emacs.  Use the
+          Lucid toolkit if you want to see a complete feature set.
+
+        * The single-kboard mode.
+
+         If your multi-tty Emacs session seems to be frozen, you
+         probably have a recursive editing session or a pending
+         minibuffer prompt (which is a kind of recursive editing) on
+         another display.  To unfreeze your session, switch to that
+         display and complete the recursive edit, for example by
+         pressing C-] (`abort-recursive-edit').
+
+         I am sorry to say that currently there is no way to break
+         out of this "single-kboard mode" from a frozen display.  If
+         you are unable to switch to the display that locks the
+         others (for example because it is on a remote computer),
+         then you can use emacsclient to break out of all recursive
+         editing sessions:
+
+               emacsclient -e '(top-level)'
+
+         Note that this (perhaps) unintuitive behaviour is by design.
+         Single-kboard mode is required because of an intrinsic Emacs
+         limitation that is very hard to eliminate.  (This limitation
+         is related to the single-threaded nature of Emacs.)
+
+         I plan to implement better user notification and support for
+         breaking out of single-kboard mode from locked displays.
+
+       * Mac, Windows and DOS support is broken, doesn't even
+         compile.  Multiple display support will probably not provide
+         new Emacs features on these systems, but the multi-tty
+         branch changed a few low-level interfaces, and the
+         system-dependent source files need to be adapted
+         accordingly.  The changes are mostly trivial, so almost
+         anyone can help, if only by compiling the branch and
+         reporting the compiler errors.  (It is not worth to do this
+         yet, though.)
+
+
+HOW TO GET THE BRANCH
+---------------------
+
+The branch uses GNU Arch (http://www.gnuarch.org) for version control.
+
+Retrieving the latest version of the branch:
+
+       tla register-archive -f http://lorentey.hu/arch/2004/
+       tla get lorentey@elte.hu--2004/emacs--multi-tty <directory>
+
+This incantation uses my private archive mirror that is hosted on a
+relatively low-bandwidth site; if you are outside Hungary, you will
+probably want to you use my secondary mirror: (Note that the -f option
+will overwrite the archive location if you have previously registered
+the Hungarian one.)
+
+       tla register-archive -f http://aszt.inf.elte.hu/~lorentey/mirror/arch/2004
+       tla get lorentey@elte.hu--2004/emacs--multi-tty <directory>
+
+       http://aszt.inf.elte.hu/~lorentey/mirror/arch/2004
+
+The Arch supermirror provides mirroring services for all public Arch
+repositories.  We have a mirror there, too, if you prefer.
+
+       tla register-archive -f http://mirrors.sourcecontrol.net/lorentey%40elte.hu--2004
+       tla get lorentey@elte.hu--2004/emacs--multi-tty <directory>
+
+My GPG key id is 0FB27A3F; it is available from
+hkp://wwwkeys.eu.pgp.net/, or from my homepage at
+http://lorentey.hu/rolam/gpg.html)
+
+Don't worry if the above checkout takes a few minutes to complete;
+once you have a source tree, updating it to the latest revision will
+be _much_ faster.  Use the following command for the update:
+
+       tla replay
+
+You can find more information about Arch on http://wiki.gnuarch.org/.
+It's a wonderful source control system, I highly recommend it.
+
+If you don't have tla, the branch has a homepage from which you can
+download conventional patches against Emacs CVS HEAD:
+
+       http://lorentey.hu/project/emacs.html
+
+DEBIAN PACKAGES
+---------------
+
+If you run Debian, or a distribution based on Debian, you are welcome
+to use our binary packages; put these lines in your /etc/apt/sources.list:
+
+       # Multi-tty Emacs
+       deb http://aszt.inf.elte.hu/~lorentey/mirror/apt ./
+       deb-src http://aszt.inf.elte.hu/~lorentey/mirror/apt ./
+
+Note that these packages are intended solely to provide an easy way to
+test the new multi-tty features.  They are not to be taken as Emacs
+releases, and it's a mistake to expect robust operation or any kind of
+timely support for them.  Do not install them, unless you'd like to
+have your editor crash on you.
+
+
+COMPILATION
+-----------
+
+The multi-tty branch is compiled the same way as Emacs itself:
+
+       make maintainer-clean  # (If you have compiled Emacs before)
+
+       ./configure <your favourite options>
+       make bootstrap
+       make install
+
+If you have strange compilation errors, they may be caused by old
+*.elc files that are left over from an earlier bootstrap.  The `make
+maintainer-clean' target deletes them, so it is a good idea to run
+that before reporting a bug.  (Emacs requires a clean recompilation
+after certain kinds of source code changes.)
+
+TESTING
+-------
+
+To test the multi-tty branch, start up the Emacs server with the
+following commands:
+
+       emacs
+       M-x server-start
+
+and then (from a shell prompt on another terminal) start emacsclient
+with
+       emacsclient -t /optional/file/names...   (for a tty frame)
+       emacsclient /optional/file/names...      (for an X frame)
+
+(Make sure both emacs and emacsclient are multi-tty versions.)
+You'll hopefully have two fully working, independent frames on
+separate terminals. The new frame is closed automatically when you
+finish editing the specified files (C-x #), but delete-frame (C-x 5 0)
+also works.  Of course, you can create frames on more than two tty
+devices.
+
+Creating new frames on the same tty with C-x 5 2 works, and they
+behave the same way as in previous Emacs versions.  If you exit emacs,
+all terminals should be restored to their previous states.
+
+This is work in progress, and probably full of bugs.  It is a good
+idea to run emacs from gdb, so that you'll have a live instance to
+debug if something goes wrong.  Please send me your bug reports on our
+mailing list: multi-tty@lists.fnord.hu
+
+TIPS & TRICKS
+-------------
+
+I think the best way to use the new Emacs is to have it running inside
+a disconnected GNU screen session, and always use emacsclient for
+normal work.  One advantage of this is that not a single keystroke of
+your work will be lost if the display device that you are using
+crashes, or the network connection times out, or whatever.  (I had an
+extremely unstable X server for some time while I was developing these
+patches, and running Emacs this way has saved me a number of M-x
+recover-session invocations.)
+
+I use the following two bash scripts to handle my Emacs sessions:
+
+-------------------------------------------------------connect-emacs--
+#!/bin/bash
+# Usage: connect-emacs <name> <args>...
+#
+# Connects to the Emacs instance called NAME.  Starts up the instance
+# if it is not already running.  The rest of the arguments are passed
+# to emacsclient.
+
+name="$1"
+shift
+    
+if [ -z "$name" ]; then
+    echo "Usage: connect_emacs <name> <args>..." >&2
+    exit 1
+fi
+preload-emacs "$name" wait
+/usr/bin/emacsclient.emacs-multi-tty -s "$name" "$@"
+----------------------------------------------------------------------
+
+-------------------------------------------------------preload-emacs--
+#!/bin/bash
+# Usage: preload-emacs <name> [<waitp>]
+#
+# Preloads the Emacs instance called NAME in a detached screen
+# session.  Does nothing if the instance is already running.  If WAITP
+# is non-empty, the function waits until the server starts up and
+# creates its socket; otherwise it returns immediately.
+
+name="$1"
+waitp="$2"
+screendir="/var/run/screen/S-$USER"
+serverdir="/tmp/emacs$UID"
+emacs=/usr/bin/emacs-multi-tty # Or wherever you installed your multi-tty Emacs
+
+if [ -z "$name" ]; then 
+    echo "Usage: preload_emacs <name> [<waitp>]" >&2
+    exit 1
+fi
+
+if [ ! -e "$screendir"/*."$name" ]; then
+    if [ -e "$serverdir/$name" ]; then
+       # Delete leftover socket (for the wait option)
+       rm "$serverdir/$name"
+    fi
+    screen -dmS "$name" "$emacs" -nw --eval "(setq server-name \"$name\")" -f server-start
+fi
+if [ ! -z "$waitp" ]; then
+    while [ ! -e "$serverdir/$name" ]; do sleep 0.1; done
+fi
+----------------------------------------------------------------------
+
+I have the following in my profile to have two instances automatically
+preloaded for editing and email:
+
+       preload-emacs editor
+       preload-emacs gnus
+
+It is useful to set up short aliases for connect-emacs.  I use the
+following:
+
+       alias edit="connect-emacs editor"
+       alias e=edit
+       alias et="connect-emacs editor -t"
+       alias gnus="connect-emacs gnus"
+
+
+CHANGELOG
+---------
+
+See arch logs.
+
+
+NEWS
+----
+
+For the NEWS file:  (Needs much, much work)
+
+** Support for multiple terminal devices has been added.
+
+*** You can specify a terminal device (`tty' parameter) and a terminal
+    type (`tty-type' parameter) to `make-terminal-frame'.
+
+*** You can test for the presence of multiple terminal support by
+    testing for the `multi-tty' feature.
+
+*** Emacsclient has been extended to support opening a new terminal
+    frame. Its behaviour has been changed to open a new Emacs frame by
+    default.  Use the -c option to get the old behavior of opening
+    files in the currently selected Emacs frame.
+
+*** A make-frame-on-tty function has been added to make it easier to
+    create frames on new terminals.
+
+*** New functions: frame-tty-name, frame-tty-type, delete-tty,
+    terminal-local-value, set-terminal-local-value
+
+*** New variables: global-key-translation-map
+
+*** The keymaps key-translation-map and function-key-map are now
+    terminal-local.
+
+** Support for simultaneous graphical and terminal frames has been
+   added.
+
+*** The function `make-frame-on-display' now works during a terminal
+    session, and `make-frame-on-tty' works during a graphical session.
+
+*** The `window-system' variable has been made frame-local.
+
+*** The new `initial-window-system' variable contains the
+    `window-system' value for the first frame.
+
+*** talk.el has been extended for multiple tty support.
+
+
+* * *
+
+(The rest of this file consists of my development notes and as such it
+is probably not very interesting for anyone else.)
+
+THINGS TO DO
+------------
+
+** Having {reset,init}_all_sys_modes in set-input-mode breaks arrow
+   keys on non-selected terminals under screen, and sometimes on other
+   terminal types as well.  The other function keys continue to work
+   fine.  Sometimes faces on these screens become garbled.
+
+   This only seems to affect displays that are of the same terminfo
+   type as the selected one. Interestingly, in screen Emacs normally
+   reports the up arrow key as `M-o A', but after the above SNAFU, it
+   complains about `M-[ a'.  UNIX ttys are a complete mystery to me,
+   but it seems the reset-reinitialize cycle somehow leaves the
+   non-selected terminals in a different state than usual.  I have no
+   idea how this could happen.
+
+   Currently set-input-mode resets only the currently selected
+   terminal, which seems to somehow work around the problem.
+
+** Fix set-input-mode for multi-tty.  It's a truly horrible interface;
+   what if we'd blow it up into several separate functions (with a
+   compatibility definition)?
+
+** BULK RENAME: The `display-' prefix of new Lisp-level functions
+   conflicts with stuff like `display-time-mode'.  Use `device-'
+   or `terminal-' instead.  I think I prefer `terminal-'.
+
+** The semantics of terminal-local variables are confusing; it is not
+   clear what binding is in effect in any given time.  See if
+   current_kboard (or at least the terminal-local bindings exported to
+   Lisp) might be changed to be tied to the selected frame instead.
+   Currently, `function-key-map' and `key-translation-map' may be
+   accessed reliably only using the hackish
+   `(set-)terminal-local-value' functions.
+
+   Perhaps there should be a difference between `last-command' &co.
+   and these more conventional configuration variables.
+   (E.g. `symbol-value' would use current_kboard to access
+   `last-command', but SELECTED_FRAME()->display->kboard to get the
+   value of `function-key-map'.
+
+** The single-keyboard mode of MULTI_KBOARD is extremely confusing
+   sometimes; Emacs does not respond to stimuli from other keyboards.
+   At least a beep or a message would be important, if the single-mode
+   is still required to prevent interference.  (Reported by Dan
+   Nicolaescu.)  
+
+   Update: selecting a region with the mouse enables single_kboard
+   under X.  This is very confusing.
+
+   Update: After discussions with Richard Stallman, this will be
+   resolved by having locked displays warn the user to wait, and
+   introducing a complex protocol to remotely bail out of
+   single-kboard mode by pressing C-g.
+
+   Update: Warning the user is not trivial to implement, as Emacs has
+   only one echo area, shared by all frames.  Ideally the warning
+   should not be displayed on the display that is locking the others.
+   Perhaps the high probability of user confusion caused by
+   single_kboard mode deserves a special case in the display code.
+   Alternatively, it might be good enough to signal single_kboard mode
+   by changing the modelines or some other frame-local display element
+   on the locked out displays.
+
+** normal-erase-is-backspace-mode in simple.el needs to be updated for
+   multi-tty (rep. by Dan Waber).
+
+** Hunt down display-related functions in frame.el and extend them all
+   to accept display ids.
+
+** rif->flush_display_optional (NULL) calls should be replaced by a
+   new global function.
+
+** The set-locale-environment hack (adding the DISPLAY option) should
+   be replaced with a clean design.
+
+** standard-display-table should be display-local.
+   standard-display-european should be display-local.
+
+** With iswitchb-default-method set to 'always-frame, only frames on
+   the current display should be considered.  This might involve
+   extending `get-buffer-window'.
+
+** Have a look at Vlocale_coding_system.  Seems like it would be a
+   tedious job to localize it, although most references use it for
+   interfacing with libc and are therefore OK with the global
+   definition.
+
+   Exceptions found so far: x-select-text and
+   x-cut-buffer-or-selection-value.
+
+** Have a look at fatal_error_hook.
+
+** Have a look at set_frame_matrix_frame.
+
+** Check if we got term-setup-hook right.
+
+** I think tip_frame should be display-local.
+
+** Check display reference count handling in x_create_tip_frame.
+
+** make-frame does not correctly handle extra parameters in its
+   argument:
+
+       (frame-parameter (make-frame (list (cons 'foobar 42))) 'foobar)
+               => nil
+
+   (This is likely an error in the CVS trunk.)
+
+** Dan Nicolaescu suggests that -nw should be added as an alias for -t
+   in emacsclient.  Good idea.  (Alas, implementing this is not
+   trivial, getopt_long does not seem to support two-letter ``short''
+   options.  Patches are welcome.) :-)
+
+** Mark Plaksin suggests that emacsclient should accept the same
+   X-related command-line arguments as Emacs.  Most of the X-related
+   argument-handling is done in Lisp, so this should be quite easy to
+   implement.
+
+** Gergely Nagy suggests that C-x # should only kill the current
+   frame, not any other emacsclient frame that may have the same file
+   opened for editing.  I think I agree with him.
+
+** Very strange bug: visible-bell does not work on secondary
+   terminals in xterm and konsole.  The screen does flicker a bit,
+   but it's so quick it isn't noticable.
+
+** Move baud_rate to struct display.
+
+** Implement support for starting an interactive Emacs session without
+   an initial frame.  (The user would connect to it and open frames
+   later, with emacsclient.)
+
+** Fix Mac support (I can't do this entirely myself).  Note that the
+   current state of Mac-specific source files in the multi-tty tree
+   are not useful; before starting work on Mac support, revert to
+   pristine, pre-multi-tty versions.
+
+** Fix W32 support (I can't do this entirely myself).  Note that the
+   current state of W32-specific source files in the multi-tty tree
+   are not useful; before starting work on W32 support, revert to
+   pristine, pre-multi-tty versions.
+
+** Fix DOS support (I can't do this entirely myself).  Note that the
+   current state of DOS-specific source files in the multi-tty tree
+   are not useful; before starting work on DOS support, revert to
+   pristine, pre-multi-tty versions.
+
+** Do a grep on XXX and ?? for more issues.
+
+** Understand Emacs's low-level input system (it's black magic) :-)
+   What exactly does interrupt_input do?  I tried to disable it for
+   raw secondary tty support, but it does not seem to do anything
+   useful.  (Update: Look again. X unconditionally enables this, maybe
+   that's why raw terminal support is broken again.  I really do need
+   to understand input.)
+
+** Fix stuff_char for multi-tty.  Doesn't seem to be of high priority.
+
+DIARY OF CHANGES
+----------------
+
+(ex-TODO items with explanations.)
+
+-- Introduce a new struct for terminal devices.
+
+   (Done, see struct tty_output.  The list of members is not yet
+   complete.)
+
+-- Change the bootstrap procedure to initialize tty_list.
+
+   (Done, but needs review.)
+
+-- Change make-terminal-frame to support specifying another tty.
+
+   (Done, new frame parameters: `tty' and `tty-type'.)
+
+-- Implement support for reading from multiple terminals.
+
+   (Done, read_avail_input tries to read from each terminal, until one
+   succeeds.  MULTI_KBOARD is not used.  Secondary terminals don't send
+   SIGIO!)
+
+   (Update: They do, now.)
+
+   (Update2: After enabling X, they don't.)
+
+-- other-frame should cycle through the frames on the `current'
+   terminal only.
+
+   (Done, by trivially modifiying next_frame and prev_frame.)
+
+-- Support different terminal sizes.
+
+   (Done, no problem.)
+
+-- Make sure terminal resizes are handled gracefully.  (Could be
+   problematic.)
+
+   (Done.  We don't get automatic SIGWINCH for additional ttys,
+   though.)
+
+-- Extend emacsclient to automatically open a new tty when it connects
+   to Emacs.
+
+   (Done.  It's an ugly hack, needs more work.)
+
+-- Redisplay must refresh the topmost frame on *all* terminals, not
+   just the initial terminal.
+
+   (Done, but introduced an ugly redisplay problems.  Ugh.)
+
+-- Fix redisplay problems.
+
+   (Done; it turned out that the entire Wcm structure must be moved
+   inside tty_output.  Why didn't I catch this earlier?)
+
+-- Provide a way for emacsclient to tell Emacs that the tty has been
+   resized.
+
+   (Done, simply forward the SIGWINCH signal.)
+
+-- Each keypress should automatically select the frame corresponding
+   to the terminal that it was coming from.  This means that Emacs
+   must know from which terminal the last keyboard event came from.
+
+   (Done, it was quite simple, the input event system already
+   supported multiple frames.)
+
+-- Fix SIGIO issue with secondary terminals.
+
+   (Done, emacsclient signals Emacs after writing to the proxy pseudo
+   terminal.  Note that this means that multi-tty does not work with
+   raw ttys!)
+
+   (Update: This is bullshit.  There is a read_input_waiting function,
+   extend that somehow.)
+
+   (Update of update: The first update was not right either, extending
+   read_input_waiting was not necessary.  Secondary ttys do seem to
+   send signals on input.)
+
+   (Update^3: Not any more.)
+
+-- Make make-terminal-frame look up the `tty' and `tty-type' frame
+   parameters from the currently selected terminal before the global
+   default.
+
+   (Done.)
+
+-- Put all cached terminal escape sequences into struct tty_output.
+   Currently, they are still stored in global variables, so we don't
+   really support multiple terminal types.
+
+   (Done.  It was not fun.)
+
+-- Implement sane error handling after initialization.  (Currently
+   emacs exits if you specify a bad terminal type.)  The helpful error
+   messages must still be provided when Emacs starts.
+
+   (Done.)
+
+-- Implement terminal deletion, i.e., deleting local frames, closing
+   the tty device and restoring its previous state without exiting
+   Emacs.
+
+   (Done, but at the moment only called when an error happens during
+   initialization.  There is a memory corruption error around this
+   somewhere.)  (Update: now it is fully enabled.)
+
+-- Implement automatic deletion of terminals when the last frame on
+   that terminal is closed.
+
+   (Done.)
+
+-- Restore tty screen after closing the terminal.
+
+   (Done, we do the same as Emacs 21.2 for all terminals.)
+
+-- 'TERM=dumb src/emacs' does not restore the terminal state.
+
+   (Done.)
+
+-- C-g should work on secondary terminals.
+
+   (Done, but the binding is not configurable.)
+
+-- Deal with SIGHUP in Emacs and in emacsclient.  (After this, the
+   server-frames may be removed from server.el.)
+
+   (Done, nothing to do.  It seems that Emacs does not receive SIGHUP
+   from secondary ttys, which is actually a good thing.)  (Update: I
+   think it would be a bad idea to remove server-frames.)
+
+-- Change emacsclient/server.el to support the -t argument better,
+   i.e. automatically close the socket when the frame is closed.
+
+   (Seems to be working OK.)
+
+-- Fix mysterious memory corruption error with tty deletion.  To
+   trigger it, try the following shell command:
+
+       while true; do TERM=no-such-terminal-definition emacsclient -h; done
+
+   Emacs usually dumps core after a few dozen iterations.  (The bug
+   seems to be related to the xfreeing or bzeroing of
+   tty_output.Wcm.  Maybe there are outside references to struct Wcm?
+   Why were these vars collected into a struct before multi-tty
+   support?)
+
+   (Done.  Whew.  It turned out that the problem had nothing to do
+   with hypothetical external references to Wcm, or any other
+   tty_output component; it was simply that delete_tty closed the
+   filehandles of secondary ttys twice, resulting in fclose doubly
+   freeing memory.  Utterly trivial matter.  I love the C's memory
+   management, it puts hair on your chest.)
+
+-- Support raw secondary terminals.  (Note that SIGIO works only on
+   the controlling terminal.) Hint: extend read_input_waiting for
+   multiple ttys and hopefully this will be fixed.
+
+   (Done, it seems to have been working already for some time.  It
+   seems F_SETOWN does work, after all.  Not sure what made it fail
+   earlier, but it seems to be fixed (there were several changes
+   around request_sigio, maybe one of them did it).
+   read_input_waiting is only used in sys_select, don't change
+   it.)  (Update: After adding X support, it's broken again.)
+   (Update^2: No it isn't.) :-)
+
+-- Find out why does Emacs abort when it wants to close its
+   controlling tty.  Hint: chan_process[] array.  Hey, maybe
+   noninterrupt-IO would work, too?  Update: no, there is no process
+   for stdin/out.
+
+   (Done.  Added add/delete_keyboard_wait_descriptor to
+   term_init/delete_tty.  The hint was right, in a way.)
+
+-- Issue with SIGIO: it needs to be disabled during redisplay.  See if
+   fcntl kernel behaviour could be emulated by emacsclient.
+
+   (Done.  Simply disabled the SIGIO emulation hack in emacsclient.)
+   (Update: it was added back.)  (Update^2: and removed again.)
+
+-- server.el: There are issues with saving files in buffers of closed
+   clients.  Try editing a file with emacsclient -f, and (without
+   saving it) do a delete-frame.  The frame is closed without
+   question, and a surprising confirmation prompt appears in another
+   frame.
+
+   (Done.  delete-frame now asks for confirmation if it still has
+   pending buffers, and modified buffers don't seem to be deleted.)
+
+-- emacsclient.el, server.el: Handle eval or file open errors when
+   doing -t.
+
+   (Done.)
+
+-- Make parts of struct tty_output accessible from Lisp.  The device
+   name and the type is sufficient.
+
+   (Done, see frame-tty-name and frame-tty-type.)
+
+-- Export delete_tty to the Lisp environment, for emacsclient.
+
+   (Done, see delete-tty.)
+
+-- Get rid of the accessor macros in termchar.h, or define macros for
+   all members.
+
+   (Done.)
+
+-- Move device-specific parameters (like costs) commonly used by
+   device backends to a common, device-dependent structure.
+
+   (Done.  See struct display_method in termhooks.h.)
+
+-- Fix X support.
+
+   (Done.  Well, it seems to be working.)
+
+-- Allow simultaneous X and tty frames.  (Handling input could be
+   tricky.  Or maybe not.)
+
+   (Done.  Allowed, that is.  It is currently extremely unstable, to
+   the point of being unusable.  The rif variable causes constant
+   core dumps.  Handling input is indeed tricky.)
+
+-- Rewrite multi-tty input in terms of MULTI_KBOARD.
+
+   (Done.  In fact, there was no need to rewrite anything, I just
+   added a kboard member to tty_display_info, and initialized the
+   frame's kboard from there.)
+
+-- Fix rif issue with X-tty combo sessions.  IMHO the best thing to do
+   is to get rid of that global variable (and use the value value in
+   display_method, which is guaranteed to be correct).
+
+   (Done, did exactly that.  Core dumps during combo sessions became
+   much rarer.  In fact, I have not yet met a single one.)
+
+-- Add multi-tty support to talk.el.
+
+   (Done.)
+
+-- Clean up the source of emacsclient.  It is a mess.
+
+   (Done, eliminated stupid proxy-pty kludge.)
+
+-- Fix faces on tty frames during X-tty combo sessions.  There is an
+   init_frame_faces call in init_sys_modes, see if there is a problem
+   with it.
+
+   (Done, there was a stupid mistake in
+   Ftty_supports_face_attributes_p. Colors are broken, though.)
+
+-- C-x 5 2, C-x 5 o, C-x 5 0 on an emacsclient frame unexpectedly
+   exits emacsclient.  This is a result of trying to be clever with
+   delete-frame-functions.
+
+   (Fixed, added delete-tty-after-functions, and changed server.el to
+   use it.)
+
+-- Something with (maybe) multi-keyboard support broke function keys
+   and arrows on ttys during X+tty combo sessions.  Debug this.
+
+   (I can't reproduce it, maybe the terminal type was wrong.)
+
+-- Fix input from raw ttys (again).
+
+   (Now it seems to work all right.)
+
+-- During an X-tty combo session, a (message "Hello") from a tty frame
+   goes to the X frame.  Fix this.
+
+   (Done.  There was a safeguard against writing to the initial
+   terminal frame during bootstrap which prevented echo_area_display
+   from working correctly on a tty frame during a combo session.)
+
+-- If there are no frames on its controlling terminal, Emacs should
+   exit if the user presses C-c there.
+
+   (Done, as far as possible.  See the SIGTERM comment in
+   interrupt_signal on why this seems to be impossible to solve this
+   in general.)
+
+-- During an X session, Emacs seems to read from stdin.  Also, Emacs
+   fails to start without a controlling tty.
+
+   (Fixed by replacing the troublesome termcap display with a dummy
+   bootstrap display during bootstrap.
+
+-- Do tty output through struct display, like graphical display
+   backends.
+
+   (Done.)
+
+-- Define an output_initial value for output_method for the initial
+   frame that is dumped with Emacs.  Checking for this frame (e.g. in
+   cmd_error_internal) is ugly.
+
+   (Done, broking interactive temacs.)
+
+-- The command `emacsclient -t -e '(delete-frame)'' fails to exit.
+
+   (Fixed.)
+
+-- frame-creation-function should always create a frame that is on the
+   same display as the selected frame.  Maybe frame-creation-function
+   should simply be removed and make-frame changed to do the right
+   thing.
+
+   (Done, with a nice hack.  frame-creation-function is now frame-local.)
+
+-- Fix C-g on raw ttys.
+
+   (Done.  I disabled the interrupt/quit keys on all secondary
+   terminals, so Emacs sees C-g as normal input.  This looks like an
+   overkill, because emacsclient has extra code to pass SIGINT to
+   Emacs, so C-g should remain the interrupt/quit key on emacsclient
+   frames.  See the next entry why implementing this distinction would
+   be a bad idea.)
+
+-- Make sure C-g goes to the right frame with ttys.  This is hard, as
+   SIGINT doesn't have a tty parameter. :-(
+
+   (Done, the previous change fixes this as a pleasant side effect.)
+
+-- I have seen a case when Emacs with multiple ttys fell into a loop
+   eating 100% of CPU time.  Strace showed this loop:
+
+       getpid()                                = 30284
+       kill(30284, SIGIO)                      = 0
+       --- SIGIO (I/O possible) @ 0 (0) ---
+       ioctl(6, FIONREAD, [0])                 = -1 EIO (Input/output error)
+       ioctl(5, FIONREAD, [0])                 = -1 EIO (Input/output error)
+       ioctl(0, FIONREAD, [0])                 = 0
+       sigreturn()                             = ? (mask now [])
+       gettimeofday({1072842297, 747760}, NULL) = 0
+       gettimeofday({1072842297, 747806}, NULL) = 0
+       select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0})
+       select(9, [0 3 5 6], NULL, NULL, {0, 0}) = 2 (in [5 6], left {0, 0})
+       gettimeofday({1072842297, 748245}, NULL) = 0
+
+   I have seen something similar with a single X frame, but have not
+   been able to reproduce it for debugging.
+
+   Update: This may have been caused by checking for nread != 0
+   instead of nread > 0 after calling read_socket_hook in
+   read_avail_input.
+
+   (Fixed.  This was caused by unconditionally including stdin in
+   input_wait_mask in init_process.  The select call in
+   wait_reading_process_input always returned immediately, indicating
+   that there is pending input from stdin, which nobody read.
+
+   Note that the above strace output seems to be an unrelated but
+   similar bug.  I think that is now fixed.)
+
+-- Exiting Emacs while there are emacsclient frames doesn't restore the
+   ttys to their default states.
+
+   (This seems to be fixed by some previous change.)
+
+-- Allow opening an X session after -nw.
+
+   (Done.)
+
+-- Fix color handling during tty+X combo sessions.  (It seems that tty
+   sessions automatically convert the face colors to terminal colors
+   when the face is loaded.  This conversion must happen instead on
+   the fly in write_glyphs, which might be problematic, as color
+   approximation is currently done in lisp (term/tty-colors.el).)
+   (Update: hm, colors seem to work fine if I start emacs with -nw and
+   then create an X frame.  Maybe it's just a small buglet somewhere.)
+
+   (Seems to be fixed.  The problem was in startup.el, it did not
+   initialize tty colors when the initial window system was
+   graphical.)
+
+-- emacs -nw --eval '(y-or-n-p "Foobar")' segfaults.  (Reported by
+   Romain Francoise)
+
+   (Fixed, there was a keyboard initialization problem.)
+
+-- Fix interactive use of temacs.  There are face-related SEGVs, most
+   likely because of changes in realize_default_face, realize_face.
+
+   (Fixed.)
+
+-- Don't exit Emacs when the last X connection fails during a
+   multi-display session.
+
+   (Fixed.)
+
+-- Dan Nicolaescu noticed that starting emacsclient on the same
+   terminal device that is the controlling tty of the Emacs process
+   gives unexpected results.
+
+   (Fixed.)
+
+-- Istvan Marko reported that Emacs hang on ttys if it was started
+   from a shell script.
+
+   (Fixed.  There was a bug in the multi-tty version of
+   narrow_foreground_group.  tcsetpgrp blocks if it is called from a
+   process that is not in the same process group as the tty.)
+
+-- emacsclient -t from an Emacs term buffer does not work, complains
+   about face problems.  This can even lock up Emacs (if the recursive
+   frame sets single_kboard).  Update: the face problems are caused by
+   bugs in term.el, not in multi-tty.  The lockup is caused by
+   single_kboard mode, and is not easily resolvable.  The best thing to
+   do is to simply refuse to create a tty frame of type `eterm'.
+
+   (Fixed, changed emacsclient to check for TERM=eterm.  The face
+   complaints seem to be caused by bugs in term.el; they are not
+   related to multi-tty.)
+
+-- Find out the best way to support suspending Emacs with multiple
+   ttys.  My guess: disable it on the controlling tty, but from other
+   ttys pass it on to emacsclient somehow.  (It is (I hope) trivial to
+   extend emacsclient to handle suspend/resume.  A `kill -STOP' almost
+   works right now.)
+
+   (Done.  I needed to play with signal handling and the server
+   protocol a bit to make emacsclient behave as a normal UNIX program
+   wrt foreground/background process groups.)
+
+-- There is a flicker during the startup of `emacs -nw'; it's as if
+   the terminal is initialized, reset and then initialialized again.
+   Debug this.  (Hint: narrow_foreground_group is called twice during
+   startup.)
+
+   (This is gone.)
+
+-- Robert Chassell has found serious copy-paste bugs with the
+   multi-tty branch.  There seem to be redisplay bugs while copying
+   from X to a terminal frame.  Copying accented characters do not
+   work for me.
+
+   (Patch-124 should fix this, by changing the interprogram-*-function
+   variables to be frame-local, as suggested by Mark Plaksin
+   (thanks!).  I think that the redisplay bugs are in fact not bugs,
+   but delays caused by single_kboard --> perhaps MULTI_KBOARD should
+   be removed.)
+
+-- frame-creation-function was removed, which might be a bad idea.
+   Think up a compatible solution.
+
+   (It was an internal interface that may be changed when necessary.)
+
+-- Change Lisp code not to (getenv "TERM"); use the `tty-type' frame
+   parameter or the frame-tty-type function instead.  (M-x tags-search
+   "TERM" helps with this.)  Update: Actually, all getenv invocations
+   should be checked for multi-tty compatibility, and an interface
+   must be implemented to get the remote client's environment.
+
+   (Done.  Only getenv calls in lisp/term/*.el were changed; other
+   calls should be mostly left as they are.)
+
+-- Add an elaborate mechanism for display-local variables.  (There are
+   already a few of these; search for `terminal-local' in the Elisp
+   manual.)
+
+   (Not needed.  Display-local variables could be emulated by
+   frame-local variables.)
+
+-- Emacs assumes that all terminal frames have the same locale
+   settings as Emacs itself.  This may lead to bogus results in a
+   multi-locale setup. (E.g., while logging in from a remote client
+   with a different locale.)
+   (Update after new bugreport by Friedrich Delgado Friedrichs: 
+   (at least) the structs terminal_coding and keyboard_coding in
+   coding.c must be moved to struct display, and the Lisp interface
+   [set-]keyboard-coding-system must be adapted for the change.)
+
+   (Fixed.  Emacs now uses the locale settings as seen by the
+   emacsclient process for server tty frames.)
+   (Update: Not really; Vlocale_coding_system is still global.)
+
+-- Make `struct display' accessible to Lisp programs.  Accessor functions:
+
+       (displayp OBJECT):  Returns t if OBJECT is a display.
+               => Implemented as display-live-p.
+
+       (display-list):  Returns list of currently active displays.
+               => Implemented.
+
+       (selected-display):  Returns the display object of the selected frame.
+               => Not strictly necessary, but implemented anyway.
+
+       (frame-display FRAME):  Returns the display object of FRAME.
+               => Implemented.
+
+       (display-frames DISPLAY):  Returns a list of frames on DISPLAY.
+               => Already implemented, see frames-on-display-list.
+
+       (display-type DISPLAY):  Returns the type of DISPLAY, as a
+               symbol.  (See `framep'.)
+               => Implemented as display-live-p.
+
+       (display-device DISPLAY): Returns the name of the device that
+               DISPLAY uses, as a string.  (E.g: "/dev/pts/16", or
+               ":0.0")
+               => Implemented as display-name.
+
+       etc.
+
+   See next issue why this is necessary.
+
+   (Update: The consensus on emacs-devel seems to be to do this via
+   integer identifiers.  That's fine by me.)
+
+   (Done.)
+
+-- The following needs to be supported:
+
+       $ emacsclient -t
+               C-z
+       $ emacsclient -t
+               (This fails now.)
+
+   The cleanest way to solve this is to allow multiple displays on the
+   same terminal device; each new emacsclient process should create
+   its own display.  As displays are currently identified by their
+   device names, this is not possible until struct display becomes
+   accessible as a Lisp-level object.
+
+   (Done.)
+
+-- Miles Bader suggests that C-x C-c on an emacsclient frame should
+   only close the frame, not exit the entire Emacs session.  Update:
+   see above for a function that does this.  Maybe this should be the
+   new default?  
+
+   (Done.  This is the new default.  No complaints so far.)
+
+-- Clean up the frame-local variable system.  I think it's ugly and
+   error-prone.  But maybe I just haven't yet fully understood it.
+
+   (Nothing to do.  It doesn't seem ugly any more.  It's rather clever.)
+
+-- Support multiple character locales.  A version of
+   `set-locale-environment' needs to be written for setting up
+   display-local settings on ttys.  I think calling
+   set-display-table-and-terminal-coding-system and
+   set-keyboard-coding-system would be enough.  The language
+   environment itself should remain a global setting.
+
+   (Done, by an ugly hack.)
+
+-- The terminal customization files in term/*.el tend to change global
+   parameters, which may confuse Emacs with multiple displays.  Change
+   them to tweak only frame-local settings, if possible.  (They tend
+   to call define-key to set function key sequences a lot.)
+
+   (Done, by making `function-key-map' terminal-local (i.e., part of
+   struct kboard).  This has probably covered all the remaining problems.)
+
+-- Make `function-key-map' and `key-translation-map' terminal-local.
+
+   (Done.)
+
+-- Implement `terminal-local-value' and `set-terminal-local-value' to
+   allow deterministic access to terminal local bindings.  The
+   encode-kb package can not set up `key-translation-map' without
+   these.  The terminal-local bindings seem to be independent of what
+   frame is selected.
+
+   (Done.)
+
+;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
+
index 2c343e53f15f4cd6353e4c1b15503fccb04c3c0c..20d29f836949e319fc07cbf527411a8cd1efe90d 100644 (file)
@@ -1,18 +1,27 @@
-This file describes the CVS branch in which it is maintained.
+This file describes the Arch branch in which it is maintained.
 Everything below the line is branch-specific.
 ________________________________________________________________________
 
-This is the "HEAD" branch, otherwise known as the "trunk".  Its primary
-purpose is to accumulate changes that are not yet partitioned into a
-specific (versioned) release.  When people say "use CVS emacs", this is
-the branch they are talking about.  Likewise, a "cvs checkout" without
-the "-r" option results in this branch.
+This is the "multi-tty" branch.  It contains a version of Emacs that
+is able to create frames on multiple display devices and display
+types, including multiple tty devices and tty+X combined sessions.
+The branch has an enhanced version of emacsclient that is capable of
+opening a new Emacs frame on the terminal it runs on.
 
-The plans for this branch are not specified; Emacs hackers add to it
-relatively free of constraint (aside from proper legal / accounting
-practices), although sometimes there is related discussion on the
-emacs-devel mailing list.
+Commit access to the multi-tty branch is only available to its
+maintainer, Károly LÅ\91rentey (lorentey@elte.hu).  The best way to
+contribute to the project is to create your own public Arch branch,
+and publish your changes there.  (I will then be able to easily "pull"
+your changes into the multi-tty branch.)
 
-The closure process for this branch is undocumented; concepts such as
-"freeze", "release", or "integration with the trunk" are not applicable
-to this branch.
+The branch is scheduled for inclusion in the next major release of
+Emacs, version 22.
+
+Please read the file README.multi-tty in the base directory for
+details.
+
+
+
+Local Variables:
+coding: utf-8
+End:
index e92965c89d94805326c9492c5e60c2cc9e2c0c66..c26803933ee9a5655d7e60c61fd373372f300784 100644 (file)
--- a/etc/ONEWS
+++ b/etc/ONEWS
@@ -1029,7 +1029,7 @@ your working file with the latest version from the master.
 *** RCS customization.
 
 There is a new variable vc-consult-headers.  If it is t (the default),
-VC searches for RCS headers in working files (like `$Id: ONEWS,v 1.8 2003/02/04 14:30:40 lektu Exp $') and
+VC searches for RCS headers in working files (like `$Id$') and
 determines the state of the file from them, not from the master file.
 This is fast and more reliable when you use branches.  (The variable
 was already present in Emacs 19.29, but didn't get mentioned in the
index 34b79f7869896d4150f8d2a33c929a6359e60988..804b07a696cd4f571f1a6c2c7df223519dc0ab7f 100644 (file)
--- a/etc/TODO
+++ b/etc/TODO
@@ -193,7 +193,10 @@ to the FSF.
 ** Highlight rectangles (`mouse-track-rectangle-p' in XEmacs).  Already in CUA,
   but it's a valuable feature worth making more general.
 
-** Support simultaneous tty and X frames.
+** Support simultaneous tty and X frames.  [For a partial
+  implementation, see tla branch
+  lorentey@elte.hu--2004/emacs--multi-tty--0 at
+  http://lorentey.hu/arch/2004]
 
 ** Provide MIME support for Rmail using the Gnus MIME library.  [Maybe
   not now feasible, given Gnus maintenance decisions.  fx looked at
diff --git a/info/COPYING b/info/COPYING
deleted file mode 100644 (file)
index 3912109..0000000
+++ /dev/null
@@ -1,340 +0,0 @@
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-\f
-                   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-\f
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-\f
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-\f
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                           NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-\f
-           How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
index 75fa9ebe8e7aad0c92a445e1ff5977b1d6820094..b795e62704837d151073d6e73b034afed5a1dc48 100644 (file)
@@ -41,6 +41,10 @@ Boston, MA 02110-1301, USA.  */
 # include <pwd.h>
 #endif /* not VMS */
 
+#include <signal.h>
+#include <errno.h>
+
+\f
 char *getenv (), *getwd ();
 char *(getcwd) ();
 
@@ -51,15 +55,27 @@ char *(getcwd) ();
 /* Name used to invoke this program.  */
 char *progname;
 
+/* The first argument to main. */
+int main_argc;
+
+/* The second argument to main. */
+char **main_argv;
+
 /* Nonzero means don't wait for a response from Emacs.  --no-wait.  */
 int nowait = 0;
 
 /* Nonzero means args are expressions to be evaluated.  --eval.  */
 int eval = 0;
 
+/* Nonzero means open a new graphical frame. */
+int window_system = 0;
+
 /* The display on which Emacs should work.  --display.  */
 char *display = NULL;
 
+/* Nonzero means open a new Emacs frame on the current terminal. */
+int tty = 0;
+
 /* If non-NULL, the name of an editor to fallback to if the server
    is not running.  --alternate-editor.   */
 const char * alternate_editor = NULL;
@@ -75,6 +91,8 @@ struct option longopts[] =
   { "eval",    no_argument,       NULL, 'e' },
   { "help",    no_argument,       NULL, 'H' },
   { "version", no_argument,       NULL, 'V' },
+  { "tty",     no_argument,       NULL, 't' },
+  { "current-frame", no_argument,  NULL, 'c' },
   { "alternate-editor", required_argument, NULL, 'a' },
   { "socket-name",     required_argument, NULL, 's' },
   { "display", required_argument, NULL, 'd' },
@@ -90,11 +108,19 @@ decode_options (argc, argv)
      char **argv;
 {
   alternate_editor = getenv ("ALTERNATE_EDITOR");
+  display = getenv ("DISPLAY");
+  if (display && strlen (display) == 0)
+    display = NULL;
+
+  if (display)
+    window_system = 1;
+  else
+    tty = 1;
 
   while (1)
     {
       int opt = getopt_long (argc, argv,
-                            "VHnea:s:d:", longopts, 0);
+                            "VHnea:s:d:tc", longopts, 0);
 
       if (opt == EOF)
        break;
@@ -131,6 +157,16 @@ decode_options (argc, argv)
          exit (EXIT_SUCCESS);
          break;
 
+        case 't':
+          tty = 1;
+          window_system = 0;
+          break;
+
+        case 'c':
+          window_system = 0;
+          tty = 0;
+          break;
+
        case 'H':
          print_help_and_exit ();
          break;
@@ -141,6 +177,11 @@ decode_options (argc, argv)
          break;
        }
     }
+
+  if (tty) {
+    nowait = 0;
+    display = 0;
+  }
 }
 
 void
@@ -154,6 +195,8 @@ Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\
 The following OPTIONS are accepted:\n\
 -V, --version           Just print a version info and return\n\
 -H, --help              Print this usage information message\n\
+-t, --tty               Open a new Emacs frame on the current terminal\n\
+-c, --current-frame    Do not create a new frame; use the current Emacs frame\n\
 -n, --no-wait           Don't wait for the server to return\n\
 -e, --eval              Evaluate the FILE arguments as ELisp expressions\n\
 -d, --display=DISPLAY   Visit the file in the given display\n\
@@ -166,19 +209,50 @@ Report bugs to bug-gnu-emacs@gnu.org.\n", progname);
   exit (EXIT_SUCCESS);
 }
 
-/* In NAME, insert a & before each &, each space, each newline, and
+/* Like malloc but get fatal error if memory is exhausted.  */
+
+long *
+xmalloc (size)
+     unsigned int size;
+{
+  long *result = (long *) malloc (size);
+  if (result == NULL)
+    {
+      perror ("malloc");
+      exit (EXIT_FAILURE);
+    }
+  return result;
+}
+
+/* Like strdup but get a fatal error if memory is exhausted. */
+
+char *
+xstrdup (const char *s)
+{
+  char *result = strdup (s);
+  if (result == NULL)
+    {
+      perror ("strdup");
+      exit (EXIT_FAILURE);
+    }
+  return result;
+}
+
+/* In STR, insert a & before each &, each space, each newline, and
    any initial -.  Change spaces to underscores, too, so that the
-   return value never contains a space.  */
+   return value never contains a space.
+
+   Does not change the string.  Outputs the result to STREAM.  */
 
 void
-quote_file_name (name, stream)
-     char *name;
+quote_argument (str, stream)
+     char *str;
      FILE *stream;
 {
-  char *copy = (char *) malloc (strlen (name) * 2 + 1);
+  char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
   char *p, *q;
 
-  p = name;
+  p = str;
   q = copy;
   while (*p)
     {
@@ -196,7 +270,7 @@ quote_file_name (name, stream)
        }
       else
        {
-         if (*p == '&' || (*p == '-' && p == name))
+         if (*p == '&' || (*p == '-' && p == str))
            *q++ = '&';
          *q++ = *p++;
        }
@@ -208,34 +282,53 @@ quote_file_name (name, stream)
   free (copy);
 }
 
-/* Like malloc but get fatal error if memory is exhausted.  */
 
-long *
-xmalloc (size)
-     unsigned int size;
+/* The inverse of quote_argument.  Removes quoting in string STR by
+   modifying the string in place.   Returns STR. */
+
+char *
+unquote_argument (str)
+     char *str;
 {
-  long *result = (long *) malloc (size);
-  if (result == NULL)
-  {
-    perror ("malloc");
-    exit (EXIT_FAILURE);
-  }
-  return result;
+  char *p, *q;
+
+  if (! str)
+    return str;
+
+  p = str;
+  q = str;
+  while (*p)
+    {
+      if (*p == '&')
+        {
+          p++;
+          if (*p == '&')
+            *p = '&';
+          else if (*p == '_')
+            *p = ' ';
+          else if (*p == 'n')
+            *p = '\n';
+          else if (*p == '-')
+            *p = '-';
+        }
+      *q++ = *p++;
+    }
+  *q = 0;
+  return str;
 }
+
 \f
 /*
   Try to run a different command, or --if no alternate editor is
   defined-- exit with an errorcode.
 */
 void
-fail (argc, argv)
-     int argc;
-     char **argv;
+fail (void)
 {
   if (alternate_editor)
     {
       int i = optind - 1;
-      execvp (alternate_editor, argv + i);
+      execvp (alternate_editor, main_argv + i);
       return;
     }
   else
@@ -244,6 +337,101 @@ fail (argc, argv)
     }
 }
 
+/* The process id of Emacs. */
+int emacs_pid;
+
+/* File handles for communicating with Emacs. */
+FILE *out, *in;
+
+/* A signal handler that passes the signal to the Emacs process.
+   Useful for SIGWINCH.  */
+
+SIGTYPE
+pass_signal_to_emacs (int signalnum)
+{
+  int old_errno = errno;
+
+  if (emacs_pid)
+    kill (emacs_pid, signalnum);
+
+  signal (signalnum, pass_signal_to_emacs);
+  errno = old_errno;
+}
+
+/* Signal handler for SIGCONT; notify the Emacs process that it can
+   now resume our tty frame.  */
+
+SIGTYPE
+handle_sigcont (int signalnum)
+{
+  int old_errno = errno;
+
+  if (tcgetpgrp (1) == getpgrp ())
+    {
+      /* We are in the foreground. */
+      fprintf (out, "-resume \n");
+      fflush (out);
+      fsync (fileno (out));
+    }
+  else
+    {
+      /* We are in the background; cancel the continue. */
+      kill (getpid (), SIGSTOP);
+    }
+  errno = old_errno;
+}
+
+/* Signal handler for SIGTSTP; notify the Emacs process that we are
+   going to sleep.  Normally the suspend is initiated by Emacs via
+   server-handle-suspend-tty, but if the server gets out of sync with
+   reality, we may get a SIGTSTP on C-z.  Handling this signal and
+   notifying Emacs about it should get things under control again. */
+
+SIGTYPE
+handle_sigtstp (int signalnum)
+{
+  int old_errno = errno;
+  sigset_t set;
+  
+  if (out)
+    {
+      fprintf (out, "-suspend \n");
+      fflush (out);
+      fsync (fileno (out));
+    }
+
+  /* Unblock this signal and call the default handler by temprarily
+     changing the handler and resignalling. */
+  sigprocmask (SIG_BLOCK, NULL, &set);
+  sigdelset (&set, signalnum);
+  signal (signalnum, SIG_DFL);
+  kill (getpid (), signalnum);
+  sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */
+  signal (signalnum, handle_sigtstp);
+
+  errno = old_errno;
+}
+
+/* Set up signal handlers before opening a frame on the current tty.  */
+
+void
+init_signals (void)
+{
+  /* Set up signal handlers. */
+  signal (SIGWINCH, pass_signal_to_emacs);
+
+  /* Don't pass SIGINT and SIGQUIT to Emacs, because it has no way of
+     deciding which terminal the signal came from.  C-g is now a
+     normal input event on secondary terminals.  */
+#if 0
+  signal (SIGINT, pass_signal_to_emacs);
+  signal (SIGQUIT, pass_signal_to_emacs);
+#endif
+
+  signal (SIGCONT, handle_sigcont);
+  signal (SIGTSTP, handle_sigtstp);
+  signal (SIGTTOU, handle_sigtstp);
+}
 
 \f
 #if !defined (HAVE_SOCKETS) || defined (NO_SOCKETS_IN_FILE_SYSTEM)
@@ -257,7 +445,7 @@ main (argc, argv)
           argv[0]);
   fprintf (stderr, "on systems with Berkeley sockets.\n");
 
-  fail (argc, argv);
+  fail ();
 }
 
 #else /* HAVE_SOCKETS */
@@ -291,23 +479,41 @@ socket_status (socket_name)
   return 0;
 }
 
+/* Returns 1 if PREFIX is a prefix of STRING. */
+static int
+strprefix (char *prefix, char *string)
+{
+  int i;
+  if (! prefix)
+    return 1;
+
+  if (!string)
+    return 0;
+
+  for (i = 0; prefix[i]; i++)
+    if (!string[i] || string[i] != prefix[i])
+      return 0;
+  return 1;
+}
+
 int
 main (argc, argv)
      int argc;
      char **argv;
 {
   int s, i, needlf = 0;
-  FILE *out, *in;
   struct sockaddr_un server;
   char *cwd, *str;
   char string[BUFSIZ];
 
+  main_argc = argc;
+  main_argv = argv;
   progname = argv[0];
 
   /* Process options.  */
   decode_options (argc, argv);
 
-  if ((argc - optind < 1) && !eval)
+  if ((argc - optind < 1) && !eval && !tty && !window_system)
     {
       fprintf (stderr, "%s: file name or argument required\n", progname);
       fprintf (stderr, "Try `%s --help' for more information\n", progname);
@@ -322,7 +528,7 @@ main (argc, argv)
     {
       fprintf (stderr, "%s: ", argv[0]);
       perror ("socket");
-      fail (argc, argv);
+      fail ();
     }
 
   server.sun_family = AF_UNIX;
@@ -330,30 +536,31 @@ main (argc, argv)
   {
     int sock_status = 0;
     int default_sock = !socket_name;
-    int saved_errno;
-    char *server_name = "server";
-
-    if (socket_name && !index (socket_name, '/') && !index (socket_name, '\\'))
-      { /* socket_name is a file name component.  */
-       server_name = socket_name;
-       socket_name = NULL;
-       default_sock = 1;       /* Try both UIDs.  */
-      }
+    int saved_errno = 0;
 
-    if (default_sock)
+     char *server_name = "server";
+
+     if (socket_name && !index (socket_name, '/') && !index (socket_name, '\\'))
+       { /* socket_name is a file name component.  */
+       server_name = socket_name;
+       socket_name = NULL;
+       default_sock = 1;       /* Try both UIDs.  */
+       }
+
+     if (default_sock)
       {
-       socket_name = alloca (100 + strlen (server_name));
-       sprintf (socket_name, "/tmp/emacs%d/%s",
-                (int) geteuid (), server_name);
+       socket_name = alloca (100 + strlen (server_name));
+       sprintf (socket_name, "/tmp/emacs%d/%s",
+                (int) geteuid (), server_name);
       }
 
     if (strlen (socket_name) < sizeof (server.sun_path))
       strcpy (server.sun_path, socket_name);
     else
       {
-       fprintf (stderr, "%s: socket-name %s too long",
-                argv[0], socket_name);
-       exit (EXIT_FAILURE);
+        fprintf (stderr, "%s: socket-name %s too long",
+                 argv[0], socket_name);
+        fail ();
       }
 
     /* See if the socket exists, and if it's owned by us. */
@@ -392,7 +599,7 @@ main (argc, argv)
                  }
 
                sock_status = socket_status (server.sun_path);
-               saved_errno = errno;
+                saved_errno = errno;
              }
            else
              errno = saved_errno;
@@ -407,7 +614,7 @@ main (argc, argv)
         if (0 != geteuid ())
           {
             fprintf (stderr, "%s: Invalid socket owner\n", argv[0]);
-            fail (argc, argv);
+            fail ();
           }
         break;
 
@@ -421,7 +628,7 @@ To start the server in Emacs, type \"M-x server-start\".\n",
         else
           fprintf (stderr, "%s: can't stat %s: %s\n",
                    argv[0], server.sun_path, strerror (saved_errno));
-        fail (argc, argv);
+        fail ();
         break;
        }
   }
@@ -431,18 +638,18 @@ To start the server in Emacs, type \"M-x server-start\".\n",
     {
       fprintf (stderr, "%s: ", argv[0]);
       perror ("connect");
-      fail (argc, argv);
+      fail ();
     }
 
-  /* We use the stream OUT to send our command to the server.  */
+  /* We use the stream OUT to send our commands to the server.  */
   if ((out = fdopen (s, "r+")) == NULL)
     {
       fprintf (stderr, "%s: ", argv[0]);
       perror ("fdopen");
-      fail (argc, argv);
+      fail ();
     }
 
-  /* We use the stream IN to read the response.
+  /* We use the stream IN to read the responses.
      We used to use just one stream for both output and input
      on the socket, but reversing direction works nonportably:
      on some systems, the output appears as the first input;
@@ -451,7 +658,7 @@ To start the server in Emacs, type \"M-x server-start\".\n",
     {
       fprintf (stderr, "%s: ", argv[0]);
       perror ("fdopen");
-      fail (argc, argv);
+      fail ();
     }
 
 #ifdef HAVE_GETCWD
@@ -465,87 +672,223 @@ To start the server in Emacs, type \"M-x server-start\".\n",
 
 #ifdef HAVE_GETCWD
       fprintf (stderr, "%s: %s (%s)\n", argv[0],
-              "Cannot get current working directory", strerror (errno));
+              "cannot get current working directory", strerror (errno));
 #else
       fprintf (stderr, "%s: %s (%s)\n", argv[0], string, strerror (errno));
 #endif
-      fail (argc, argv);
+      fail ();
     }
 
+  /* First of all, send our version number for verification. */
+  fprintf (out, "-version %s ", VERSION);
+
+  /* Send over our environment. */
+  {
+    extern char **environ;
+    int i;
+    for (i = 0; environ[i]; i++)
+      {
+        char *name = xstrdup (environ[i]);
+        char *value = strchr (name, '=');
+        if (value && strlen (value) > 1)
+          {
+            *value++ = 0;
+            fprintf (out, "-env ");
+            quote_argument (name, out);
+            fprintf (out, " ");
+            quote_argument (value, out);
+            fprintf (out, " ");
+            fflush (out);
+          }
+        free (name);
+      }
+  }
+
+ retry:
   if (nowait)
     fprintf (out, "-nowait ");
 
-  if (eval)
-    fprintf (out, "-eval ");
-
   if (display)
     {
       fprintf (out, "-display ");
-      quote_file_name (display, out);
+      quote_argument (display, out);
+      fprintf (out, " ");
+    }
+
+  if (tty)
+    {
+      char *tty_name = ttyname (fileno (stdin));
+      char *type = getenv ("TERM");
+
+      if (! tty_name)
+        {
+          fprintf (stderr, "%s: could not get terminal name\n", progname);
+          fail ();
+        }
+
+      if (! type)
+        {
+          fprintf (stderr, "%s: please set the TERM variable to your terminal type\n",
+                   progname);
+          fail ();
+        }
+
+      if (! strcmp (type, "eterm"))
+        {
+          /* This causes nasty, MULTI_KBOARD-related input lockouts. */
+          fprintf (stderr, "%s: opening a frame in an Emacs term buffer"
+                   " is not supported\n", progname);
+          fail ();
+        }
+
+      init_signals ();
+
+      fprintf (out, "-tty ");
+      quote_argument (tty_name, out);
+      fprintf (out, " ");
+      quote_argument (type, out);
       fprintf (out, " ");
     }
 
+  if (window_system)
+    fprintf (out, "-window-system ");
+
   if ((argc - optind > 0))
     {
       for (i = optind; i < argc; i++)
        {
+          int relative = 0;
+
          if (eval)
-           ; /* Don't prepend any cwd or anything like that.  */
-         else if (*argv[i] == '+')
-           {
+            {
+              /* Don't prepend any cwd or anything like that.  */
+              fprintf (out, "-eval ");
+              quote_argument (argv[i], out);
+              fprintf (out, " ");
+              continue;
+            }
+
+          if (*argv[i] == '+')
+            {
              char *p = argv[i] + 1;
              while (isdigit ((unsigned char) *p) || *p == ':') p++;
-             if (*p != 0)
-               {
-                 quote_file_name (cwd, out);
-                 fprintf (out, "/");
-               }
-           }
-         else if (*argv[i] != '/')
-           {
-             quote_file_name (cwd, out);
-             fprintf (out, "/");
-           }
-
-         quote_file_name (argv[i], out);
-         fprintf (out, " ");
-       }
+             if (*p == 0)
+                {
+                  fprintf (out, "-position ");
+                  quote_argument (argv[i], out);
+                  fprintf (out, " ");
+                  continue;
+                }
+              else
+                relative = 1;
+            }
+          else if (*argv[i] != '/')
+            relative = 1;
+
+          fprintf (out, "-file ");
+          if (relative)
+            {
+              quote_argument (cwd, out);
+              fprintf (out, "/");
+            }
+          quote_argument (argv[i], out);
+          fprintf (out, " ");
+        }
     }
   else
     {
-      while ((str = fgets (string, BUFSIZ, stdin)))
-       {
-         quote_file_name (str, out);
-       }
-      fprintf (out, " ");
+      if (!tty && !window_system)
+        {
+          while ((str = fgets (string, BUFSIZ, stdin)))
+            {
+              if (eval)
+                fprintf (out, "-eval ");
+              else
+                fprintf (out, "-file ");
+              quote_argument (str, out);
+            }
+          fprintf (out, " ");
+        }
     }
 
   fprintf (out, "\n");
   fflush (out);
+  fsync (fileno (out));
 
-  /* Maybe wait for an answer.   */
-  if (nowait)
-    return EXIT_SUCCESS;
-
-  if (!eval)
+  /* Wait for an answer. */
+  if (!eval && !tty && !nowait)
     {
       printf ("Waiting for Emacs...");
       needlf = 2;
     }
   fflush (stdout);
+  fsync (1);
 
   /* Now, wait for an answer and print any messages.  */
   while ((str = fgets (string, BUFSIZ, in)))
     {
-      if (needlf == 2)
-       printf ("\n");
-      printf ("%s", str);
-      needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
+      char *p = str + strlen (str) - 1;
+      while (p > str && *p == '\n')
+        *p-- = 0;
+
+      if (strprefix ("-good-version ", str))
+        {
+          /* -good-version: The versions match. */
+        }
+      else if (strprefix ("-emacs-pid ", str))
+        {
+          /* -emacs-pid PID: The process id of the Emacs process. */
+          emacs_pid = strtol (string + strlen ("-emacs-pid"), NULL, 10);
+        }
+      else if (strprefix ("-window-system-unsupported ", str))
+        {
+          /* -window-system-unsupported: Emacs was compiled without X
+              support.  Try again on the terminal. */
+          window_system = 0;
+          nowait = 0;
+          tty = 1;
+          goto retry;
+        }
+      else if (strprefix ("-print ", str))
+        {
+          /* -print STRING: Print STRING on the terminal. */
+          str = unquote_argument (str + strlen ("-print "));
+          if (needlf)
+            printf ("\n");
+          printf ("%s", str);
+          needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
+        }
+      else if (strprefix ("-error ", str))
+        {
+          /* -error DESCRIPTION: Signal an error on the terminal. */
+          str = unquote_argument (str + strlen ("-error "));
+          if (needlf)
+            printf ("\n");
+          printf ("*ERROR*: %s", str);
+          needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
+        }
+      else if (strprefix ("-suspend ", str))
+        {
+          /* -suspend: Suspend this terminal, i.e., stop the process. */
+          if (needlf)
+            printf ("\n");
+          needlf = 0;
+          kill (0, SIGSTOP);
+        }
+      else
+        {
+          /* Unknown command. */
+          if (needlf)
+            printf ("\n");
+          printf ("*ERROR*: Unknown message: %s", str);
+          needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
+        }
     }
 
   if (needlf)
     printf ("\n");
   fflush (stdout);
+  fsync (1);
 
   return EXIT_SUCCESS;
 }
index 1e19592500b69d7f5d7f507095afc8d9a22fd603..7c932efd57c52ac043092f61d1e1514bb33893fe 100644 (file)
@@ -217,7 +217,7 @@ Major modes that edit things other than ordinary files may change this
 
 (make-variable-buffer-local 'mode-line-buffer-identification)
 
-(defvar mode-line-frame-identification '("-%F  ")
+(defvar mode-line-frame-identification '(window-system "  " "-%F  ")
   "Mode-line control to describe the current frame.")
 
 (defvar mode-line-process nil "\
index 6eaaf97288d42c7824f91d900c47f2c7f630d46b..74162c68eb2242980b27f5c5d8e604eb69ac585f 100644 (file)
     (when (fboundp 'facep)
       (unless (facep face)
        ;; If the user has already created the face, respect that.
-       (let ((value (or (get face 'saved-face) spec)))
+       (let ((value (or (get face 'saved-face) spec))
+             (have-window-system (memq initial-window-system '(x w32))))
          ;; Create global face.
          (make-empty-face face)
          ;; Create frame-local faces
          (dolist (frame (frame-list))
-           (face-spec-set face value frame)))
-       ;; When making a face after frames already exist
-       (if (memq window-system '(x w32))
-           (make-face-x-resource-internal face))))
+           (face-spec-set face value frame)
+           (when (memq (window-system frame) '(x w32))
+             (setq have-window-system t)))
+         ;; When making a face after frames already exist
+         (if have-window-system
+             (make-face-x-resource-internal face)))))
     ;; Don't record SPEC until we see it causes no errors.
     (put face 'face-defface-spec spec)
     (push (cons 'defface face) current-load-list)
index 137ea510123ed9ca764f030b69f76a01d4302c58..f340c70a11ae7d8a626588dd8439b3d947d730aa 100644 (file)
@@ -144,17 +144,18 @@ but not `C-u X' or `ESC X' since the X is not the prefix key."
   (if enable-flag
       (progn
        ;; Set up key-translation-map as indicated by `double-map'.
-       (kill-local-variable 'key-translation-map)
-       (make-local-variable 'key-translation-map)
-       (setq key-translation-map (if (keymapp key-translation-map)
-                                     (copy-keymap key-translation-map)
-                                   (make-sparse-keymap)))
+       ;; XXX I don't think global-key-translation-map should be made local here. -- Lorentey
+       (kill-local-variable 'global-key-translation-map)
+       (make-local-variable 'global-key-translation-map)
+       (setq global-key-translation-map (if (keymapp global-key-translation-map)
+                                            (copy-keymap global-key-translation-map)
+                                          (make-sparse-keymap)))
        (mapcar (function (lambda (entry)
-                           (define-key key-translation-map
+                           (define-key global-key-translation-map
                              (vector (nth 0 entry))
                              'double-translate-key)))
                (append double-map '((magic-start) (magic-end)))))
-    (kill-local-variable 'key-translation-map)))
+    (kill-local-variable 'global-key-translation-map)))
 
 ;;; Mode
 
index 35ec7ad24a5a0883f85f869afbd1056cb408e2ad..c7f1f2fc2f7a7a8ad1aa93b12e5f459812a5bd31 100644 (file)
@@ -932,7 +932,7 @@ an integer value."
   (let ((valid
          (case attribute
            (:family
-            (if window-system
+            (if (window-system frame)
                 (mapcar #'(lambda (x) (cons (car x) (car x)))
                         (x-font-family-list))
              ;; Only one font on TTYs.
@@ -941,7 +941,7 @@ an integer value."
             (mapcar #'(lambda (x) (cons (symbol-name x) x))
                     (internal-lisp-face-attribute-values attribute)))
            ((:underline :overline :strike-through :box)
-            (if window-system
+            (if (window-system frame)
                 (nconc (mapcar #'(lambda (x) (cons (symbol-name x) x))
                                (internal-lisp-face-attribute-values attribute))
                        (mapcar #'(lambda (c) (cons c c))
@@ -954,7 +954,7 @@ an integer value."
            ((:height)
             'integerp)
            (:stipple
-            (and (memq window-system '(x w32 mac))
+            (and (memq (window-system frame) '(x w32 mac))
                  (mapcar #'list
                          (apply #'nconc
                                 (mapcar (lambda (dir)
@@ -1072,7 +1072,7 @@ of a global face.  Value is the new attribute value."
               ;; explicitly in VALID, using color approximation code
               ;; in tty-colors.el.
               (when (and (memq attribute '(:foreground :background))
-                         (not (memq window-system '(x w32 mac)))
+                         (not (memq (window-system frame) '(x w32 mac)))
                          (not (member new-value
                                       '("unspecified"
                                         "unspecified-fg" "unspecified-bg"))))
@@ -1359,14 +1359,14 @@ If FRAME is nil, the current FRAME is used."
            req (car conjunct)
            options (cdr conjunct)
            match (cond ((eq req 'type)
-                        (or (memq window-system options)
+                        (or (memq (window-system frame) options)
                             ;; FIXME: This should be revisited to use
                             ;; display-graphic-p, provided that the
                             ;; color selection depends on the number
                             ;; of supported colors, and all defface's
                             ;; are changed to look at number of colors
                             ;; instead of (type graphic) etc.
-                            (and (null window-system)
+                            (and (null (window-system frame))
                                  (memq 'tty options))
                             (and (memq 'motif options)
                                  (featurep 'motif))
@@ -1579,35 +1579,38 @@ this won't have the expected effect."
                 (choice-item light)
                 (choice-item :tag "default" nil)))
 
-(defvar default-frame-background-mode nil
-  "Internal variable for the default brightness of the background.
-Emacs sets it automatically depending on the terminal type.
-The value `nil' means `dark'.  If Emacs runs in non-windowed
-mode from `xterm' or a similar terminal emulator, the value is
-`light'.  On rxvt terminals, the value depends on the environment
-variable COLORFGBG.")
 
 (defun frame-set-background-mode (frame)
   "Set up display-dependent faces on FRAME.
 Display-dependent faces are those which have different definitions
 according to the `background-mode' and `display-type' frame parameters."
   (let* ((bg-resource
-         (and window-system
+         (and (window-system frame)
               (x-get-resource "backgroundMode" "BackgroundMode")))
         (bg-color (frame-parameter frame 'background-color))
+        (tty-type (frame-parameter frame 'tty-type))
         (bg-mode
          (cond (frame-background-mode)
                (bg-resource
                 (intern (downcase bg-resource)))
-               ((and (null window-system) (null bg-color))
-                ;; No way to determine this automatically (?).
-                (or default-frame-background-mode 'dark))
-               ;; Unspecified frame background color can only happen
-               ;; on tty's.
-               ((member bg-color '(unspecified "unspecified-bg"))
-                (or default-frame-background-mode 'dark))
+               ((and (null (window-system frame))
+                     ;; Unspecified frame background color can only
+                     ;; happen on tty's.
+                     (member bg-color '(nil unspecified "unspecified-bg")))
+                ;; There is no way to determine the background mode
+                ;; automatically, so we make a guess based on the
+                ;; terminal type.
+                (if (and tty-type
+                         (string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)"
+                                       tty-type))
+                    'light
+                  'dark))
                ((equal bg-color "unspecified-fg") ; inverted colors
-                (if (eq default-frame-background-mode 'light) 'dark 'light))
+                (if (and tty-type
+                         (string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)"
+                                       tty-type))
+                    'dark
+                  'light))
                ((>= (apply '+ (x-color-values bg-color frame))
                    ;; Just looking at the screen, colors whose
                    ;; values add up to .6 of the white total
@@ -1616,7 +1619,7 @@ according to the `background-mode' and `display-type' frame parameters."
                 'light)
                (t 'dark)))
         (display-type
-         (cond ((null window-system)
+         (cond ((null (window-system frame))
                 (if (tty-display-color-p frame) 'color 'mono))
                ((x-display-color-p frame)
                 'color)
@@ -1713,16 +1716,22 @@ Value is the new frame created."
   (setq parameters (x-handle-named-frame-geometry parameters))
   (let ((visibility-spec (assq 'visibility parameters))
        (frame-list (frame-list))
-       (frame (x-create-frame (cons '(visibility . nil) parameters)))
+       (frame (x-create-frame `((visibility . nil) . ,parameters)))
        success)
     (unwind-protect
        (progn
+         (x-setup-function-keys frame)
          (x-handle-reverse-video frame parameters)
          (frame-set-background-mode frame)
          (face-set-after-frame-default frame)
          (if (or (null frame-list) (null visibility-spec))
              (make-frame-visible frame)
            (modify-frame-parameters frame (list visibility-spec)))
+         ;; Arrange for the kill and yank functions to set and check the clipboard.
+         (modify-frame-parameters
+          frame '((interprogram-cut-function . x-select-text)))
+         (modify-frame-parameters
+          frame '((interprogram-paste-function . x-cut-buffer-or-selection-value)))
          (setq success t))
       (unless success
        (delete-frame frame)))
@@ -1751,7 +1760,7 @@ Initialize colors of certain faces from frame parameters."
        (when (not (equal face 'default))
          (face-spec-set face (face-user-default-spec face) frame)
          (internal-merge-in-global-face face frame)
-         (when (and (memq window-system '(x w32 mac))
+         (when (and (memq (window-system frame) '(x w32 mac))
                     (or (not (boundp 'inhibit-default-face-x-resources))
                         (not (eq face 'default))))
            (make-face-x-resource-internal face frame)))
@@ -1802,10 +1811,26 @@ created."
   (let ((frame (make-terminal-frame parameters))
        success)
     (unwind-protect
-       (progn
+       (with-selected-frame frame
          (tty-handle-reverse-video frame (frame-parameters frame))
          (frame-set-background-mode frame)
          (face-set-after-frame-default frame)
+         ;; Load library for our terminal type.
+         ;; User init file can set term-file-prefix to nil to prevent this.
+         (unless (null term-file-prefix)
+           (let ((term (cdr (assq 'tty-type parameters)))
+                 hyphend)
+             (while (and term
+                         (not (load (concat term-file-prefix term) t t)))
+               ;; Strip off last hyphen and what follows, then try again
+               (setq term
+                     (if (setq hyphend (string-match "[-_][^-_]+$" term))
+                         (substring term 0 hyphend)
+                       nil)))))
+         ;; Make sure the kill and yank functions do not touch the X clipboard.
+         (modify-frame-parameters frame '((interprogram-cut-function . nil)))
+         (modify-frame-parameters frame '((interprogram-paste-function . nil)))
+         (set-locale-environment nil frame)
          (setq success t))
       (unless success
        (delete-frame frame)))
index 1840d3e5f065ff203efdf779d62d813b430f0147..4490ede640472851b12f8bb19c3d759e15f4d17f 100644 (file)
@@ -4864,7 +4864,7 @@ With prefix arg, silently save all file-visiting buffers, then kill."
 (define-key ctl-x-map "i" 'insert-file)
 (define-key esc-map "~" 'not-modified)
 (define-key ctl-x-map "\C-d" 'list-directory)
-(define-key ctl-x-map "\C-c" 'save-buffers-kill-emacs)
+(define-key ctl-x-map "\C-c" 'server-save-buffers-kill-display)
 (define-key ctl-x-map "\C-q" 'toggle-read-only)
 
 (define-key ctl-x-4-map "f" 'find-file-other-window)
index a1b30292e6131ef859d3060cc3b864392b4066cb..1258609f9a6b9606a862c83c08c2c8cc1ae10a80 100644 (file)
@@ -2041,7 +2041,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
                 "with-current-buffer" "with-electric-help"
                 "with-local-quit" "with-no-warnings"
                 "with-output-to-string" "with-output-to-temp-buffer"
-                "with-selected-window" "with-syntax-table"
+                "with-selected-window" "with-selected-frame" "with-syntax-table"
                 "with-temp-buffer" "with-temp-file" "with-temp-message"
                 "with-timeout" "with-timeout-handler") t)
          "\\>")
index 088a7a9b622d8fc9278aef9092a8c005c1d15622..ac9b1ad6df489f65e5c89ec689be7acb2d981f4d 100644 (file)
 
 ;;; Code:
 
-(defvar frame-creation-function nil
-  "Window-system dependent function to call to create a new frame.
-The window system startup file should set this to its frame creation
-function, which should take an alist of parameters as its argument.")
+(defvar frame-creation-function-alist
+  (list (cons nil
+             (if (fboundp 'tty-create-frame-with-faces)
+                 'tty-create-frame-with-faces
+               (function
+                (lambda (parameters)
+                  (error "Can't create multiple frames without a window system"))))))
+  "Alist of window-system dependent functions to call to create a new frame.
+The window system startup file should add its frame creation
+function to this list, which should take an alist of parameters
+as its argument.")
+
+(defvar window-system-default-frame-alist nil
+  "Alist of window-system dependent default frame parameters.
+These may be set in your init file, like this:
+
+    ;; Disable menubar and toolbar on the console, but enable them under X.
+    (setq window-system-default-frame-alist
+          '((x (menu-bar-lines . 1) (tool-bar-lines . 1))
+            (nil (menu-bar-lines . 0) (tool-bar-lines . 0))))
+
+Also see `default-frame-alist'.")
 
 ;; The initial value given here used to ask for a minibuffer.
 ;; But that's not necessary, because the default is to have one.
@@ -189,7 +207,9 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
 (defun frame-initialize ()
   "Create an initial frame if necessary."
   ;; Are we actually running under a window system at all?
-  (if (and window-system (not noninteractive) (not (eq window-system 'pc)))
+  (if (and initial-window-system
+          (not noninteractive)
+          (not (eq initial-window-system 'pc)))
       (progn
        ;; Turn on special-display processing only if there's a window system.
        (setq special-display-function 'special-display-popup-frame)
@@ -206,6 +226,9 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
                  (setq frame-initial-frame-alist
                        (cons '(horizontal-scroll-bars . t)
                              frame-initial-frame-alist)))
+             (setq frame-initial-frame-alist
+                   (cons (cons 'window-system initial-window-system)
+                         frame-initial-frame-alist))
              (setq default-minibuffer-frame
                    (setq frame-initial-frame
                          (make-frame frame-initial-frame-alist)))
@@ -218,18 +241,7 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
        ;; At this point, we know that we have a frame open, so we
        ;; can delete the terminal frame.
        (delete-frame terminal-frame)
-       (setq terminal-frame nil))
-
-    ;; No, we're not running a window system.  Use make-terminal-frame if
-    ;; we support that feature, otherwise arrange to cause errors.
-    (or (eq window-system 'pc)
-       (setq frame-creation-function
-             (if (fboundp 'tty-create-frame-with-faces)
-                 'tty-create-frame-with-faces
-               (function
-                (lambda (parameters)
-                  (error
-                   "Can't create multiple frames without a window system"))))))))
+       (setq terminal-frame nil))))
 
 (defvar frame-notice-user-settings t
   "Non-nil means function `frame-notice-user-settings' wasn't run yet.")
@@ -279,7 +291,7 @@ React to settings of `default-frame-alist', `initial-frame-alist' there."
        ;; Can't modify the minibuffer parameter, so don't try.
        (setq parms (delq (assq 'minibuffer parms) parms))
        (modify-frame-parameters nil
-                                (if (null window-system)
+                                (if (null initial-window-system)
                                     (append initial-frame-alist
                                             default-frame-alist
                                             parms
@@ -288,7 +300,7 @@ React to settings of `default-frame-alist', `initial-frame-alist' there."
                                   ;; default-frame-alist were already
                                   ;; applied in pc-win.el.
                                   parms))
-       (if (null window-system) ;; MS-DOS does this differently in pc-win.el
+       (if (null initial-window-system) ;; MS-DOS does this differently in pc-win.el
            (let ((newparms (frame-parameters))
                  (frame (selected-frame)))
              (tty-handle-reverse-video frame newparms)
@@ -567,12 +579,25 @@ is not considered (see `next-frame')."
   (select-frame-set-input-focus (selected-frame)))
 
 (defun make-frame-on-display (display &optional parameters)
-  "Make a frame on display DISPLAY.
+  "Make a frame on display DISPLAY.
 The optional second argument PARAMETERS specifies additional frame parameters."
   (interactive "sMake frame on display: ")
   (or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display)
       (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN"))
-  (make-frame (cons (cons 'display display) parameters)))
+  (when (and (boundp 'x-initialized) (not x-initialized))
+    (setq x-display-name display)
+    (x-initialize-window-system))
+  (make-frame `((window-system . x) (display . ,display) . ,parameters)))
+
+(defun make-frame-on-tty (device type &optional parameters)
+  "Make a frame on terminal DEVICE which is of type TYPE (e.g., \"xterm\").
+The optional third argument PARAMETERS specifies additional frame parameters."
+  (interactive "fOpen frame on tty device: \nsTerminal type of %s: ")
+  (unless device
+    (error "Invalid terminal device"))
+  (unless type
+    (error "Invalid terminal type"))
+  (make-frame `((window-system . nil) (tty . ,device) (tty-type . ,type) . ,parameters)))
 
 (defun make-frame-command ()
   "Make a new frame, and select it if the terminal displays only one frame."
@@ -612,7 +637,12 @@ You cannot specify either `width' or `height', you must use neither or both.
  (minibuffer . only)   The frame should contain only a minibuffer.
  (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window.
 
-Before the frame is created (via `frame-creation-function'), functions on the
+ (window-system . nil) The frame should be displayed on a terminal device.
+ (window-system . x)   The frame should be displayed in an X window.
+
+ (display-id . ID)      The frame should use the display identified by ID.
+
+Before the frame is created (via `frame-creation-function-alist'), functions on the
 hook `before-make-frame-hook' are run.  After the frame is created, functions
 on `after-make-frame-functions' are run with one arg, the newly created frame.
 
@@ -622,8 +652,24 @@ window system may select the new frame for its own reasons, for
 instance if the frame appears under the mouse pointer and your
 setup is for focus to follow the pointer."
   (interactive)
-  (run-hooks 'before-make-frame-hook)
-  (let ((frame (funcall frame-creation-function parameters)))
+  (let* ((w (cond
+            ((assq 'display-id parameters)
+             (let ((type (display-live-p (cdr (assq 'display-id parameters)))))
+               (cond
+                ((eq type t) nil)
+                ((eq type nil) (error "Display %s does not exist" (cdr (assq 'display-id parameters))))
+                (t type))))
+            ((assq 'window-system parameters)
+             (cdr (assq 'window-system parameters)))
+            (t window-system)))
+        (frame-creation-function (cdr (assq w frame-creation-function-alist)))
+        frame)
+    (unless frame-creation-function
+      (error "Don't know how to create a frame on window system %s" w))
+    (run-hooks 'before-make-frame-hook)
+    (setq frame (funcall frame-creation-function parameters))
+    (modify-frame-parameters frame
+                            (cdr (assq w window-system-default-frame-alist)))
     (run-hook-with-args 'after-make-frame-functions frame)
     frame))
 
@@ -645,20 +691,25 @@ setup is for focus to follow the pointer."
 
 (defun frames-on-display-list (&optional display)
   "Return a list of all frames on DISPLAY.
-DISPLAY is a name of a display, a string of the form HOST:SERVER.SCREEN.
+
+DISPLAY should be a display identifier (an integer), but it may
+also be a name of a display, a string of the form HOST:SERVER.SCREEN.
+
 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
-  (let* ((display (or display (frame-parameter nil 'display)))
+  (let* ((display (or display (frame-display)))
         (func #'(lambda (frame)
-                  (equal (frame-parameter frame 'display) display))))
+                  (or (eq (frame-display frame) display)
+                      (equal (frame-parameter frame 'display) display)))))
     (filtered-frame-list func)))
 
 (defun framep-on-display (&optional display)
   "Return the type of frames on DISPLAY.
-DISPLAY may be a display name or a frame.  If it is a frame, its type is
-returned.
+DISPLAY may be a display id, a display name or a frame.  If it is
+a frame, its type is returned.
 If DISPLAY is omitted or nil, it defaults to the selected frame's display.
 All frames on a given display are of the same type."
-  (or (framep display)
+  (or (display-live-p display)
+      (framep display)
       (framep (car (frames-on-display-list display)))))
 
 (defun frame-remove-geometry-params (param-list)
@@ -696,9 +747,9 @@ automatically."
     (select-frame frame)
     (raise-frame frame)
     ;; Ensure, if possible, that frame gets input focus.
-    (cond ((eq window-system 'x)
+    (cond ((eq (window-system frame) 'x)
           (x-focus-frame frame))
-         ((eq window-system 'w32)
+         ((eq (window-system frame) 'w32)
           (w32-focus-frame frame)))
     (cond (focus-follows-mouse
           (set-mouse-position (selected-frame) (1- (frame-width)) 0))))
@@ -735,6 +786,22 @@ Otherwise, that variable should be nil."
       (iconify-frame)
     (make-frame-visible)))
 
+(defun suspend-frame ()
+  "Do whatever is right to suspend the current frame.
+Calls `suspend-emacs' if invoked from the controlling terminal,
+`suspend-tty' from a secondary terminal, and
+`iconify-or-deiconify-frame' from an X frame."
+  (interactive)
+  (let ((type (framep (selected-frame))))
+    (cond
+     ((eq type 'x) (iconify-or-deiconify-frame))
+     ((eq type t)
+      (if (display-controlling-tty-p)
+         (suspend-emacs)
+       (suspend-tty)))
+     (t (suspend-emacs)))))
+
+
 (defun make-frame-names-alist ()
   (let* ((current-frame (selected-frame))
         (falist
@@ -768,9 +835,9 @@ If there is no frame by that name, signal an error."
     (raise-frame frame)
     (select-frame frame)
     ;; Ensure, if possible, that frame gets input focus.
-    (cond ((eq window-system 'x)
+    (cond ((eq (window-system frame) 'x)
           (x-focus-frame frame))
-         ((eq window-system 'w32)
+         ((eq (window-system frame) 'w32)
           (w32-focus-frame frame)))
     (when focus-follows-mouse
       (set-mouse-position frame (1- (frame-width frame)) 0))))
@@ -980,6 +1047,10 @@ bars (top, bottom, or nil)."
     (cons vert hor)))
 \f
 ;;;; Frame/display capabilities.
+(defun selected-display ()
+  "Return the display that is now selected."
+  (frame-display (selected-frame)))
+
 (defun display-mouse-p (&optional display)
   "Return non-nil if DISPLAY has a mouse available.
 DISPLAY can be a display name, a frame, or nil (meaning the selected
@@ -1131,7 +1202,7 @@ the question is inapplicable to a certain kind of display."
      ((eq frame-type 'pc)
       16)
      (t
-      (tty-display-color-cells)))))
+      (tty-display-color-cells display)))))
 
 (defun display-visual-class (&optional display)
   "Returns the visual class of DISPLAY.
@@ -1272,7 +1343,7 @@ cursor display.  On a text-only terminal, this is not implemented."
   :init-value (not (or noninteractive
                       (if (boundp 'no-blinking-cursor) no-blinking-cursor)
                       (eq system-type 'ms-dos)
-                      (not (memq window-system '(x w32)))))
+                      (not (memq initial-window-system '(x w32)))))
   :group 'cursor
   :global t
   (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
@@ -1354,6 +1425,8 @@ Use Custom to set this variable to get the display updated."
 (define-key ctl-x-5-map "0" 'delete-frame)
 (define-key ctl-x-5-map "o" 'other-frame)
 
+(substitute-key-definition 'suspend-emacs 'suspend-frame global-map)
+
 (provide 'frame)
 
 ;; arch-tag: 82979c70-b8f2-4306-b2ad-ddbd6b328b56
index 6160391df95ed8327254e631ee903fff0a0bd5a2..58a633e179761bc3547186cd7c3ee288ec3570c3 100644 (file)
@@ -498,10 +498,11 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be bound."
       0))
 
 ;;;###autoload
-(defun describe-variable (variable &optional buffer)
+(defun describe-variable (variable &optional buffer frame)
   "Display the full documentation of VARIABLE (a symbol).
 Returns the documentation as a string, also.
-If VARIABLE has a buffer-local value in BUFFER (default to the current buffer),
+If VARIABLE has a buffer-local value in BUFFER or FRAME
+\(default to the current buffer and current frame),
 it is displayed along with the global value."
   (interactive
    (let ((v (variable-at-point))
@@ -516,13 +517,19 @@ it is displayed along with the global value."
      (list (if (equal val "")
               v (intern val)))))
   (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
+  (unless (frame-live-p frame) (setq frame (selected-frame)))
   (if (not (symbolp variable))
       (message "You did not specify a variable")
     (save-excursion
-      (let* ((valvoid (not (with-current-buffer buffer (boundp variable))))
-            ;; Extract the value before setting up the output buffer,
-            ;; in case `buffer' *is* the output buffer.
-            (val (unless valvoid (buffer-local-value variable buffer))))
+      (let ((valvoid (not (with-current-buffer buffer (boundp variable))))
+           val locus)
+       ;; Extract the value before setting up the output buffer,
+       ;; in case `buffer' *is* the output buffer.
+       (unless valvoid
+         (with-selected-frame frame
+           (with-current-buffer buffer
+             (setq val (symbol-value variable)
+                   locus (variable-binding-locus variable)))))
        (help-setup-xref (list #'describe-variable variable buffer)
                         (interactive-p))
        (with-output-to-temp-buffer (help-buffer)
@@ -541,11 +548,13 @@ it is displayed along with the global value."
                  (if (< (point) (+ from 20))
                      (delete-region (1- from) from)))))
            (terpri)
-           (when (local-variable-p variable)
-             (princ (format "%socal in buffer %s; "
-                            (if (get variable 'permanent-local)
-                                "Permanently l" "L")
-                            (buffer-name)))
+           (when locus
+             (if (bufferp locus)
+                 (princ (format "%socal in buffer %s; "
+                                (if (get variable 'permanent-local)
+                                    "Permanently l" "L")
+                                (buffer-name)))
+               (princ (format "It is a frame-local variable; ")))
              (if (not (default-boundp variable))
                  (princ "globally void")
                (let ((val (default-value variable)))
index 3acb1cfd648340ae577e0540201bc593e5c0f23c..99a450c7f07574f57670704ba824c9282db50d0d 100644 (file)
@@ -173,7 +173,7 @@ The following key sequence may cause multilingual text insertion."
       (setq str (format "%s%c" str (read-char-exclusive))))
     (vector (aref result 0))))
 
-(defun encoded-kbd-setup-keymap (coding)
+(defun encoded-kbd-setup-keymap (keymap coding)
   ;; At first, reset the keymap.
   (define-key encoded-kbd-mode-map "\e" nil)
   ;; Then setup the keymap according to the keyboard coding system.
@@ -181,7 +181,7 @@ The following key sequence may cause multilingual text insertion."
    ((eq (coding-system-type coding) 1) ; SJIS
     (let ((i 128))
       (while (< i 256)
-       (define-key key-translation-map
+       (define-key keymap
          (vector i) 'encoded-kbd-self-insert-sjis)
        (setq i (1+ i))))
     8)
@@ -189,7 +189,7 @@ The following key sequence may cause multilingual text insertion."
    ((eq (coding-system-type coding) 3) ; Big5
     (let ((i 161))
       (while (< i 255)
-       (define-key key-translation-map
+       (define-key keymap
          (vector i) 'encoded-kbd-self-insert-big5)
        (setq i (1+ i))))
     8)
@@ -215,20 +215,20 @@ The following key sequence may cause multilingual text insertion."
            (aset encoded-kbd-iso2022-invocations 1 1))
        (when use-designation
          (define-key encoded-kbd-mode-map "\e" 'encoded-kbd-iso2022-esc-prefix)
-         (define-key key-translation-map "\e" 'encoded-kbd-iso2022-esc-prefix))
+         (define-key keymap "\e" 'encoded-kbd-iso2022-esc-prefix))
        (when (or (aref flags 2) (aref flags 3))
-         (define-key key-translation-map
+         (define-key keymap
            [?\216] 'encoded-kbd-iso2022-single-shift)
-         (define-key key-translation-map
+         (define-key keymap
            [?\217] 'encoded-kbd-iso2022-single-shift))
        (or (eq (aref flags 0) 'ascii)
            (dotimes (i 96)
-             (define-key key-translation-map
+             (define-key keymap
                (vector (+ 32 i)) 'encoded-kbd-self-insert-iso2022-7bit)))
        (if (aref flags 7)
            t
          (dotimes (i 96)
-           (define-key key-translation-map
+           (define-key keymap
              (vector (+ 160 i)) 'encoded-kbd-self-insert-iso2022-8bit))
          8))))
 
@@ -243,7 +243,7 @@ The following key sequence may cause multilingual text insertion."
          (setq from (setq to elt)))
        (while (<= from to)
          (if (>= from 128)
-             (define-key key-translation-map
+             (define-key keymap
                (vector from) 'encoded-kbd-self-insert-ccl))
          (setq from (1+ from))))
       8))
@@ -251,59 +251,51 @@ The following key sequence may cause multilingual text insertion."
    (t
     nil)))
 
-;; key-translation-map at the time Encoded-kbd mode is turned on is
-;; saved here.
-(defvar saved-key-translation-map nil)
-
 ;; Input mode at the time Encoded-kbd mode is turned on is saved here.
+;; XXX This should be made display-local somehow.
 (defvar saved-input-mode nil)
 
-(put 'encoded-kbd-mode 'permanent-local t)
 ;;;###autoload
-(define-minor-mode encoded-kbd-mode
-  "Toggle Encoded-kbd minor mode.
-With arg, turn Encoded-kbd mode on if and only if arg is positive.
-
-You should not turn this mode on manually, instead use the command
-\\[set-keyboard-coding-system] which turns on or off this mode
-automatically.
-
-In Encoded-kbd mode, a text sent from keyboard is accepted
-as a multilingual text encoded in a coding system set by
-\\[set-keyboard-coding-system]."
-  :global t :group 'keyboard :group 'mule
-
-  (if encoded-kbd-mode
-      ;; We are turning on Encoded-kbd mode.
-      (let ((coding (keyboard-coding-system))
-           result)
-       (or saved-key-translation-map
-           (if (keymapp key-translation-map)
-               (setq saved-key-translation-map
-                     (copy-keymap key-translation-map))
-             (setq key-translation-map (make-sparse-keymap))))
-       (or saved-input-mode
-           (setq saved-input-mode
-                 (current-input-mode)))
-       (setq result (and coding (encoded-kbd-setup-keymap coding)))
-       (if result
-           (if (eq result 8)
-               (set-input-mode
-                (nth 0 saved-input-mode) 
-                (nth 1 saved-input-mode)
-                'use-8th-bit
-                (nth 3 saved-input-mode)))
-         (setq encoded-kbd-mode nil
-               saved-key-translation-map nil
-               saved-input-mode nil)
-         (error "Unsupported coding system in Encoded-kbd mode: %S"
-                coding)))
-
-    ;; We are turning off Encoded-kbd mode.
-    (setq key-translation-map saved-key-translation-map
-         saved-key-translation-map nil)
-    (apply 'set-input-mode saved-input-mode)
-    (setq saved-input-mode nil)))
+(defun encoded-kbd-setup-display (display)
+  "Set up a `key-translation-map' for `keyboard-coding-system' on DISPLAY.
+
+DISPLAY may be a display id, a frame, or nil for the selected frame's display."
+  (let ((frame (if (framep display) display (car (frames-on-display-list display)))))
+    (when frame
+      (with-selected-frame frame
+       ;; Remove any previous encoded-kb keymap from key-translation-map.
+       (let ((m (terminal-local-value 'key-translation-map frame)))
+         (if (equal (keymap-prompt m) "encoded-kb")
+             (set-terminal-local-value 'key-translation-map frame (keymap-parent m))
+           (while (keymap-parent m)
+             (if (equal (keymap-prompt (keymap-parent m)) "encoded-kb")
+                 (set-keymap-parent m (keymap-parent (keymap-parent m))))
+             (setq m (keymap-parent m)))))
+
+       (if (keyboard-coding-system)
+           ;; We are turning on Encoded-kbd mode.
+           (let ((coding (keyboard-coding-system))
+                 (keymap (make-sparse-keymap "encoded-kb"))
+                 result)
+             (set-keymap-parent keymap (terminal-local-value 'key-translation-map frame))
+             (set-terminal-local-value 'key-translation-map frame keymap)
+             (or saved-input-mode
+                 (setq saved-input-mode (current-input-mode)))
+             (setq result (and coding (encoded-kbd-setup-keymap keymap coding)))
+             (if result
+                 (if (eq result 8)
+                     (set-input-mode
+                      (nth 0 saved-input-mode)
+                      (nth 1 saved-input-mode)
+                      'use-8th-bit
+                      (nth 3 saved-input-mode)))
+               (setq saved-input-mode nil)
+               (error "Unsupported coding system in Encoded-kbd mode: %S"
+                      coding)))
+         ;; We are turning off Encoded-kbd mode.
+         (and saved-input-mode
+              (apply 'set-input-mode saved-input-mode))
+         (setq saved-input-mode nil))))))
 
 (provide 'encoded-kb)
 
index b5fcd750d270db2e3dd862bc212b49298cfeeca0..60ad205085a4391f3b8bd9ebf0047b75a317e0af 100644 (file)
@@ -41,8 +41,8 @@
 ;;; Code:
 
 ;;; Provide some binding for startup:
-;;;###autoload (or key-translation-map (setq key-translation-map (make-sparse-keymap)))
-;;;###autoload (define-key key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
+;;;###autoload (or global-key-translation-map (setq global-key-translation-map (make-sparse-keymap)))
+;;;###autoload (define-key global-key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
 ;;;###autoload (autoload 'iso-transl-ctl-x-8-map "iso-transl" "Keymap for C-x 8 prefix." t 'keymap)
 
 (defvar iso-transl-dead-key-alist
@@ -245,9 +245,9 @@ sequence VECTOR.  (VECTOR is normally one character long.)")
 (or iso-transl-ctl-x-8-map
     (fset 'iso-transl-ctl-x-8-map
          (setq iso-transl-ctl-x-8-map (make-sparse-keymap))))
-(or key-translation-map
-    (setq key-translation-map (make-sparse-keymap)))
-(define-key key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
+(or global-key-translation-map
+    (setq global-key-translation-map (make-sparse-keymap)))
+(define-key global-key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
 
 ;; For each entry in the alist, we'll make up to three ways to generate
 ;; the character in question: the prefix `C-x 8'; the ALT modifier on
@@ -263,7 +263,7 @@ sequence VECTOR.  (VECTOR is normally one character long.)")
            (vec (vconcat (car (car alist))))
            (tail iso-transl-dead-key-alist))
        (aset vec 0 (logior (aref vec 0) ?\A-\^@))
-       (define-key key-translation-map vec translated-vec)
+       (define-key global-key-translation-map vec translated-vec)
        (define-key isearch-mode-map (vector (aref vec 0)) nil)
        (while tail
          (if (eq (car (car tail)) inchar)
@@ -271,7 +271,7 @@ sequence VECTOR.  (VECTOR is normally one character long.)")
                    (deadkey (cdr (car tail))))
                (aset deadvec 0 deadkey)
                (define-key isearch-mode-map (vector deadkey) nil)
-               (define-key key-translation-map deadvec translated-vec)))
+               (define-key global-key-translation-map deadvec translated-vec)))
          (setq tail (cdr tail)))))
     (setq alist (cdr alist))))
 
index bb69dbda1550ae353aa8cf1e3b59ba3ddf275425..3ff436723cadb5b768543d72f29591a4f523ad5c 100644 (file)
   t)
 (define-key-after set-coding-system-map [set-terminal-coding-system]
   '(menu-item "For Terminal" set-terminal-coding-system
-             :enable (null (memq window-system '(x w32 mac)))
+             :enable (null (memq initial-window-system '(x w32 mac)))
              :help "How to encode terminal output")
   t)
 (define-key-after set-coding-system-map [separator-3]
@@ -1740,7 +1740,7 @@ The default status is as follows:
 
 (reset-language-environment)
 
-(defun set-display-table-and-terminal-coding-system (language-name &optional coding-system)
+(defun set-display-table-and-terminal-coding-system (language-name &optional coding-system display)
   "Set up the display table and terminal coding system for LANGUAGE-NAME."
   (let ((coding (get-language-info language-name 'unibyte-display)))
     (if coding
@@ -1754,7 +1754,7 @@ The default status is as follows:
        (dotimes (i 128)
          (aset standard-display-table (+ i 128) nil))))
     (or (eq window-system 'pc)
-       (set-terminal-coding-system (or coding-system coding)))))
+       (set-terminal-coding-system (or coding-system coding) display))))
 
 (defun set-language-environment (language-name)
   "Set up multi-lingual environment for using LANGUAGE-NAME.
@@ -2348,7 +2348,7 @@ is returned.  Thus, for instance, if charset \"ISO8859-2\",
 ;; too, for setting things such as calendar holidays, ps-print paper
 ;; size, spelling dictionary.
 
-(defun set-locale-environment (&optional locale-name)
+(defun set-locale-environment (&optional locale-name display)
   "Set up multi-lingual environment for using LOCALE-NAME.
 This sets the language environment, the coding system priority,
 the default input method and sometimes other things.
@@ -2369,6 +2369,11 @@ directory named `/usr/share/locale' or `/usr/lib/locale'.  LOCALE-NAME
 will be translated according to the table specified by
 `locale-translation-file-name'.
 
+If DISPLAY is non-nil, only set the keyboard coding system and
+the terminal coding system for the given display, and don't touch
+session-global parameters like the language environment.  DISPLAY
+may be a display id or a frame.
+
 See also `locale-charset-language-names', `locale-language-names',
 `locale-preferred-coding-systems' and `locale-coding-system'."
   (interactive "sSet environment for locale: ")
@@ -2457,28 +2462,34 @@ See also `locale-charset-language-names', `locale-language-names',
 
          ;; Set up for this character set.  This is now the right way
          ;; to do it for both unibyte and multibyte modes.
-         (set-language-environment language-name)
+         (unless display
+           (set-language-environment language-name))
 
          ;; If default-enable-multibyte-characters is nil,
          ;; we are using single-byte characters,
          ;; so the display table and terminal coding system are irrelevant.
          (when default-enable-multibyte-characters
            (set-display-table-and-terminal-coding-system
-            language-name coding-system))
+            language-name coding-system display))
 
          ;; Set the `keyboard-coding-system' if appropriate (tty
          ;; only).  At least X and MS Windows can generate
          ;; multilingual input.
-         (unless window-system
-           (let ((kcs (or coding-system
-                          (car (get-language-info language-name
-                                                  'coding-system)))))
-             (if kcs (set-keyboard-coding-system kcs))))
-
-         (setq locale-coding-system
-               (car (get-language-info language-name 'coding-priority))))
-
-       (when (and coding-system
+         ;; XXX This was disabled unless `window-system', but that
+         ;; leads to buggy behaviour when a tty frame is opened
+         ;; later.  Setting the keyboard coding system has no adverse
+         ;; effect on X, so let's do it anyway. -- Lorentey
+         (let ((kcs (or coding-system
+                        (car (get-language-info language-name
+                                                'coding-system)))))
+           (if kcs (set-keyboard-coding-system kcs display)))
+
+         (unless display
+           (setq locale-coding-system
+                 (car (get-language-info language-name 'coding-priority)))))
+
+       (when (and (not display)
+                  coding-system
                   (not (coding-system-equal coding-system
                                             locale-coding-system)))
          (prefer-coding-system coding-system)
@@ -2490,9 +2501,9 @@ See also `locale-charset-language-names', `locale-language-names',
     (when (boundp 'w32-ansi-code-page)
       (let ((code-page-coding (intern (format "cp%d" w32-ansi-code-page))))
        (when (coding-system-p code-page-coding)
-         (setq locale-coding-system code-page-coding)
-         (set-keyboard-coding-system code-page-coding)
-         (set-terminal-coding-system code-page-coding))))
+         (unless display (setq locale-coding-system code-page-coding))
+         (set-keyboard-coding-system code-page-coding display)
+         (set-terminal-coding-system code-page-coding display))))
 
     (when (eq system-type 'darwin)
       ;; On Darwin, file names are always encoded in utf-8, no matter
@@ -2507,32 +2518,33 @@ See also `locale-charset-language-names', `locale-language-names',
 
     ;; Default to A4 paper if we're not in a C, POSIX or US locale.
     ;; (See comments in Flocale_info.)
-    (let ((locale locale)
-         (paper (locale-info 'paper)))
-      (if paper
-         ;; This will always be null at the time of writing.
-         (cond
-          ((equal paper '(216 279))
-           (setq ps-paper-type 'letter))
-          ((equal paper '(210 297))
-           (setq ps-paper-type 'a4)))
-       (let ((vars '("LC_ALL" "LC_PAPER" "LANG")))
-         (while (and vars (= 0 (length locale)))
-           (setq locale (getenv (pop vars)))))
-       (when locale
-         ;; As of glibc 2.2.5, these are the only US Letter locales,
-         ;; and the rest are A4.
-         (setq ps-paper-type
-               (or (locale-name-match locale '(("c$" . letter)
-                                               ("posix$" . letter)
-                                               (".._us" . letter)
-                                               (".._pr" . letter)
-                                               (".._ca" . letter)
-                                               ("enu$" . letter) ; Windows
-                                               ("esu$" . letter)
-                                               ("enc$" . letter)
-                                               ("frc$" . letter)))
-                   'a4))))))
+    (unless display
+      (let ((locale locale)
+           (paper (locale-info 'paper)))
+       (if paper
+           ;; This will always be null at the time of writing.
+           (cond
+            ((equal paper '(216 279))
+             (setq ps-paper-type 'letter))
+            ((equal paper '(210 297))
+             (setq ps-paper-type 'a4)))
+         (let ((vars '("LC_ALL" "LC_PAPER" "LANG")))
+           (while (and vars (= 0 (length locale)))
+             (setq locale (getenv (pop vars)))))
+         (when locale
+           ;; As of glibc 2.2.5, these are the only US Letter locales,
+           ;; and the rest are A4.
+           (setq ps-paper-type
+                 (or (locale-name-match locale '(("c$" . letter)
+                                                 ("posix$" . letter)
+                                                 (".._us" . letter)
+                                                 (".._pr" . letter)
+                                                 (".._ca" . letter)
+                                                 ("enu$" . letter) ; Windows
+                                                 ("esu$" . letter)
+                                                 ("enc$" . letter)
+                                                 ("frc$" . letter)))
+                     'a4)))))))
   nil)
 \f
 ;;; Charset property
index cf5c2c75a6a39e96d1d9941bc42c0d5cb616aab7..198ebaa4ef7d0df4b674938bede69512afd73b0f 100644 (file)
@@ -1198,13 +1198,17 @@ see) to CODING-SYSTEM."
 This is normally set according to the selected language environment.
 See also the command `set-terminal-coding-system'.")
 
-(defun set-terminal-coding-system (coding-system)
-  "Set coding system of your terminal to CODING-SYSTEM.
-All text output to the terminal will be encoded
+(defun set-terminal-coding-system (coding-system &optional display)
+  "Set coding system of terminal output to CODING-SYSTEM.
+All text output to DISPLAY will be encoded
 with the specified coding system.
+
 For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems].
 The default is determined by the selected language environment
-or by the previous use of this command."
+or by the previous use of this command.
+
+DISPLAY may be a display id, a frame, or nil for the selected frame's display.
+The setting has no effect on graphical displays."
   (interactive
    (list (let ((default (if (and (not (terminal-coding-system))
                                 default-terminal-coding-system)
@@ -1218,7 +1222,7 @@ or by the previous use of this command."
       (setq coding-system default-terminal-coding-system))
   (if coding-system
       (setq default-terminal-coding-system coding-system))
-  (set-terminal-coding-system-internal coding-system)
+  (set-terminal-coding-system-internal coding-system display)
   (redraw-frame (selected-frame)))
 
 (defvar default-keyboard-coding-system nil
@@ -1226,14 +1230,17 @@ or by the previous use of this command."
 This is normally set according to the selected language environment.
 See also the command `set-keyboard-coding-system'.")
 
-(defun set-keyboard-coding-system (coding-system)
-  "Set coding system for keyboard input to CODING-SYSTEM.
-In addition, this command enables Encoded-kbd minor mode.
-\(If CODING-SYSTEM is nil, Encoded-kbd mode is turned off -- see
-`encoded-kbd-mode'.)
+(defun set-keyboard-coding-system (coding-system &optional display)
+  "Set coding system for keyboard input on DISPLAY to CODING-SYSTEM.
+In addition, this command calls `encoded-kbd-setup-display' to set up the
+translation of keyboard input events to the specified coding system.
+
 For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems].
 The default is determined by the selected language environment
-or by the previous use of this command."
+or by the previous use of this command.
+
+DISPLAY may be a display id, a frame, or nil for the selected frame's display.
+The setting has no effect on graphical displays."
   (interactive
    (list (let ((default (if (and (not (keyboard-coding-system))
                                 default-keyboard-coding-system)
@@ -1247,9 +1254,9 @@ or by the previous use of this command."
       (setq coding-system default-keyboard-coding-system))
   (if coding-system
       (setq default-keyboard-coding-system coding-system))
-  (set-keyboard-coding-system-internal coding-system)
+  (set-keyboard-coding-system-internal coding-system display)
   (setq keyboard-coding-system coding-system)
-  (encoded-kbd-mode (if coding-system 1 0)))
+  (encoded-kbd-setup-display display))
 
 (defcustom keyboard-coding-system nil
   "Specify coding system for keyboard input.
@@ -1265,8 +1272,8 @@ use either \\[customize] or \\[set-keyboard-coding-system]."
   :link '(info-link "(emacs)Specify Coding")
   :link '(info-link "(emacs)Single-Byte Character Support")
   :set (lambda (symbol value)
-        ;; Don't load encoded-kbd-mode unnecessarily.
-        (if (or value (boundp 'encoded-kbd-mode))
+        ;; Don't load encoded-kb unnecessarily.
+        (if (or value (boundp 'encoded-kbd-setup-display))
             (set-keyboard-coding-system value)
           (set-default 'keyboard-coding-system nil))) ; must initialize
   :version "22.1"
index a8c30182a491a0cdf09e5d54a07be6145f822a2e..9e38efe10b4a53c04a6e246d0115e0d0dc22da25 100644 (file)
@@ -4,7 +4,7 @@
 \f
 ;;;### (autoloads (5x5-crack 5x5-crack-xor-mutate 5x5-crack-mutating-best
 ;;;;;;  5x5-crack-mutating-current 5x5-crack-randomly 5x5) "5x5"
-;;;;;;  "play/5x5.el" (16775 26715))
+;;;;;;  "play/5x5.el" (17087 12566))
 ;;; Generated autoloads from play/5x5.el
 
 (autoload (quote 5x5) "5x5" "\
@@ -64,15 +64,15 @@ should return a grid vector array that is the new solution.
 ;;;***
 \f
 ;;;### (autoloads (ada-mode ada-add-extensions) "ada-mode" "progmodes/ada-mode.el"
-;;;;;;  (16858 50933))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from progmodes/ada-mode.el
 
 (autoload (quote ada-add-extensions) "ada-mode" "\
 Define SPEC and BODY as being valid extensions for Ada files.
 Going from body to spec with `ff-find-other-file' used these
 extensions.
-SPEC and BODY are two regular expressions that must match against the file
-name
+SPEC and BODY are two regular expressions that must match against
+the file name.
 
 \(fn SPEC BODY)" nil nil)
 
@@ -106,7 +106,7 @@ Comments are handled using standard GNU Emacs conventions, including:
  Continue comment on next line                        '\\[indent-new-comment-line]'
 
 If you use imenu.el:
- Display index-menu of functions & procedures         '\\[imenu]'
+ Display index-menu of functions and procedures       '\\[imenu]'
 
 If you use find-file.el:
  Switch to other file (Body <-> Spec)                 '\\[ff-find-other-file]'
@@ -125,7 +125,7 @@ If you use ada-xref.el:
 ;;;***
 \f
 ;;;### (autoloads (ada-header) "ada-stmt" "progmodes/ada-stmt.el"
-;;;;;;  (16507 41097))
+;;;;;;  (17087 12558))
 ;;; Generated autoloads from progmodes/ada-stmt.el
 
 (autoload (quote ada-header) "ada-stmt" "\
@@ -136,7 +136,7 @@ Insert a descriptive header at the top of the file.
 ;;;***
 \f
 ;;;### (autoloads (ada-find-file) "ada-xref" "progmodes/ada-xref.el"
-;;;;;;  (16783 21522))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from progmodes/ada-xref.el
 
 (autoload (quote ada-find-file) "ada-xref" "\
@@ -151,7 +151,7 @@ Completion is available.
 ;;;;;;  change-log-mode add-change-log-entry-other-window add-change-log-entry
 ;;;;;;  find-change-log prompt-for-change-log-name add-log-mailing-address
 ;;;;;;  add-log-full-name add-log-current-defun-function) "add-log"
-;;;;;;  "add-log.el" (16958 58756))
+;;;;;;  "add-log.el" (17087 12581))
 ;;; Generated autoloads from add-log.el
 
 (defvar add-log-current-defun-function nil "\
@@ -186,10 +186,10 @@ Find a change log file for \\[add-change-log-entry] and return the name.
 
 Optional arg FILE-NAME specifies the file to use.
 If FILE-NAME is nil, use the value of `change-log-default-name'.
-If 'change-log-default-name' is nil, behave as though it were 'ChangeLog'
+If `change-log-default-name' is nil, behave as though it were 'ChangeLog'
 \(or whatever we use on this operating system).
 
-If 'change-log-default-name' contains a leading directory component, then
+If `change-log-default-name' contains a leading directory component, then
 simply find it in the current directory.  Otherwise, search in the current
 directory and its successive parents for a file so named.
 
@@ -288,8 +288,8 @@ Fix any old-style date entries in the current log file to default format.
 ;;;***
 \f
 ;;;### (autoloads (defadvice ad-add-advice ad-default-compilation-action
-;;;;;;  ad-redefinition-action) "advice" "emacs-lisp/advice.el" (16775
-;;;;;;  26709))
+;;;;;;  ad-redefinition-action) "advice" "emacs-lisp/advice.el" (17087
+;;;;;;  12524))
 ;;; Generated autoloads from emacs-lisp/advice.el
 
 (defvar ad-redefinition-action (quote warn) "\
@@ -388,7 +388,7 @@ See Info node `(elisp)Advising Functions' for comprehensive documentation.
 \f
 ;;;### (autoloads (align-newline-and-indent align-unhighlight-rule
 ;;;;;;  align-highlight-rule align-current align-entire align-regexp
-;;;;;;  align) "align" "align.el" (16942 52925))
+;;;;;;  align) "align" "align.el" (17087 12564))
 ;;; Generated autoloads from align.el
 
 (autoload (quote align) "align" "\
@@ -477,7 +477,7 @@ A replacement function for `newline-and-indent', aligning as it goes.
 
 ;;;***
 \f
-;;;### (autoloads (allout-init) "allout" "allout.el" (16908 33360))
+;;;### (autoloads (allout-init) "allout" "allout.el" (17087 12552))
 ;;; Generated autoloads from allout.el
 
 (autoload (quote allout-init) "allout" "\
@@ -513,7 +513,7 @@ the following two lines in your Emacs init file:
 ;;;***
 \f
 ;;;### (autoloads (ange-ftp-hook-function ange-ftp-reread-dir) "ange-ftp"
-;;;;;;  "net/ange-ftp.el" (16908 33362))
+;;;;;;  "net/ange-ftp.el" (17087 12570))
 ;;; Generated autoloads from net/ange-ftp.el
 
 (defalias (quote ange-ftp-re-read-dir) (quote ange-ftp-reread-dir))
@@ -535,7 +535,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (animate-birthday-present animate-sequence animate-string)
-;;;;;;  "animate" "play/animate.el" (16944 24675))
+;;;;;;  "animate" "play/animate.el" (17087 12558))
 ;;; Generated autoloads from play/animate.el
 
 (autoload (quote animate-string) "animate" "\
@@ -563,7 +563,7 @@ You can specify the one's name by NAME; the default value is \"Sarah\".
 ;;;***
 \f
 ;;;### (autoloads (ansi-color-process-output ansi-color-for-comint-mode-on)
-;;;;;;  "ansi-color" "ansi-color.el" (16858 50906))
+;;;;;;  "ansi-color" "ansi-color.el" (17087 12564))
 ;;; Generated autoloads from ansi-color.el
 
 (autoload (quote ansi-color-for-comint-mode-on) "ansi-color" "\
@@ -589,7 +589,7 @@ This is a good function to put in `comint-output-filter-functions'.
 ;;;***
 \f
 ;;;### (autoloads (antlr-set-tabs antlr-mode antlr-show-makefile-rules)
-;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (16858 50933))
+;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (17087 12570))
 ;;; Generated autoloads from progmodes/antlr-mode.el
 
 (autoload (quote antlr-show-makefile-rules) "antlr-mode" "\
@@ -628,7 +628,7 @@ Used in `antlr-mode'.  Also a useful function in `java-mode-hook'.
 ;;;### (autoloads (appt-activate appt-make-list appt-delete appt-add
 ;;;;;;  appt-display-diary appt-display-duration appt-display-mode-line
 ;;;;;;  appt-msg-window appt-visible appt-audible appt-message-warning-time
-;;;;;;  appt-issue-message) "appt" "calendar/appt.el" (16925 43112))
+;;;;;;  appt-issue-message) "appt" "calendar/appt.el" (17087 12578))
 ;;; Generated autoloads from calendar/appt.el
 
 (defvar appt-issue-message t "\
@@ -679,7 +679,7 @@ This will occur at midnight when the appointment list is updated.")
 (custom-autoload (quote appt-display-diary) "appt")
 
 (autoload (quote appt-add) "appt" "\
-Add an appointment for the day at NEW-APPT-TIME and issue message NEW-APPT-MSG.
+Add an appointment for today at NEW-APPT-TIME with message NEW-APPT-MSG.
 The time should be in either 24 hour format or am/pm format.
 
 \(fn NEW-APPT-TIME NEW-APPT-MSG)" t nil)
@@ -700,6 +700,9 @@ They specify the range of dates that the diary is being processed for.
 Any appointments made with `appt-add' are not affected by this
 function.
 
+For backwards compatibility, this function activates the
+appointment package (if it is not already active).
+
 \(fn)" nil nil)
 
 (autoload (quote appt-activate) "appt" "\
@@ -713,7 +716,7 @@ ARG is positive, otherwise off.
 \f
 ;;;### (autoloads (apropos-documentation apropos-value apropos apropos-documentation-property
 ;;;;;;  apropos-command apropos-variable) "apropos" "apropos.el"
-;;;;;;  (16942 52925))
+;;;;;;  (17087 12500))
 ;;; Generated autoloads from apropos.el
 
 (autoload (quote apropos-variable) "apropos" "\
@@ -767,8 +770,8 @@ Returns list of symbols and documentation found.
 
 ;;;***
 \f
-;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (16534
-;;;;;;  3807))
+;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from arc-mode.el
 
 (autoload (quote archive-mode) "arc-mode" "\
@@ -788,7 +791,7 @@ archive.
 
 ;;;***
 \f
-;;;### (autoloads (array-mode) "array" "array.el" (16213 43267))
+;;;### (autoloads (array-mode) "array" "array.el" (17087 12566))
 ;;; Generated autoloads from array.el
 
 (autoload (quote array-mode) "array" "\
@@ -859,8 +862,8 @@ Entering array mode calls the function `array-mode-hook'.
 
 ;;;***
 \f
-;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (16858
-;;;;;;  50939))
+;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (17087
+;;;;;;  12451))
 ;;; Generated autoloads from textmodes/artist.el
 
 (autoload (quote artist-mode) "artist" "\
@@ -1065,8 +1068,8 @@ Keymap summary
 
 ;;;***
 \f
-;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (16908
-;;;;;;  33362))
+;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (17087
+;;;;;;  12466))
 ;;; Generated autoloads from progmodes/asm-mode.el
 
 (autoload (quote asm-mode) "asm-mode" "\
@@ -1094,7 +1097,7 @@ Special commands:
 ;;;***
 \f
 ;;;### (autoloads (auto-show-mode auto-show-mode) "auto-show" "obsolete/auto-show.el"
-;;;;;;  (16213 43281))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from obsolete/auto-show.el
 
 (defvar auto-show-mode nil "\
@@ -1110,14 +1113,12 @@ This command is obsolete.
 ;;;***
 \f
 ;;;### (autoloads (autoarg-kp-mode autoarg-mode) "autoarg" "autoarg.el"
-;;;;;;  (16213 43267))
+;;;;;;  (17087 12379))
 ;;; Generated autoloads from autoarg.el
 
 (defvar autoarg-mode nil "\
 Non-nil if Autoarg mode is enabled.
-See the command `autoarg-mode' for a description of this minor-mode.
-Setting this variable directly does not take effect;
-use either \\[customize] or the function `autoarg-mode'.")
+See the command `autoarg-mode' for a description of this minor-mode.")
 
 (custom-autoload (quote autoarg-mode) "autoarg")
 
@@ -1165,7 +1166,7 @@ This is similar to \\[autoarg-mode] but rebinds the keypad keys `kp-1'
 ;;;***
 \f
 ;;;### (autoloads (autoconf-mode) "autoconf" "progmodes/autoconf.el"
-;;;;;;  (16775 26716))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from progmodes/autoconf.el
 
 (autoload (quote autoconf-mode) "autoconf" "\
@@ -1176,7 +1177,7 @@ Major mode for editing Autoconf configure.in files.
 ;;;***
 \f
 ;;;### (autoloads (auto-insert-mode define-auto-insert auto-insert)
-;;;;;;  "autoinsert" "autoinsert.el" (16793 54109))
+;;;;;;  "autoinsert" "autoinsert.el" (17087 12578))
 ;;; Generated autoloads from autoinsert.el
 
 (autoload (quote auto-insert) "autoinsert" "\
@@ -1214,7 +1215,7 @@ insert a template for the file depending on the mode of the buffer.
 \f
 ;;;### (autoloads (batch-update-autoloads update-directory-autoloads
 ;;;;;;  update-file-autoloads) "autoload" "emacs-lisp/autoload.el"
-;;;;;;  (16866 20010))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from emacs-lisp/autoload.el
 
 (autoload (quote update-file-autoloads) "autoload" "\
@@ -1249,7 +1250,7 @@ Calls `update-directory-autoloads' on the command line arguments.
 \f
 ;;;### (autoloads (global-auto-revert-mode turn-on-auto-revert-tail-mode
 ;;;;;;  auto-revert-tail-mode turn-on-auto-revert-mode auto-revert-mode)
-;;;;;;  "autorevert" "autorevert.el" (16923 3604))
+;;;;;;  "autorevert" "autorevert.el" (17087 12567))
 ;;; Generated autoloads from autorevert.el
 
 (autoload (quote auto-revert-mode) "autorevert" "\
@@ -1317,7 +1318,7 @@ Use `auto-revert-mode' to revert a particular buffer.
 ;;;***
 \f
 ;;;### (autoloads (mouse-avoidance-mode mouse-avoidance-mode) "avoid"
-;;;;;;  "avoid.el" (16680 26001))
+;;;;;;  "avoid.el" (17087 12411))
 ;;; Generated autoloads from avoid.el
 
 (defvar mouse-avoidance-mode nil "\
@@ -1358,7 +1359,7 @@ definition of \"random distance\".)
 ;;;***
 \f
 ;;;### (autoloads (backquote) "backquote" "emacs-lisp/backquote.el"
-;;;;;;  (16484 6599))
+;;;;;;  (17087 12379))
 ;;; Generated autoloads from emacs-lisp/backquote.el
 
 (autoload (quote backquote) "backquote" "\
@@ -1383,7 +1384,7 @@ Vectors work just like lists.  Nested backquotes are permitted.
 ;;;***
 \f
 ;;;### (autoloads (display-battery-mode battery) "battery" "battery.el"
-;;;;;;  (16861 9525))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from battery.el
  (put 'battery-mode-line-string 'risky-local-variable t)
 
@@ -1414,7 +1415,7 @@ seconds.
 ;;;***
 \f
 ;;;### (autoloads (benchmark benchmark-run-compiled benchmark-run)
-;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (16213 43272))
+;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (17087 12379))
 ;;; Generated autoloads from emacs-lisp/benchmark.el
 
 (autoload (quote benchmark-run) "benchmark" "\
@@ -1446,8 +1447,8 @@ non-interactive use see also `benchmark-run' and
 
 ;;;***
 \f
-;;;### (autoloads (bibtex-mode) "bibtex" "textmodes/bibtex.el" (16887
-;;;;;;  27628))
+;;;### (autoloads (bibtex-mode) "bibtex" "textmodes/bibtex.el" (17087
+;;;;;;  12575))
 ;;; Generated autoloads from textmodes/bibtex.el
 
 (autoload (quote bibtex-mode) "bibtex" "\
@@ -1466,7 +1467,7 @@ works only with buffers containing valid (syntactical correct) and sorted
 entries.  This is usually the case, if you have created a buffer completely
 with BibTeX mode and finished every new entry with \\[bibtex-clean-entry].
 
-For third party BibTeX files, call the function `bibtex-convert-alien'
+For third party BibTeX files, call the command \\[bibtex-convert-alien]
 to fully take advantage of all features of BibTeX mode.
 
 
@@ -1509,7 +1510,7 @@ if that value is non-nil.
 \f
 ;;;### (autoloads (binhex-decode-region binhex-decode-region-external
 ;;;;;;  binhex-decode-region-internal) "binhex" "gnus/binhex.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12466))
 ;;; Generated autoloads from gnus/binhex.el
 
 (defconst binhex-begin-line "^:...............................................................$")
@@ -1532,8 +1533,8 @@ Binhex decode region between START and END.
 
 ;;;***
 \f
-;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (16704
-;;;;;;  8186))
+;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from play/blackbox.el
 
 (autoload (quote blackbox) "blackbox" "\
@@ -1655,7 +1656,7 @@ a reflection.
 ;;;### (autoloads (bookmark-bmenu-list bookmark-load bookmark-save
 ;;;;;;  bookmark-write bookmark-delete bookmark-insert bookmark-rename
 ;;;;;;  bookmark-insert-location bookmark-relocate bookmark-jump
-;;;;;;  bookmark-set) "bookmark" "bookmark.el" (16858 50906))
+;;;;;;  bookmark-set) "bookmark" "bookmark.el" (17087 12566))
 ;;; Generated autoloads from bookmark.el
  (define-key ctl-x-map "rb" 'bookmark-jump)
  (define-key ctl-x-map "rm" 'bookmark-set)
@@ -1830,7 +1831,7 @@ deletion, or > if it is flagged for displaying.
 
 (defalias (quote edit-bookmarks) (quote bookmark-bmenu-list))
 
-(defvar menu-bar-bookmark-map (let ((map (make-sparse-keymap "Bookmark functions"))) (define-key map [load] (quote ("Load a Bookmark File..." . bookmark-load))) (define-key map [write] (quote ("Save Bookmarks As..." . bookmark-write))) (define-key map [save] (quote ("Save Bookmarks" . bookmark-save))) (define-key map [edit] (quote ("Edit Bookmark List" . bookmark-bmenu-list))) (define-key map [delete] (quote ("Delete Bookmark" . bookmark-delete))) (define-key map [rename] (quote ("Rename Bookmark" . bookmark-rename))) (define-key map [locate] (quote ("Insert Location" . bookmark-locate))) (define-key map [insert] (quote ("Insert Contents" . bookmark-insert))) (define-key map [set] (quote ("Set Bookmark" . bookmark-set))) (define-key map [jump] (quote ("Jump to Bookmark" . bookmark-jump))) map))
+(defvar menu-bar-bookmark-map (let ((map (make-sparse-keymap "Bookmark functions"))) (define-key map [load] (quote ("Load a Bookmark File..." . bookmark-load))) (define-key map [write] (quote ("Save Bookmarks As..." . bookmark-write))) (define-key map [save] (quote ("Save Bookmarks" . bookmark-save))) (define-key map [edit] (quote ("Edit Bookmark List" . bookmark-bmenu-list))) (define-key map [delete] (quote ("Delete Bookmark..." . bookmark-delete))) (define-key map [rename] (quote ("Rename Bookmark..." . bookmark-rename))) (define-key map [locate] (quote ("Insert Location..." . bookmark-locate))) (define-key map [insert] (quote ("Insert Contents..." . bookmark-insert))) (define-key map [set] (quote ("Set Bookmark..." . bookmark-set))) (define-key map [jump] (quote ("Jump to Bookmark..." . bookmark-jump))) map))
 
 (defalias (quote menu-bar-bookmark-map) menu-bar-bookmark-map)
 
@@ -1840,12 +1841,12 @@ deletion, or > if it is flagged for displaying.
 ;;;;;;  browse-url-mmm browse-url-lynx-emacs browse-url-lynx-xterm
 ;;;;;;  browse-url-w3-gnudoit browse-url-w3 browse-url-iximosaic
 ;;;;;;  browse-url-cci browse-url-grail browse-url-mosaic browse-url-gnome-moz
-;;;;;;  browse-url-galeon browse-url-mozilla browse-url-netscape
+;;;;;;  browse-url-galeon browse-url-firefox browse-url-mozilla browse-url-netscape
 ;;;;;;  browse-url-default-browser browse-url-at-mouse browse-url-at-point
 ;;;;;;  browse-url browse-url-of-region browse-url-of-dired-file
 ;;;;;;  browse-url-of-buffer browse-url-of-file browse-url-url-at-point
-;;;;;;  browse-url-browser-function) "browse-url" "net/browse-url.el"
-;;;;;;  (16944 24675))
+;;;;;;  browse-url-galeon-program browse-url-firefox-program browse-url-browser-function)
+;;;;;;  "browse-url" "net/browse-url.el" (17087 12578))
 ;;; Generated autoloads from net/browse-url.el
 
 (defvar browse-url-browser-function (cond ((memq system-type (quote (windows-nt ms-dos cygwin))) (quote browse-url-default-windows-browser)) ((memq system-type (quote (darwin))) (quote browse-url-default-macosx-browser)) (t (quote browse-url-default-browser))) "\
@@ -1861,6 +1862,16 @@ regexp should probably be \".\" to specify a default browser.")
 
 (custom-autoload (quote browse-url-browser-function) "browse-url")
 
+(defvar browse-url-firefox-program "firefox" "\
+*The name by which to invoke Firefox.")
+
+(custom-autoload (quote browse-url-firefox-program) "browse-url")
+
+(defvar browse-url-galeon-program "galeon" "\
+*The name by which to invoke Galeon.")
+
+(custom-autoload (quote browse-url-galeon-program) "browse-url")
+
 (autoload (quote browse-url-url-at-point) "browse-url" "\
 Not documented
 
@@ -1928,9 +1939,9 @@ the effect of `browse-url-new-window-flag'.
 When called non-interactively, optional second argument NEW-WINDOW is
 used instead of `browse-url-new-window-flag'.
 
-The order attempted is gnome-moz-remote, Mozilla, Galeon,
-Konqueror, Netscape, Mosaic, IXI Mosaic, Lynx in an xterm, MMM,
-and then W3.
+The order attempted is gnome-moz-remote, Mozilla, Firefox,
+Galeon, Konqueror, Netscape, Mosaic, IXI Mosaic, Lynx in an
+xterm, MMM, and then W3.
 
 \(fn URL &rest ARGS)" nil nil)
 
@@ -1972,6 +1983,34 @@ used instead of `browse-url-new-window-flag'.
 
 \(fn URL &optional NEW-WINDOW)" t nil)
 
+(autoload (quote browse-url-firefox) "browse-url" "\
+Ask the Firefox WWW browser to load URL.
+Default to the URL around or before point.  The strings in
+variable `browse-url-firefox-arguments' are also passed to
+Firefox.
+
+When called interactively, if variable
+`browse-url-new-window-flag' is non-nil, load the document in a
+new Firefox window, otherwise use a random existing one.  A
+non-nil interactive prefix argument reverses the effect of
+`browse-url-new-window-flag'.
+
+If `browse-url-firefox-new-window-is-tab' is non-nil, then
+whenever a document would otherwise be loaded in a new window, it
+is loaded in a new tab in an existing window instead.
+
+When called non-interactively, optional second argument
+NEW-WINDOW is used instead of `browse-url-new-window-flag'.
+
+On MS-Windows systems the optional `new-window' parameter is
+ignored.  Firefox for Windows does not support the \"-remote\"
+command line parameter.  Therefore, the
+`browse-url-new-window-flag' and `browse-url-firefox-new-window-is-tab'
+are ignored as well.  Firefox on Windows will always open the requested
+URL in a new window.
+
+\(fn URL &optional NEW-WINDOW)" t nil)
+
 (autoload (quote browse-url-galeon) "browse-url" "\
 Ask the Galeon WWW browser to load URL.
 Default to the URL around or before point.  The strings in variable
@@ -2138,8 +2177,8 @@ Default to the URL around or before point.
 
 ;;;***
 \f
-;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (16213
-;;;;;;  43281))
+;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from play/bruce.el
 
 (autoload (quote bruce) "bruce" "\
@@ -2155,7 +2194,7 @@ Return a vector containing the lines from `bruce-phrases-file'.
 ;;;***
 \f
 ;;;### (autoloads (bs-show bs-customize bs-cycle-previous bs-cycle-next)
-;;;;;;  "bs" "bs.el" (16704 8186))
+;;;;;;  "bs" "bs.el" (17087 12566))
 ;;; Generated autoloads from bs.el
 
 (autoload (quote bs-cycle-next) "bs" "\
@@ -2196,8 +2235,8 @@ name of buffer configuration.
 ;;;***
 \f
 ;;;### (autoloads (insert-text-button make-text-button insert-button
-;;;;;;  make-button define-button-type) "button" "button.el" (16934
-;;;;;;  57456))
+;;;;;;  make-button define-button-type) "button" "button.el" (17087
+;;;;;;  12478))
 ;;; Generated autoloads from button.el
 
 (defvar button-map (let ((map (make-sparse-keymap))) (define-key map "\r" (quote push-button)) (define-key map [mouse-2] (quote push-button)) map) "\
@@ -2285,7 +2324,7 @@ Also see `make-text-button'.
 ;;;;;;  batch-byte-compile-if-not-done display-call-tree byte-compile
 ;;;;;;  compile-defun byte-compile-file byte-recompile-directory
 ;;;;;;  byte-force-recompile) "bytecomp" "emacs-lisp/bytecomp.el"
-;;;;;;  (16942 52931))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from emacs-lisp/bytecomp.el
 
 (autoload (quote byte-force-recompile) "bytecomp" "\
@@ -2377,7 +2416,7 @@ For example, invoke `emacs -batch -f batch-byte-recompile-directory .'.
 
 ;;;***
 \f
-;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (16630 17322))
+;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (17087 12400))
 ;;; Generated autoloads from calendar/cal-dst.el
 
 (put (quote calendar-daylight-savings-starts) (quote risky-local-variable) t)
@@ -2387,7 +2426,7 @@ For example, invoke `emacs -batch -f batch-byte-recompile-directory .'.
 ;;;***
 \f
 ;;;### (autoloads (list-yahrzeit-dates) "cal-hebrew" "calendar/cal-hebrew.el"
-;;;;;;  (16436 34880))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from calendar/cal-hebrew.el
 
 (autoload (quote list-yahrzeit-dates) "cal-hebrew" "\
@@ -2401,12 +2440,14 @@ from the cursor position.
 \f
 ;;;### (autoloads (defmath calc-embedded-activate calc-embedded calc-grab-rectangle
 ;;;;;;  calc-grab-region full-calc-keypad calc-keypad calc-eval quick-calc
-;;;;;;  full-calc calc calc-dispatch) "calc" "calc/calc.el" (16949
-;;;;;;  24050))
+;;;;;;  full-calc calc calc-dispatch calc-settings-file) "calc" "calc/calc.el"
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from calc/calc.el
 
 (defvar calc-settings-file (convert-standard-filename "~/.calc.el") "\
 *File in which to record permanent settings.")
+
+(custom-autoload (quote calc-settings-file) "calc")
  (global-set-key "\e#" 'calc-dispatch)
 
 (autoload (quote calc-dispatch) "calc" "\
@@ -2478,8 +2519,8 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (calculator) "calculator" "calculator.el" (16858
-;;;;;;  50907))
+;;;### (autoloads (calculator) "calculator" "calculator.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from calculator.el
 
 (autoload (quote calculator) "calculator" "\
@@ -2507,7 +2548,7 @@ See the documentation for `calculator-mode' for more information.
 ;;;;;;  mark-holidays-in-calendar view-calendar-holidays-initially
 ;;;;;;  calendar-remove-frame-by-deleting mark-diary-entries-in-calendar
 ;;;;;;  number-of-diary-entries view-diary-entries-initially calendar-offset)
-;;;;;;  "calendar" "calendar/calendar.el" (16953 20625))
+;;;;;;  "calendar" "calendar/calendar.el" (17087 12569))
 ;;; Generated autoloads from calendar/calendar.el
 
 (defvar calendar-offset 0 "\
@@ -3098,7 +3139,7 @@ movement commands will not work correctly.")
 ;;;***
 \f
 ;;;### (autoloads (canlock-verify canlock-insert-header) "canlock"
-;;;;;;  "gnus/canlock.el" (16822 52985))
+;;;;;;  "gnus/canlock.el" (17087 12566))
 ;;; Generated autoloads from gnus/canlock.el
 
 (autoload (quote canlock-insert-header) "canlock" "\
@@ -3117,7 +3158,7 @@ it fails.
 \f
 ;;;### (autoloads (pike-mode idl-mode java-mode objc-mode c++-mode
 ;;;;;;  c-mode c-initialize-cc-mode) "cc-mode" "progmodes/cc-mode.el"
-;;;;;;  (16858 50934))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from progmodes/cc-mode.el
 
 (autoload (quote c-initialize-cc-mode) "cc-mode" "\
@@ -3275,7 +3316,7 @@ Key bindings:
 ;;;***
 \f
 ;;;### (autoloads (c-set-offset c-add-style c-set-style) "cc-styles"
-;;;;;;  "progmodes/cc-styles.el" (16667 39430))
+;;;;;;  "progmodes/cc-styles.el" (17087 12566))
 ;;; Generated autoloads from progmodes/cc-styles.el
 
 (autoload (quote c-set-style) "cc-styles" "\
@@ -3332,7 +3373,7 @@ and exists only for compatibility reasons.
 \f
 ;;;### (autoloads (ccl-execute-with-args check-ccl-program define-ccl-program
 ;;;;;;  declare-ccl-program ccl-dump ccl-compile) "ccl" "international/ccl.el"
-;;;;;;  (16942 52931))
+;;;;;;  (17087 12558))
 ;;; Generated autoloads from international/ccl.el
 
 (autoload (quote ccl-compile) "ccl" "\
@@ -3591,7 +3632,7 @@ See the documentation of `define-ccl-program' for the detail of CCL program.
 ;;;***
 \f
 ;;;### (autoloads (cfengine-mode) "cfengine" "progmodes/cfengine.el"
-;;;;;;  (16908 33362))
+;;;;;;  (17087 12466))
 ;;; Generated autoloads from progmodes/cfengine.el
 
 (autoload (quote cfengine-mode) "cfengine" "\
@@ -3613,7 +3654,7 @@ to the action header.
 ;;;;;;  checkdoc-comments checkdoc-continue checkdoc-start checkdoc-current-buffer
 ;;;;;;  checkdoc-eval-current-buffer checkdoc-message-interactive
 ;;;;;;  checkdoc-interactive checkdoc) "checkdoc" "emacs-lisp/checkdoc.el"
-;;;;;;  (16829 43426))
+;;;;;;  (17087 12449))
 ;;; Generated autoloads from emacs-lisp/checkdoc.el
 
 (autoload (quote checkdoc) "checkdoc" "\
@@ -3796,8 +3837,8 @@ checking of documentation strings.
 ;;;***
 \f
 ;;;### (autoloads (encode-hz-buffer encode-hz-region decode-hz-buffer
-;;;;;;  decode-hz-region) "china-util" "language/china-util.el" (16213
-;;;;;;  43280))
+;;;;;;  decode-hz-region) "china-util" "language/china-util.el" (17087
+;;;;;;  12562))
 ;;; Generated autoloads from language/china-util.el
 
 (autoload (quote decode-hz-region) "china-util" "\
@@ -3825,7 +3866,7 @@ Encode the text in the current buffer to HZ.
 ;;;***
 \f
 ;;;### (autoloads (command-history list-command-history repeat-matching-complex-command)
-;;;;;;  "chistory" "chistory.el" (16213 43267))
+;;;;;;  "chistory" "chistory.el" (17087 12566))
 ;;; Generated autoloads from chistory.el
 
 (autoload (quote repeat-matching-complex-command) "chistory" "\
@@ -3864,7 +3905,7 @@ and runs the normal hook `command-history-hook'.
 
 ;;;***
 \f
-;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (16764 51520))
+;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (17087 12566))
 ;;; Generated autoloads from emacs-lisp/cl.el
 
 (defvar custom-print-functions nil "\
@@ -3880,7 +3921,7 @@ a future Emacs interpreter will be able to use it.")
 ;;;***
 \f
 ;;;### (autoloads (common-lisp-indent-function) "cl-indent" "emacs-lisp/cl-indent.el"
-;;;;;;  (16680 26003))
+;;;;;;  (17087 12411))
 ;;; Generated autoloads from emacs-lisp/cl-indent.el
 
 (autoload (quote common-lisp-indent-function) "cl-indent" "\
@@ -3891,7 +3932,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (c-macro-expand) "cmacexp" "progmodes/cmacexp.el"
-;;;;;;  (16213 43281))
+;;;;;;  (17087 12554))
 ;;; Generated autoloads from progmodes/cmacexp.el
 
 (autoload (quote c-macro-expand) "cmacexp" "\
@@ -3910,8 +3951,8 @@ For use inside Lisp programs, see also `c-macro-expansion'.
 
 ;;;***
 \f
-;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (16718
-;;;;;;  40975))
+;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (17087
+;;;;;;  12424))
 ;;; Generated autoloads from cmuscheme.el
 
 (autoload (quote run-scheme) "cmuscheme" "\
@@ -3928,7 +3969,7 @@ of `scheme-program-name').  Runs the hooks `inferior-scheme-mode-hook'
 ;;;***
 \f
 ;;;### (autoloads (cp-make-coding-system) "code-pages" "international/code-pages.el"
-;;;;;;  (16939 44105))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from international/code-pages.el
 
 (autoload (quote cp-make-coding-system) "code-pages" "\
@@ -3958,7 +3999,7 @@ Return an updated `non-iso-charset-alist'.
 \f
 ;;;### (autoloads (codepage-setup cp-supported-codepages cp-offset-for-codepage
 ;;;;;;  cp-language-for-codepage cp-charset-for-codepage cp-make-coding-systems-for-codepage)
-;;;;;;  "codepage" "international/codepage.el" (16216 22162))
+;;;;;;  "codepage" "international/codepage.el" (17087 12558))
 ;;; Generated autoloads from international/codepage.el
 
 (autoload (quote cp-make-coding-systems-for-codepage) "codepage" "\
@@ -4017,16 +4058,31 @@ read/written by MS-DOS software, or for display on the MS-DOS terminal.
 ;;;### (autoloads (comint-redirect-results-list-from-process comint-redirect-results-list
 ;;;;;;  comint-redirect-send-command-to-process comint-redirect-send-command
 ;;;;;;  comint-run make-comint make-comint-in-buffer) "comint" "comint.el"
-;;;;;;  (16908 33360))
+;;;;;;  (17087 12574))
 ;;; Generated autoloads from comint.el
 
+(defvar comint-output-filter-functions (quote (comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt)) "\
+Functions to call after output is inserted into the buffer.
+One possible function is `comint-postoutput-scroll-to-bottom'.
+These functions get one argument, a string containing the text as originally
+inserted.  Note that this might not be the same as the buffer contents between
+`comint-last-output-start' and the buffer's `process-mark', if other filter
+functions have already modified the buffer.
+
+See also `comint-preoutput-filter-functions'.
+
+You can use `add-hook' to add functions to this list
+either globally or locally.")
+
+(defvaralias (quote comint-use-prompt-regexp-instead-of-fields) (quote comint-use-prompt-regexp))
+
 (autoload (quote make-comint-in-buffer) "comint" "\
 Make a Comint process NAME in BUFFER, running PROGRAM.
 If BUFFER is nil, it defaults to NAME surrounded by `*'s.
 PROGRAM should be either a string denoting an executable program to create
 via `start-process', or a cons pair of the form (HOST . SERVICE) denoting a TCP
 connection to be opened via `open-network-stream'.  If there is already a
-running process in that buffer, it is not restarted.  Optional third arg
+running process in that buffer, it is not restarted.  Optional fourth arg
 STARTFILE is the name of a file to send the contents of to the process.
 
 If PROGRAM is a string, any more args are arguments to PROGRAM.
@@ -4087,8 +4143,8 @@ REGEXP-GROUP is the regular expression group in REGEXP to use.
 
 ;;;***
 \f
-;;;### (autoloads (compare-windows) "compare-w" "compare-w.el" (16810
-;;;;;;  63790))
+;;;### (autoloads (compare-windows) "compare-w" "compare-w.el" (17087
+;;;;;;  12569))
 ;;; Generated autoloads from compare-w.el
 
 (autoload (quote compare-windows) "compare-w" "\
@@ -4124,7 +4180,7 @@ on third call it again advances points to the next difference and so on.
 ;;;### (autoloads (compilation-next-error-function compilation-minor-mode
 ;;;;;;  compilation-shell-minor-mode compilation-mode compile compilation-search-path
 ;;;;;;  compilation-ask-about-save compilation-window-height compilation-mode-hook)
-;;;;;;  "compile" "progmodes/compile.el" (16939 44105))
+;;;;;;  "compile" "progmodes/compile.el" (17087 12570))
 ;;; Generated autoloads from progmodes/compile.el
 
 (defvar compilation-mode-hook nil "\
@@ -4238,10 +4294,12 @@ Not documented
 
 \(fn N &optional RESET)" t nil)
 
+(add-to-list (quote auto-mode-alist) (quote ("\\.gcov\\'" . compilation-mode)))
+
 ;;;***
 \f
 ;;;### (autoloads (partial-completion-mode) "complete" "complete.el"
-;;;;;;  (16377 12871))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from complete.el
 
 (defvar partial-completion-mode nil "\
@@ -4276,7 +4334,7 @@ See also the variable `PC-include-file-path'.
 ;;;***
 \f
 ;;;### (autoloads (dynamic-completion-mode) "completion" "completion.el"
-;;;;;;  (16581 41633))
+;;;;;;  (17087 12379))
 ;;; Generated autoloads from completion.el
 
 (autoload (quote dynamic-completion-mode) "completion" "\
@@ -4289,7 +4347,7 @@ Enable dynamic word-completion.
 ;;;### (autoloads (decompose-composite-char compose-last-chars compose-chars-after
 ;;;;;;  find-composition compose-chars decompose-string compose-string
 ;;;;;;  decompose-region compose-region encode-composition-rule)
-;;;;;;  "composite" "composite.el" (16702 49512))
+;;;;;;  "composite" "composite.el" (17087 12416))
 ;;; Generated autoloads from composite.el
 
 (defconst reference-point-alist (quote ((tl . 0) (tc . 1) (tr . 2) (Bl . 3) (Bc . 4) (Br . 5) (bl . 6) (bc . 7) (br . 8) (cl . 9) (cc . 10) (cr . 11) (top-left . 0) (top-center . 1) (top-right . 2) (base-left . 3) (base-center . 4) (base-right . 5) (bottom-left . 6) (bottom-center . 7) (bottom-right . 8) (center-left . 9) (center-center . 10) (center-right . 11) (ml . 3) (mc . 10) (mr . 5) (mid-left . 3) (mid-center . 10) (mid-right . 5))) "\
@@ -4510,7 +4568,7 @@ Optional 3rd arg WITH-COMPOSITION-RULE is ignored.
 \f
 ;;;### (autoloads (conf-xdefaults-mode conf-ppd-mode conf-colon-mode
 ;;;;;;  conf-space-mode conf-javaprop-mode conf-windows-mode conf-unix-mode
-;;;;;;  conf-mode) "conf-mode" "textmodes/conf-mode.el" (16908 33363))
+;;;;;;  conf-mode) "conf-mode" "textmodes/conf-mode.el" (17087 12466))
 ;;; Generated autoloads from textmodes/conf-mode.el
 
 (autoload (quote conf-mode) "conf-mode" "\
@@ -4660,7 +4718,7 @@ For details see `conf-mode'.  Example:
 ;;;***
 \f
 ;;;### (autoloads (shuffle-vector cookie-snarf cookie-insert cookie)
-;;;;;;  "cookie1" "play/cookie1.el" (16213 43281))
+;;;;;;  "cookie1" "play/cookie1.el" (17087 12380))
 ;;; Generated autoloads from play/cookie1.el
 
 (autoload (quote cookie) "cookie1" "\
@@ -4692,7 +4750,7 @@ Randomly permute the elements of VECTOR (all permutations equally likely).
 ;;;***
 \f
 ;;;### (autoloads (copyright copyright-fix-years copyright-update)
-;;;;;;  "copyright" "emacs-lisp/copyright.el" (16932 19775))
+;;;;;;  "copyright" "emacs-lisp/copyright.el" (17087 12564))
 ;;; Generated autoloads from emacs-lisp/copyright.el
 
 (autoload (quote copyright-update) "copyright" "\
@@ -4720,7 +4778,7 @@ Insert a copyright by $ORGANIZATION notice at cursor.
 ;;;***
 \f
 ;;;### (autoloads (cperl-mode) "cperl-mode" "progmodes/cperl-mode.el"
-;;;;;;  (16858 50935))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from progmodes/cperl-mode.el
 
 (autoload (quote cperl-mode) "cperl-mode" "\
@@ -4778,7 +4836,7 @@ you type it inside the inline block of control construct, like
 and you are on a boundary of a statement inside braces, it will
 transform the construct into a multiline and will place you into an
 appropriately indented blank line.  If you need a usual
-`newline-and-indent' behaviour, it is on \\[newline-and-indent],
+`newline-and-indent' behavior, it is on \\[newline-and-indent],
 see documentation on `cperl-electric-linefeed'.
 
 Use \\[cperl-invert-if-unless] to change a construction of the form
@@ -4893,7 +4951,7 @@ or as help on variables `cperl-tips', `cperl-problems',
 ;;;***
 \f
 ;;;### (autoloads (cpp-parse-edit cpp-highlight-buffer) "cpp" "progmodes/cpp.el"
-;;;;;;  (16213 43281))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from progmodes/cpp.el
 
 (autoload (quote cpp-highlight-buffer) "cpp" "\
@@ -4912,7 +4970,7 @@ Edit display information for cpp conditionals.
 ;;;***
 \f
 ;;;### (autoloads (crisp-mode crisp-mode) "crisp" "emulation/crisp.el"
-;;;;;;  (16213 43273))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from emulation/crisp.el
 
 (defvar crisp-mode nil "\
@@ -4936,7 +4994,7 @@ With ARG, turn CRiSP mode on if ARG is positive, off otherwise.
 ;;;***
 \f
 ;;;### (autoloads (completing-read-multiple) "crm" "emacs-lisp/crm.el"
-;;;;;;  (16213 43272))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from emacs-lisp/crm.el
 
 (autoload (quote completing-read-multiple) "crm" "\
@@ -4971,8 +5029,8 @@ INHERIT-INPUT-METHOD.
 
 ;;;***
 \f
-;;;### (autoloads (cua-mode) "cua-base" "emulation/cua-base.el" (16942
-;;;;;;  52931))
+;;;### (autoloads (cua-mode) "cua-base" "emulation/cua-base.el" (17087
+;;;;;;  12569))
 ;;; Generated autoloads from emulation/cua-base.el
 
 (defvar cua-mode nil "\
@@ -4995,10 +5053,11 @@ paste (in addition to the normal emacs bindings).
  '(error (concat "\n\n"
  "CUA-mode is now part of the standard GNU Emacs distribution,\n"
  "so you may now enable and customize CUA via the Options menu.\n\n"
- "Your " (file-name-nondirectory user-init-file) " loads an older version of CUA-mode which does\n"
- "not work correctly with this version of GNU Emacs.\n"
+ "You have loaded an older version of CUA-mode which does\n"
+ "not work correctly with this version of GNU Emacs.\n\n"
+ (if user-init-file (concat
  "To correct this, remove the loading and customization of the\n"
- "old version from the " user-init-file " file.\n\n")))
+ "old version from the " user-init-file " file.\n\n")))))
 
 ;;;***
 \f
@@ -5010,7 +5069,7 @@ paste (in addition to the normal emacs bindings).
 ;;;;;;  customize-face customize-changed-options customize-option-other-window
 ;;;;;;  customize-option customize-group-other-window customize-group
 ;;;;;;  customize-mode customize customize-save-variable customize-set-variable
-;;;;;;  customize-set-value) "cus-edit" "cus-edit.el" (16930 25645))
+;;;;;;  customize-set-value) "cus-edit" "cus-edit.el" (17087 12581))
 ;;; Generated autoloads from cus-edit.el
  (add-hook 'same-window-regexps "\\`\\*Customiz.*\\*\\'")
 
@@ -5121,7 +5180,8 @@ version.
 
 (autoload (quote customize-face) "cus-edit" "\
 Customize FACE, which should be a face name or nil.
-If FACE is nil, customize all faces.
+If FACE is nil, customize all faces.  If FACE is actually a
+face-alias, customize the face it is aliased to.
 
 Interactively, when point is on text which has a face specified,
 suggest to customize that face, if it's customizable.
@@ -5130,6 +5190,7 @@ suggest to customize that face, if it's customizable.
 
 (autoload (quote customize-face-other-window) "cus-edit" "\
 Show customization buffer for face FACE in other window.
+If FACE is actually a face-alias, customize the face it is aliased to.
 
 Interactively, when point is on text which has a face specified,
 suggest to customize that face, if it's customizable.
@@ -5264,7 +5325,7 @@ The format is suitable for use with `easy-menu-define'.
 \f
 ;;;### (autoloads (custom-reset-faces custom-theme-reset-faces custom-theme-face-value
 ;;;;;;  custom-set-faces custom-declare-face) "cus-face" "cus-face.el"
-;;;;;;  (16861 9526))
+;;;;;;  (17087 12589))
 ;;; Generated autoloads from cus-face.el
 
 (autoload (quote custom-declare-face) "cus-face" "\
@@ -5272,6 +5333,24 @@ Like `defface', but FACE is evaluated as a normal argument.
 
 \(fn FACE SPEC DOC &rest ARGS)" nil nil)
 
+(defconst custom-face-attributes (quote ((:family (string :tag "Font Family" :help-echo "Font family or fontset alias name.")) (:width (choice :tag "Width" :help-echo "Font width." :value normal (const :tag "compressed" condensed) (const :tag "condensed" condensed) (const :tag "demiexpanded" semi-expanded) (const :tag "expanded" expanded) (const :tag "extracondensed" extra-condensed) (const :tag "extraexpanded" extra-expanded) (const :tag "medium" normal) (const :tag "narrow" condensed) (const :tag "normal" normal) (const :tag "regular" normal) (const :tag "semicondensed" semi-condensed) (const :tag "semiexpanded" semi-expanded) (const :tag "ultracondensed" ultra-condensed) (const :tag "ultraexpanded" ultra-expanded) (const :tag "wide" extra-expanded))) (:height (choice :tag "Height" :help-echo "Face's font height." :value 1.0 (integer :tag "Height in 1/10 pt") (number :tag "Scale" 1.0))) (:weight (choice :tag "Weight" :help-echo "Font weight." :value normal (const :tag "black" ultra-bold) (const :tag "bold" bold) (const :tag "book" semi-light) (const :tag "demibold" semi-bold) (const :tag "extralight" extra-light) (const :tag "extrabold" extra-bold) (const :tag "heavy" extra-bold) (const :tag "light" light) (const :tag "medium" normal) (const :tag "normal" normal) (const :tag "regular" normal) (const :tag "semibold" semi-bold) (const :tag "semilight" semi-light) (const :tag "ultralight" ultra-light) (const :tag "ultrabold" ultra-bold))) (:slant (choice :tag "Slant" :help-echo "Font slant." :value normal (const :tag "italic" italic) (const :tag "oblique" oblique) (const :tag "normal" normal))) (:underline (choice :tag "Underline" :help-echo "Control text underlining." (const :tag "Off" nil) (const :tag "On" t) (color :tag "Colored"))) (:overline (choice :tag "Overline" :help-echo "Control text overlining." (const :tag "Off" nil) (const :tag "On" t) (color :tag "Colored"))) (:strike-through (choice :tag "Strike-through" :help-echo "Control text strike-through." (const :tag "Off" nil) (const :tag "On" t) (color :tag "Colored"))) (:box (choice :tag "Box around text" :help-echo "Control box around text." (const :tag "Off" nil) (list :tag "Box" :value (:line-width 2 :color "grey75" :style released-button) (const :format "" :value :line-width) (integer :tag "Width") (const :format "" :value :color) (choice :tag "Color" (const :tag "*" nil) color) (const :format "" :value :style) (choice :tag "Style" (const :tag "Raised" released-button) (const :tag "Sunken" pressed-button) (const :tag "None" nil)))) (lambda (real-value) (and real-value (let ((lwidth (or (and (consp real-value) (plist-get real-value :line-width)) (and (integerp real-value) real-value) 1)) (color (or (and (consp real-value) (plist-get real-value :color)) (and (stringp real-value) real-value) nil)) (style (and (consp real-value) (plist-get real-value :style)))) (list :line-width lwidth :color color :style style)))) (lambda (cus-value) (and cus-value (let ((lwidth (plist-get cus-value :line-width)) (color (plist-get cus-value :color)) (style (plist-get cus-value :style))) (cond ((and (null color) (null style)) lwidth) ((and (null lwidth) (null style)) color) (t (nconc (and lwidth (\` (:line-width (\, lwidth)))) (and color (\` (:color (\, color)))) (and style (\` (:style (\, style))))))))))) (:inverse-video (choice :tag "Inverse-video" :help-echo "Control whether text should be in inverse-video." (const :tag "Off" nil) (const :tag "On" t))) (:foreground (color :tag "Foreground" :help-echo "Set foreground color (name or #RRGGBB hex spec).")) (:background (color :tag "Background" :help-echo "Set background color (name or #RRGGBB hex spec).")) (:stipple (choice :tag "Stipple" :help-echo "Background bit-mask" (const :tag "None" nil) (file :tag "File" :help-echo "Name of bitmap file." :must-match t))) (:inherit (repeat :tag "Inherit" :help-echo "List of faces to inherit attributes from." (face :Tag "Face" default)) (lambda (real-value) (cond ((or (null real-value) (eq real-value (quote unspecified))) nil) ((symbolp real-value) (list real-value)) (t real-value))) (lambda (cus-value) (if (and (consp cus-value) (null (cdr cus-value))) (car cus-value) cus-value))))) "\
+Alist of face attributes.
+
+The elements are of the form (KEY TYPE PRE-FILTER POST-FILTER),
+where KEY is the name of the attribute, TYPE is a widget type for
+editing the attribute, PRE-FILTER is a function to make the attribute's
+value suitable for the customization widget, and POST-FILTER is a
+function to make the customized value suitable for storing.  PRE-FILTER
+and POST-FILTER are optional.
+
+The PRE-FILTER should take a single argument, the attribute value as
+stored, and should return a value for customization (using the
+customization type TYPE).
+
+The POST-FILTER should also take a single argument, the value after
+being customized, and should return a value suitable for setting the
+given face attribute.")
+
 (autoload (quote custom-set-faces) "cus-face" "\
 Initialize faces according to user preferences.
 This associates the settings with the `user' theme.
@@ -5322,7 +5401,7 @@ ARGS is defined as for `custom-theme-reset-faces'
 ;;;***
 \f
 ;;;### (autoloads (customize-create-theme) "cus-theme" "cus-theme.el"
-;;;;;;  (16213 43267))
+;;;;;;  (17087 12532))
 ;;; Generated autoloads from cus-theme.el
 
 (autoload (quote customize-create-theme) "cus-theme" "\
@@ -5333,7 +5412,7 @@ Create a custom theme.
 ;;;***
 \f
 ;;;### (autoloads (cvs-status-mode) "cvs-status" "cvs-status.el"
-;;;;;;  (16788 34908))
+;;;;;;  (17087 12569))
 ;;; Generated autoloads from cvs-status.el
 
 (autoload (quote cvs-status-mode) "cvs-status" "\
@@ -5344,7 +5423,7 @@ Mode used for cvs status output.
 ;;;***
 \f
 ;;;### (autoloads (global-cwarn-mode turn-on-cwarn-mode cwarn-mode)
-;;;;;;  "cwarn" "progmodes/cwarn.el" (16213 43281))
+;;;;;;  "cwarn" "progmodes/cwarn.el" (17087 12528))
 ;;; Generated autoloads from progmodes/cwarn.el
 
 (autoload (quote cwarn-mode) "cwarn" "\
@@ -5386,7 +5465,7 @@ in which `turn-on-cwarn-mode-if-enabled' turns it on.
 \f
 ;;;### (autoloads (standard-display-cyrillic-translit cyrillic-encode-alternativnyj-char
 ;;;;;;  cyrillic-encode-koi8-r-char) "cyril-util" "language/cyril-util.el"
-;;;;;;  (16213 43280))
+;;;;;;  (17087 12562))
 ;;; Generated autoloads from language/cyril-util.el
 
 (autoload (quote cyrillic-encode-koi8-r-char) "cyril-util" "\
@@ -5415,7 +5494,7 @@ If the argument is nil, we return the display table to its standard state.
 ;;;***
 \f
 ;;;### (autoloads (dabbrev-expand dabbrev-completion) "dabbrev" "dabbrev.el"
-;;;;;;  (16908 33360))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from dabbrev.el
  (define-key esc-map "/" 'dabbrev-expand)
  (define-key esc-map [?\C-/] 'dabbrev-completion)
@@ -5462,8 +5541,8 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion].
 
 ;;;***
 \f
-;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (16958
-;;;;;;  58759))
+;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from progmodes/dcl-mode.el
 
 (autoload (quote dcl-mode) "dcl-mode" "\
@@ -5590,7 +5669,7 @@ There is some minimal font-lock support (see vars
 ;;;***
 \f
 ;;;### (autoloads (cancel-debug-on-entry debug-on-entry debug) "debug"
-;;;;;;  "emacs-lisp/debug.el" (16953 20625))
+;;;;;;  "emacs-lisp/debug.el" (17087 12581))
 ;;; Generated autoloads from emacs-lisp/debug.el
 
 (setq debugger (quote debug))
@@ -5608,9 +5687,16 @@ first will be printed into the backtrace buffer.
 
 (autoload (quote debug-on-entry) "debug" "\
 Request FUNCTION to invoke debugger each time it is called.
-If you tell the debugger to continue, FUNCTION's execution proceeds.
-This works by modifying the definition of FUNCTION,
-which must be written in Lisp, not predefined.
+
+When called interactively, prompt for FUNCTION in the minibuffer.
+
+This works by modifying the definition of FUNCTION.  If you tell the
+debugger to continue, FUNCTION's execution proceeds.  If FUNCTION is a
+normal function or a macro written in Lisp, you can also step through
+its execution.  FUNCTION can also be a primitive that is not a special
+form, in which case stepping is not possible.  Break-on-entry for
+primitive functions only works when that function is called from Lisp.
+
 Use \\[cancel-debug-on-entry] to cancel the effect of this command.
 Redefining FUNCTION also cancels it.
 
@@ -5618,14 +5704,16 @@ Redefining FUNCTION also cancels it.
 
 (autoload (quote cancel-debug-on-entry) "debug" "\
 Undo effect of \\[debug-on-entry] on FUNCTION.
-If argument is nil or an empty string, cancel for all functions.
+If FUNCTION is nil, cancel debug-on-entry for all functions.
+When called interactively, prompt for FUNCTION in the minibuffer.
+To specify a nil argument interactively, exit with an empty minibuffer.
 
 \(fn &optional FUNCTION)" t nil)
 
 ;;;***
 \f
 ;;;### (autoloads (decipher-mode decipher) "decipher" "play/decipher.el"
-;;;;;;  (16876 58220))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from play/decipher.el
 
 (autoload (quote decipher) "decipher" "\
@@ -5654,8 +5742,8 @@ The most useful commands are:
 ;;;***
 \f
 ;;;### (autoloads (delimit-columns-rectangle delimit-columns-region
-;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (16462
-;;;;;;  53446))
+;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (17087
+;;;;;;  12379))
 ;;; Generated autoloads from delim-col.el
 
 (autoload (quote delimit-columns-customize) "delim-col" "\
@@ -5679,8 +5767,8 @@ START and END delimits the corners of text rectangle.
 
 ;;;***
 \f
-;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (16507
-;;;;;;  41097))
+;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from progmodes/delphi.el
 
 (autoload (quote delphi-mode) "delphi" "\
@@ -5730,8 +5818,8 @@ no args, if that value is non-nil.
 
 ;;;***
 \f
-;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (16764
-;;;;;;  51517))
+;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (17087
+;;;;;;  12435))
 ;;; Generated autoloads from delsel.el
 
 (defalias (quote pending-delete-mode) (quote delete-selection-mode))
@@ -5759,7 +5847,7 @@ any selection.
 ;;;***
 \f
 ;;;### (autoloads (derived-mode-init-mode-variables define-derived-mode)
-;;;;;;  "derived" "emacs-lisp/derived.el" (16908 33361))
+;;;;;;  "derived" "emacs-lisp/derived.el" (17087 12574))
 ;;; Generated autoloads from emacs-lisp/derived.el
 
 (autoload (quote define-derived-mode) "derived" "\
@@ -5780,6 +5868,7 @@ BODY can start with a bunch of keyword arguments.  The following keyword
   arguments are currently understood:
 :group GROUP
        Declare the customization group that corresponds to this mode.
+       The command `customize-mode' uses this.
 :syntax-table TABLE
        Use TABLE instead of the default.
        A nil value means to simply use the same syntax-table as the parent.
@@ -5808,10 +5897,12 @@ been generated automatically, with a reference to the keymap.
 The new mode runs the hook constructed by the function
 `derived-mode-hook-name'.
 
+See Info node `(elisp)Derived Modes' for more details.
+
 \(fn CHILD PARENT NAME &optional DOCSTRING &rest BODY)" nil (quote macro))
 
 (autoload (quote derived-mode-init-mode-variables) "derived" "\
-Initialise variables for a new MODE.
+Initialize variables for a new MODE.
 Right now, if they don't already exist, set up a blank keymap, an
 empty syntax table, and an empty abbrev table -- these will be merged
 the first time the mode is used.
@@ -5821,7 +5912,7 @@ the first time the mode is used.
 ;;;***
 \f
 ;;;### (autoloads (describe-char describe-text-properties) "descr-text"
-;;;;;;  "descr-text.el" (16908 33360))
+;;;;;;  "descr-text.el" (17087 12566))
 ;;; Generated autoloads from descr-text.el
 
 (autoload (quote describe-text-properties) "descr-text" "\
@@ -5846,14 +5937,12 @@ as well as widgets, buttons, overlays, and text properties.
 \f
 ;;;### (autoloads (desktop-revert desktop-save-in-desktop-dir desktop-change-dir
 ;;;;;;  desktop-load-default desktop-read desktop-save-mode) "desktop"
-;;;;;;  "desktop.el" (16908 33360))
+;;;;;;  "desktop.el" (17087 12534))
 ;;; Generated autoloads from desktop.el
 
 (defvar desktop-save-mode nil "\
 Non-nil if Desktop-Save mode is enabled.
-See the command `desktop-save-mode' for a description of this minor-mode.
-Setting this variable directly does not take effect;
-use either \\[customize] or the function `desktop-save-mode'.")
+See the command `desktop-save-mode' for a description of this minor-mode.")
 
 (custom-autoload (quote desktop-save-mode) "desktop")
 
@@ -5921,7 +6010,7 @@ Revert to the last loaded desktop.
 ;;;;;;  gnus-article-outlook-repair-attribution gnus-article-outlook-unwrap-lines
 ;;;;;;  gnus-outlook-display-hook gnus-outlook-deuglify-unwrap-max
 ;;;;;;  gnus-outlook-deuglify-unwrap-min) "deuglify" "gnus/deuglify.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from gnus/deuglify.el
 
 (defvar gnus-outlook-deuglify-unwrap-min 45 "\
@@ -5970,7 +6059,7 @@ Deuglify broken Outlook (Express) articles and redisplay.
 ;;;***
 \f
 ;;;### (autoloads (devanagari-post-read-conversion devanagari-compose-region)
-;;;;;;  "devan-util" "language/devan-util.el" (16585 28857))
+;;;;;;  "devan-util" "language/devan-util.el" (17087 12562))
 ;;; Generated autoloads from language/devan-util.el
 
 (defconst devanagari-consonant "[\x51ad5-\x51af9\x51b38-\x51b3f]")
@@ -5988,7 +6077,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib"
-;;;;;;  "calendar/diary-lib.el" (16953 20625))
+;;;;;;  "calendar/diary-lib.el" (17087 12569))
 ;;; Generated autoloads from calendar/diary-lib.el
 
 (autoload (quote diary) "diary-lib" "\
@@ -6034,7 +6123,7 @@ Major mode for editing the diary file.
 ;;;***
 \f
 ;;;### (autoloads (diff-backup diff diff-command diff-switches) "diff"
-;;;;;;  "diff.el" (16534 3807))
+;;;;;;  "diff.el" (17087 12379))
 ;;; Generated autoloads from diff.el
 
 (defvar diff-switches "-c" "\
@@ -6068,7 +6157,7 @@ With prefix arg, prompt for diff switches.
 ;;;***
 \f
 ;;;### (autoloads (diff-minor-mode diff-mode) "diff-mode" "diff-mode.el"
-;;;;;;  (16746 18215))
+;;;;;;  (17087 12569))
 ;;; Generated autoloads from diff-mode.el
 
 (autoload (quote diff-mode) "diff-mode" "\
@@ -6076,7 +6165,7 @@ Major mode for viewing/editing context diffs.
 Supports unified and context diffs as well as (to a lesser extent)
 normal diffs.
 When the buffer is read-only, the ESC prefix is not necessary.
-IF you edit the buffer manually, diff-mode will try to update the hunk
+If you edit the buffer manually, diff-mode will try to update the hunk
 headers for you on-the-fly.
 
 You can also switch between context diff and unified diff with \\[diff-context->unified],
@@ -6097,7 +6186,7 @@ Minor mode for viewing/editing context diffs.
 ;;;;;;  dired-other-window dired dired-copy-preserve-time dired-dwim-target
 ;;;;;;  dired-keep-marker-symlink dired-keep-marker-hardlink dired-keep-marker-copy
 ;;;;;;  dired-keep-marker-rename dired-trivial-filenames dired-ls-F-marks-symlinks
-;;;;;;  dired-listing-switches) "dired" "dired.el" (16915 11400))
+;;;;;;  dired-listing-switches) "dired" "dired.el" (17087 12569))
 ;;; Generated autoloads from dired.el
 
 (defvar dired-listing-switches "-al" "\
@@ -6242,8 +6331,8 @@ Restore a dired buffer specified in a desktop file.
 ;;;;;;  dired-do-compress dired-query dired-compress-file dired-do-kill-lines
 ;;;;;;  dired-run-shell-command dired-do-shell-command dired-clean-directory
 ;;;;;;  dired-do-print dired-do-touch dired-do-chown dired-do-chgrp
-;;;;;;  dired-do-chmod dired-backup-diff dired-diff) "dired-aux"
-;;;;;;  "dired-aux.el" (16804 23129))
+;;;;;;  dired-do-chmod dired-compare-directories dired-backup-diff
+;;;;;;  dired-diff) "dired-aux" "dired-aux.el" (17087 12581))
 ;;; Generated autoloads from dired-aux.el
 
 (autoload (quote dired-diff) "dired-aux" "\
@@ -6265,6 +6354,34 @@ With prefix arg, prompt for argument SWITCHES which is options for `diff'.
 
 \(fn &optional SWITCHES)" t nil)
 
+(autoload (quote dired-compare-directories) "dired-aux" "\
+Mark files with different file attributes in two dired buffers.
+Compare file attributes of files in the current directory
+with file attributes in directory DIR2 using PREDICATE on pairs of files
+with the same name.  Mark files for which PREDICATE returns non-nil.
+Mark files with different names if PREDICATE is nil (or interactively
+with empty input at the predicate prompt).
+
+PREDICATE is a Lisp expression that can refer to the following variables:
+
+    size1, size2   - file size in bytes
+    mtime1, mtime2 - last modification time in seconds, as a float
+    fa1, fa2       - list of file attributes
+                     returned by function `file-attributes'
+
+    where 1 refers to attribute of file in the current dired buffer
+    and 2 to attribute of file in second dired buffer.
+
+Examples of PREDICATE:
+
+    (> mtime1 mtime2) - mark newer files
+    (not (= size1 size2)) - mark files with different sizes
+    (not (string= (nth 8 fa1) (nth 8 fa2))) - mark files with different modes
+    (not (and (= (nth 2 fa1) (nth 2 fa2))   - mark files with different UID
+              (= (nth 3 fa1) (nth 3 fa2))))   and GID.
+
+\(fn DIR2 PREDICATE)" t nil)
+
 (autoload (quote dired-do-chmod) "dired-aux" "\
 Change the mode of the marked (or next ARG) files.
 This calls chmod, thus symbolic modes like `g+w' are allowed.
@@ -6623,7 +6740,7 @@ true then the type of the file linked to by FILE is printed instead.
 
 ;;;***
 \f
-;;;### (autoloads (dired-jump) "dired-x" "dired-x.el" (16589 26258))
+;;;### (autoloads (dired-jump) "dired-x" "dired-x.el" (17087 12564))
 ;;; Generated autoloads from dired-x.el
 
 (autoload (quote dired-jump) "dired-x" "\
@@ -6637,7 +6754,7 @@ buffer and try again.
 
 ;;;***
 \f
-;;;### (autoloads (dirtrack) "dirtrack" "dirtrack.el" (16213 43267))
+;;;### (autoloads (dirtrack) "dirtrack" "dirtrack.el" (17087 12379))
 ;;; Generated autoloads from dirtrack.el
 
 (autoload (quote dirtrack) "dirtrack" "\
@@ -6656,8 +6773,8 @@ You can enable directory tracking by adding this function to
 
 ;;;***
 \f
-;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (16519
-;;;;;;  44982))
+;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from emacs-lisp/disass.el
 
 (autoload (quote disassemble) "disass" "\
@@ -6675,7 +6792,7 @@ redefine OBJECT if it is a symbol.
 ;;;;;;  standard-display-graphic standard-display-g1 standard-display-ascii
 ;;;;;;  standard-display-default standard-display-8bit describe-current-display-table
 ;;;;;;  describe-display-table set-display-table-slot display-table-slot
-;;;;;;  make-display-table) "disp-table" "disp-table.el" (16814 63075))
+;;;;;;  make-display-table) "disp-table" "disp-table.el" (17087 12379))
 ;;; Generated autoloads from disp-table.el
 
 (autoload (quote make-display-table) "disp-table" "\
@@ -6776,7 +6893,7 @@ for users who call this function in `.emacs'.
 ;;;***
 \f
 ;;;### (autoloads (dissociated-press) "dissociate" "play/dissociate.el"
-;;;;;;  (16213 43281))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from play/dissociate.el
 
 (autoload (quote dissociated-press) "dissociate" "\
@@ -6790,10 +6907,30 @@ Default is 2.
 
 \(fn &optional ARG)" t nil)
 
+;;;***
+\f
+;;;### (autoloads (dnd-protocol-alist) "dnd" "dnd.el" (17087 12562))
+;;; Generated autoloads from dnd.el
+
+(defvar dnd-protocol-alist (quote (("^file:///" . dnd-open-local-file) ("^file://" . dnd-open-file) ("^file:" . dnd-open-local-file))) "\
+The functions to call for different protocols when a drop is made.
+This variable is used by `dnd-handle-one-url' and `dnd-handle-file-name'.
+The list contains of (REGEXP . FUNCTION) pairs.
+The functions shall take two arguments, URL, which is the URL dropped and
+ACTION which is the action to be performed for the drop (move, copy, link,
+private or ask).
+If no match is found here, and the value of `browse-url-browser-function'
+is a pair of (REGEXP . FUNCTION), those regexps are tried for a match.
+If no match is found, the URL is inserted as text by calling `dnd-insert-text'.
+The function shall return the action done (move, copy, link or private)
+if some action was made, or nil if the URL is ignored.")
+
+(custom-autoload (quote dnd-protocol-alist) "dnd")
+
 ;;;***
 \f
 ;;;### (autoloads (dns-mode-soa-increment-serial dns-mode) "dns-mode"
-;;;;;;  "textmodes/dns-mode.el" (16710 53610))
+;;;;;;  "textmodes/dns-mode.el" (17087 12566))
 ;;; Generated autoloads from textmodes/dns-mode.el
 
 (autoload (quote dns-mode) "dns-mode" "\
@@ -6816,7 +6953,7 @@ Locate SOA record and increment the serial field.
 
 ;;;***
 \f
-;;;### (autoloads (doctor) "doctor" "play/doctor.el" (16213 43281))
+;;;### (autoloads (doctor) "doctor" "play/doctor.el" (17087 12570))
 ;;; Generated autoloads from play/doctor.el
 
 (autoload (quote doctor) "doctor" "\
@@ -6827,7 +6964,7 @@ Switch to *doctor* buffer and start giving psychotherapy.
 ;;;***
 \f
 ;;;### (autoloads (double-mode double-mode) "double" "double.el"
-;;;;;;  (16932 19773))
+;;;;;;  (17087 12588))
 ;;; Generated autoloads from double.el
 
 (defvar double-mode nil "\
@@ -6848,7 +6985,7 @@ when pressed twice.  See variable `double-map' for details.
 
 ;;;***
 \f
-;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (16213 43281))
+;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (17087 12570))
 ;;; Generated autoloads from play/dunnet.el
 
 (autoload (quote dunnet) "dunnet" "\
@@ -6859,7 +6996,7 @@ Switch to *dungeon* buffer and start game.
 ;;;***
 \f
 ;;;### (autoloads (gnus-earcon-display) "earcon" "gnus/earcon.el"
-;;;;;;  (16698 21927))
+;;;;;;  (17087 12415))
 ;;; Generated autoloads from gnus/earcon.el
 
 (autoload (quote gnus-earcon-display) "earcon" "\
@@ -6870,8 +7007,8 @@ Play sounds in message buffers.
 ;;;***
 \f
 ;;;### (autoloads (easy-mmode-defsyntax easy-mmode-defmap easy-mmode-define-keymap
-;;;;;;  easy-mmode-define-global-mode define-minor-mode) "easy-mmode"
-;;;;;;  "emacs-lisp/easy-mmode.el" (16775 26710))
+;;;;;;  define-global-minor-mode define-minor-mode) "easy-mmode"
+;;;;;;  "emacs-lisp/easy-mmode.el" (17087 12569))
 ;;; Generated autoloads from emacs-lisp/easy-mmode.el
 
 (defalias (quote easy-mmode-define-minor-mode) (quote define-minor-mode))
@@ -6879,7 +7016,7 @@ Play sounds in message buffers.
 (autoload (quote define-minor-mode) "easy-mmode" "\
 Define a new minor mode MODE.
 This function defines the associated control variable MODE, keymap MODE-map,
-toggle command MODE, and hook MODE-hook.
+and toggle command MODE.
 
 DOC is the documentation for the mode toggle command.
 Optional INIT-VALUE is the initial value of the mode's variable.
@@ -6892,14 +7029,17 @@ The above three arguments can be skipped if keyword arguments are
 used (see below).
 
 BODY contains code that will be executed each time the mode is (dis)activated.
-  It will be executed after any toggling but before running the hooks.
-  Before the actual body code, you can write
-  keyword arguments (alternating keywords and values).
-  These following keyword arguments are supported (other keywords
-  will be passed to `defcustom' if the minor mode is global):
+  It will be executed after any toggling but before running the hook variable
+  `mode-HOOK'.
+  Before the actual body code, you can write keyword arguments (alternating
+  keywords and values).  These following keyword arguments are supported (other
+  keywords will be passed to `defcustom' if the minor mode is global):
 :group GROUP   Custom group name to use in all generated `defcustom' forms.
+               Defaults to MODE without the possible trailing \"-mode\".
+               Don't use this default group name unless you have written a
+               `defgroup' to define that group properly.
 :global GLOBAL If non-nil specifies that the minor mode is not meant to be
-               buffer-local, so don't make the variable MODE buffer-local.
+               buffer-local, so don't make the variable MODE buffer-local.
                By default, the mode is buffer-local.
 :init-value VAL        Same as the INIT-VALUE argument.
 :lighter SPEC  Same as the LIGHTER argument.
@@ -6913,13 +7053,21 @@ For example, you could write
 
 \(fn MODE DOC &optional INIT-VALUE LIGHTER KEYMAP &rest BODY)" nil (quote macro))
 
-(autoload (quote easy-mmode-define-global-mode) "easy-mmode" "\
+(defalias (quote easy-mmode-define-global-mode) (quote define-global-minor-mode))
+
+(autoload (quote define-global-minor-mode) "easy-mmode" "\
 Make GLOBAL-MODE out of the buffer-local minor MODE.
 TURN-ON is a function that will be called with no args in every buffer
   and that should try to turn MODE on if applicable for that buffer.
 KEYS is a list of CL-style keyword arguments:
 :group to specify the custom group.
 
+If MODE's set-up depends on the major mode in effect when it was
+enabled, then disabling and reenabling MODE should make MODE work
+correctly with the current major mode.  This is important to
+prevent problems with derived modes, that is, major modes that
+call another major mode in their body.
+
 \(fn GLOBAL-MODE MODE TURN-ON &rest KEYS)" nil (quote macro))
 
 (autoload (quote easy-mmode-define-keymap) "easy-mmode" "\
@@ -6946,8 +7094,8 @@ CSS contains a list of syntax specifications of the form (CHAR . SYNTAX).
 ;;;***
 \f
 ;;;### (autoloads (easy-menu-change easy-menu-create-menu easy-menu-do-define
-;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (16787
-;;;;;;  16350))
+;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (17087
+;;;;;;  12567))
 ;;; Generated autoloads from emacs-lisp/easymenu.el
 
 (put (quote easy-menu-define) (quote lisp-indent-function) (quote defun))
@@ -6970,7 +7118,7 @@ It returns the remaining items of the displayed menu.
    :visible INCLUDE
 
 INCLUDE is an expression; this menu is only visible if this
-expression has a non-nil value.  `:include' is an alias for `:visible'.
+expression has a non-nil value.  `:included' is an alias for `:visible'.
 
    :active ENABLE
 
@@ -7015,10 +7163,10 @@ keyboard equivalent.
 ENABLE is an expression; the item is enabled for selection
 whenever this expression's value is non-nil.
 
-   :included INCLUDE
+   :visible INCLUDE
 
 INCLUDE is an expression; this item is only visible if this
-expression has a non-nil value.
+expression has a non-nil value.  `:included' is an alias for `:visible'.
 
    :suffix FORM
 
@@ -7092,7 +7240,7 @@ to implement dynamic menus.
 ;;;;;;  ebnf-eps-directory ebnf-spool-region ebnf-spool-buffer ebnf-spool-file
 ;;;;;;  ebnf-spool-directory ebnf-print-region ebnf-print-buffer
 ;;;;;;  ebnf-print-file ebnf-print-directory ebnf-customize) "ebnf2ps"
-;;;;;;  "progmodes/ebnf2ps.el" (16801 58033))
+;;;;;;  "progmodes/ebnf2ps.el" (17087 12524))
 ;;; Generated autoloads from progmodes/ebnf2ps.el
 
 (autoload (quote ebnf-customize) "ebnf2ps" "\
@@ -7351,8 +7499,8 @@ See `ebnf-style-database' documentation.
 ;;;;;;  ebrowse-tags-find-declaration-other-window ebrowse-tags-find-definition
 ;;;;;;  ebrowse-tags-view-definition ebrowse-tags-find-declaration
 ;;;;;;  ebrowse-tags-view-declaration ebrowse-member-mode ebrowse-electric-choose-tree
-;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (16875
-;;;;;;  35928))
+;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from progmodes/ebrowse.el
 
 (autoload (quote ebrowse-tree-mode) "ebrowse" "\
@@ -7503,7 +7651,7 @@ Display statistics for a class tree.
 ;;;***
 \f
 ;;;### (autoloads (electric-buffer-list) "ebuff-menu" "ebuff-menu.el"
-;;;;;;  (16868 63463))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from ebuff-menu.el
 
 (autoload (quote electric-buffer-list) "ebuff-menu" "\
@@ -7528,7 +7676,7 @@ Run hooks in `electric-buffer-menu-mode-hook' on entry.
 ;;;***
 \f
 ;;;### (autoloads (Electric-command-history-redo-expression) "echistory"
-;;;;;;  "echistory.el" (16213 43267))
+;;;;;;  "echistory.el" (17087 12379))
 ;;; Generated autoloads from echistory.el
 
 (autoload (quote Electric-command-history-redo-expression) "echistory" "\
@@ -7540,11 +7688,11 @@ With prefix arg NOCONFIRM, execute current line as-is without editing.
 ;;;***
 \f
 ;;;### (autoloads (edebug-eval-top-level-form def-edebug-spec edebug-all-forms
-;;;;;;  edebug-all-defs) "edebug" "emacs-lisp/edebug.el" (16810 63791))
+;;;;;;  edebug-all-defs) "edebug" "emacs-lisp/edebug.el" (17087 12578))
 ;;; Generated autoloads from emacs-lisp/edebug.el
 
 (defvar edebug-all-defs nil "\
-*If non-nil, evaluation of any defining forms will instrument for Edebug.
+*If non-nil, evaluating defining forms instruments for Edebug.
 This applies to `eval-defun', `eval-region', `eval-buffer', and
 `eval-current-buffer'.  `eval-region' is also called by
 `eval-last-sexp', and `eval-print-last-sexp'.
@@ -7603,7 +7751,7 @@ already is one.)
 ;;;;;;  ediff-merge-directory-revisions ediff-merge-directories-with-ancestor
 ;;;;;;  ediff-merge-directories ediff-directories3 ediff-directory-revisions
 ;;;;;;  ediff-directories ediff-buffers3 ediff-buffers ediff-backup
-;;;;;;  ediff-files3 ediff-files) "ediff" "ediff.el" (16923 3605))
+;;;;;;  ediff-files3 ediff-files) "ediff" "ediff.el" (17087 12569))
 ;;; Generated autoloads from ediff.el
 
 (autoload (quote ediff-files) "ediff" "\
@@ -7839,7 +7987,7 @@ With optional NODE, goes to that node.
 ;;;***
 \f
 ;;;### (autoloads (ediff-customize) "ediff-help" "ediff-help.el"
-;;;;;;  (16213 43267))
+;;;;;;  (17087 12569))
 ;;; Generated autoloads from ediff-help.el
 
 (autoload (quote ediff-customize) "ediff-help" "\
@@ -7849,7 +7997,7 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads nil "ediff-hook" "ediff-hook.el" (16213 43267))
+;;;### (autoloads nil "ediff-hook" "ediff-hook.el" (17087 12528))
 ;;; Generated autoloads from ediff-hook.el
 
 (defvar ediff-window-setup-function)
@@ -7857,12 +8005,12 @@ Not documented
 
 (ediff-cond-compile-for-xemacs-or-emacs (defun ediff-xemacs-init-menus nil (if (featurep (quote menubar)) (progn (add-submenu (quote ("Tools")) ediff-menu "OO-Browser...") (add-submenu (quote ("Tools")) ediff-merge-menu "OO-Browser...") (add-submenu (quote ("Tools")) epatch-menu "OO-Browser...") (add-submenu (quote ("Tools")) ediff-misc-menu "OO-Browser...") (add-menu-button (quote ("Tools")) "-------" "OO-Browser...")))) nil)
 
-(ediff-cond-compile-for-xemacs-or-emacs (progn (defvar ediff-menu (quote ("Compare" ["Two Files..." ediff-files t] ["Two Buffers..." ediff-buffers t] ["Three Files..." ediff-files3 t] ["Three Buffers..." ediff-buffers3 t] "---" ["Two Directories..." ediff-directories t] ["Three Directories..." ediff-directories3 t] "---" ["File with Revision..." ediff-revision t] ["Directory Revisions..." ediff-directory-revisions t] "---" ["Windows Word-by-word..." ediff-windows-wordwise t] ["Windows Line-by-line..." ediff-windows-linewise t] "---" ["Regions Word-by-word..." ediff-regions-wordwise t] ["Regions Line-by-line..." ediff-regions-linewise t]))) (defvar ediff-merge-menu (quote ("Merge" ["Files..." ediff-merge-files t] ["Files with Ancestor..." ediff-merge-files-with-ancestor t] ["Buffers..." ediff-merge-buffers t] ["Buffers with Ancestor..." ediff-merge-buffers-with-ancestor t] "---" ["Directories..." ediff-merge-directories t] ["Directories with Ancestor..." ediff-merge-directories-with-ancestor t] "---" ["Revisions..." ediff-merge-revisions t] ["Revisions with Ancestor..." ediff-merge-revisions-with-ancestor t] ["Directory Revisions..." ediff-merge-directory-revisions t] ["Directory Revisions with Ancestor..." ediff-merge-directory-revisions-with-ancestor t]))) (defvar epatch-menu (quote ("Apply Patch" ["To a file..." ediff-patch-file t] ["To a buffer..." ediff-patch-buffer t]))) (defvar ediff-misc-menu (quote ("Ediff Miscellanea" ["Ediff Manual..." ediff-documentation t] ["Customize Ediff..." ediff-customize t] ["List Ediff Sessions..." ediff-show-registry t] ["Use separate frame for Ediff control buffer..." ediff-toggle-multiframe :style toggle :selected (if (and (featurep (quote ediff-util)) (boundp (quote ediff-window-setup-function))) (eq ediff-window-setup-function (quote ediff-setup-windows-multiframe)))] ["Use a toolbar with Ediff control buffer" ediff-toggle-use-toolbar :style toggle :selected (if (featurep (quote ediff-tbar)) (ediff-use-toolbar-p))]))) (if (and (featurep (quote menubar)) (not (featurep (quote infodock))) (not (featurep (quote ediff-hook)))) (ediff-xemacs-init-menus))) (if (featurep (quote menu-bar)) (progn (defvar menu-bar-ediff-misc-menu (make-sparse-keymap "Ediff Miscellanea")) (fset (quote menu-bar-ediff-misc-menu) (symbol-value (quote menu-bar-ediff-misc-menu))) (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch")) (fset (quote menu-bar-epatch-menu) (symbol-value (quote menu-bar-epatch-menu))) (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge")) (fset (quote menu-bar-ediff-merge-menu) (symbol-value (quote menu-bar-ediff-merge-menu))) (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare")) (fset (quote menu-bar-ediff-menu) (symbol-value (quote menu-bar-ediff-menu))) (define-key menu-bar-ediff-menu [window] (quote ("This Window and Next Window" . compare-windows))) (define-key menu-bar-ediff-menu [ediff-windows-linewise] (quote ("Windows Line-by-line..." . ediff-windows-linewise))) (define-key menu-bar-ediff-menu [ediff-windows-wordwise] (quote ("Windows Word-by-word..." . ediff-windows-wordwise))) (define-key menu-bar-ediff-menu [separator-ediff-windows] (quote ("--"))) (define-key menu-bar-ediff-menu [ediff-regions-linewise] (quote ("Regions Line-by-line..." . ediff-regions-linewise))) (define-key menu-bar-ediff-menu [ediff-regions-wordwise] (quote ("Regions Word-by-word..." . ediff-regions-wordwise))) (define-key menu-bar-ediff-menu [separator-ediff-regions] (quote ("--"))) (define-key menu-bar-ediff-menu [ediff-dir-revision] (quote ("Directory Revisions..." . ediff-directory-revisions))) (define-key menu-bar-ediff-menu [ediff-revision] (quote ("File with Revision..." . ediff-revision))) (define-key menu-bar-ediff-menu [separator-ediff-directories] (quote ("--"))) (define-key menu-bar-ediff-menu [ediff-directories3] (quote ("Three Directories..." . ediff-directories3))) (define-key menu-bar-ediff-menu [ediff-directories] (quote ("Two Directories..." . ediff-directories))) (define-key menu-bar-ediff-menu [separator-ediff-files] (quote ("--"))) (define-key menu-bar-ediff-menu [ediff-buffers3] (quote ("Three Buffers..." . ediff-buffers3))) (define-key menu-bar-ediff-menu [ediff-files3] (quote ("Three Files..." . ediff-files3))) (define-key menu-bar-ediff-menu [ediff-buffers] (quote ("Two Buffers..." . ediff-buffers))) (define-key menu-bar-ediff-menu [ediff-files] (quote ("Two Files..." . ediff-files))) (define-key menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor] (quote ("Directory Revisions with Ancestor..." . ediff-merge-directory-revisions-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-dir-revisions] (quote ("Directory Revisions..." . ediff-merge-directory-revisions))) (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor] (quote ("Revisions with Ancestor..." . ediff-merge-revisions-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions] (quote ("Revisions..." . ediff-merge-revisions))) (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] (quote ("--"))) (define-key menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor] (quote ("Directories with Ancestor..." . ediff-merge-directories-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-directories] (quote ("Directories..." . ediff-merge-directories))) (define-key menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] (quote ("--"))) (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor] (quote ("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers] (quote ("Buffers..." . ediff-merge-buffers))) (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor] (quote ("Files with Ancestor..." . ediff-merge-files-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-files] (quote ("Files..." . ediff-merge-files))) (define-key menu-bar-epatch-menu [ediff-patch-buffer] (quote ("To a Buffer..." . ediff-patch-buffer))) (define-key menu-bar-epatch-menu [ediff-patch-file] (quote ("To a File..." . ediff-patch-file))) (define-key menu-bar-ediff-misc-menu [emultiframe] (quote ("Toggle use of separate control buffer frame..." . ediff-toggle-multiframe))) (define-key menu-bar-ediff-misc-menu [eregistry] (quote ("List Ediff Sessions..." . ediff-show-registry))) (define-key menu-bar-ediff-misc-menu [ediff-cust] (quote ("Customize Ediff..." . ediff-customize))) (define-key menu-bar-ediff-misc-menu [ediff-doc] (quote ("Ediff Manual..." . ediff-documentation))))))
+(ediff-cond-compile-for-xemacs-or-emacs (progn (defvar ediff-menu (quote ("Compare" ["Two Files..." ediff-files t] ["Two Buffers..." ediff-buffers t] ["Three Files..." ediff-files3 t] ["Three Buffers..." ediff-buffers3 t] "---" ["Two Directories..." ediff-directories t] ["Three Directories..." ediff-directories3 t] "---" ["File with Revision..." ediff-revision t] ["Directory Revisions..." ediff-directory-revisions t] "---" ["Windows Word-by-word..." ediff-windows-wordwise t] ["Windows Line-by-line..." ediff-windows-linewise t] "---" ["Regions Word-by-word..." ediff-regions-wordwise t] ["Regions Line-by-line..." ediff-regions-linewise t]))) (defvar ediff-merge-menu (quote ("Merge" ["Files..." ediff-merge-files t] ["Files with Ancestor..." ediff-merge-files-with-ancestor t] ["Buffers..." ediff-merge-buffers t] ["Buffers with Ancestor..." ediff-merge-buffers-with-ancestor t] "---" ["Directories..." ediff-merge-directories t] ["Directories with Ancestor..." ediff-merge-directories-with-ancestor t] "---" ["Revisions..." ediff-merge-revisions t] ["Revisions with Ancestor..." ediff-merge-revisions-with-ancestor t] ["Directory Revisions..." ediff-merge-directory-revisions t] ["Directory Revisions with Ancestor..." ediff-merge-directory-revisions-with-ancestor t]))) (defvar epatch-menu (quote ("Apply Patch" ["To a file..." ediff-patch-file t] ["To a buffer..." ediff-patch-buffer t]))) (defvar ediff-misc-menu (quote ("Ediff Miscellanea" ["Ediff Manual" ediff-documentation t] ["Customize Ediff" ediff-customize t] ["List Ediff Sessions" ediff-show-registry t] ["Use separate frame for Ediff control buffer" ediff-toggle-multiframe :style toggle :selected (if (and (featurep (quote ediff-util)) (boundp (quote ediff-window-setup-function))) (eq ediff-window-setup-function (quote ediff-setup-windows-multiframe)))] ["Use a toolbar with Ediff control buffer" ediff-toggle-use-toolbar :style toggle :selected (if (featurep (quote ediff-tbar)) (ediff-use-toolbar-p))]))) (if (and (featurep (quote menubar)) (not (featurep (quote infodock))) (not (featurep (quote ediff-hook)))) (ediff-xemacs-init-menus))) (if (featurep (quote menu-bar)) (progn (defvar menu-bar-ediff-misc-menu (make-sparse-keymap "Ediff Miscellanea")) (fset (quote menu-bar-ediff-misc-menu) (symbol-value (quote menu-bar-ediff-misc-menu))) (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch")) (fset (quote menu-bar-epatch-menu) (symbol-value (quote menu-bar-epatch-menu))) (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge")) (fset (quote menu-bar-ediff-merge-menu) (symbol-value (quote menu-bar-ediff-merge-menu))) (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare")) (fset (quote menu-bar-ediff-menu) (symbol-value (quote menu-bar-ediff-menu))) (define-key menu-bar-ediff-menu [window] (quote ("This Window and Next Window" . compare-windows))) (define-key menu-bar-ediff-menu [ediff-windows-linewise] (quote ("Windows Line-by-line..." . ediff-windows-linewise))) (define-key menu-bar-ediff-menu [ediff-windows-wordwise] (quote ("Windows Word-by-word..." . ediff-windows-wordwise))) (define-key menu-bar-ediff-menu [separator-ediff-windows] (quote ("--"))) (define-key menu-bar-ediff-menu [ediff-regions-linewise] (quote ("Regions Line-by-line..." . ediff-regions-linewise))) (define-key menu-bar-ediff-menu [ediff-regions-wordwise] (quote ("Regions Word-by-word..." . ediff-regions-wordwise))) (define-key menu-bar-ediff-menu [separator-ediff-regions] (quote ("--"))) (define-key menu-bar-ediff-menu [ediff-dir-revision] (quote ("Directory Revisions..." . ediff-directory-revisions))) (define-key menu-bar-ediff-menu [ediff-revision] (quote ("File with Revision..." . ediff-revision))) (define-key menu-bar-ediff-menu [separator-ediff-directories] (quote ("--"))) (define-key menu-bar-ediff-menu [ediff-directories3] (quote ("Three Directories..." . ediff-directories3))) (define-key menu-bar-ediff-menu [ediff-directories] (quote ("Two Directories..." . ediff-directories))) (define-key menu-bar-ediff-menu [separator-ediff-files] (quote ("--"))) (define-key menu-bar-ediff-menu [ediff-buffers3] (quote ("Three Buffers..." . ediff-buffers3))) (define-key menu-bar-ediff-menu [ediff-files3] (quote ("Three Files..." . ediff-files3))) (define-key menu-bar-ediff-menu [ediff-buffers] (quote ("Two Buffers..." . ediff-buffers))) (define-key menu-bar-ediff-menu [ediff-files] (quote ("Two Files..." . ediff-files))) (define-key menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor] (quote ("Directory Revisions with Ancestor..." . ediff-merge-directory-revisions-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-dir-revisions] (quote ("Directory Revisions..." . ediff-merge-directory-revisions))) (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor] (quote ("Revisions with Ancestor..." . ediff-merge-revisions-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions] (quote ("Revisions..." . ediff-merge-revisions))) (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] (quote ("--"))) (define-key menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor] (quote ("Directories with Ancestor..." . ediff-merge-directories-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-directories] (quote ("Directories..." . ediff-merge-directories))) (define-key menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] (quote ("--"))) (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor] (quote ("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers] (quote ("Buffers..." . ediff-merge-buffers))) (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor] (quote ("Files with Ancestor..." . ediff-merge-files-with-ancestor))) (define-key menu-bar-ediff-merge-menu [ediff-merge-files] (quote ("Files..." . ediff-merge-files))) (define-key menu-bar-epatch-menu [ediff-patch-buffer] (quote ("To a Buffer..." . ediff-patch-buffer))) (define-key menu-bar-epatch-menu [ediff-patch-file] (quote ("To a File..." . ediff-patch-file))) (define-key menu-bar-ediff-misc-menu [emultiframe] (quote ("Toggle use of separate control buffer frame" . ediff-toggle-multiframe))) (define-key menu-bar-ediff-misc-menu [eregistry] (quote ("List Ediff Sessions" . ediff-show-registry))) (define-key menu-bar-ediff-misc-menu [ediff-cust] (quote ("Customize Ediff" . ediff-customize))) (define-key menu-bar-ediff-misc-menu [ediff-doc] (quote ("Ediff Manual" . ediff-documentation))))))
 
 ;;;***
 \f
 ;;;### (autoloads (ediff-show-registry) "ediff-mult" "ediff-mult.el"
-;;;;;;  (16923 3605))
+;;;;;;  (17087 12569))
 ;;; Generated autoloads from ediff-mult.el
 
 (autoload (quote ediff-show-registry) "ediff-mult" "\
@@ -7875,7 +8023,7 @@ Display Ediff's registry.
 ;;;***
 \f
 ;;;### (autoloads (ediff-toggle-use-toolbar ediff-toggle-multiframe)
-;;;;;;  "ediff-util" "ediff-util.el" (16442 4953))
+;;;;;;  "ediff-util" "ediff-util.el" (17087 12566))
 ;;; Generated autoloads from ediff-util.el
 
 (autoload (quote ediff-toggle-multiframe) "ediff-util" "\
@@ -7896,7 +8044,7 @@ To change the default, set the variable `ediff-use-toolbar-p', which see.
 \f
 ;;;### (autoloads (format-kbd-macro read-kbd-macro edit-named-kbd-macro
 ;;;;;;  edit-last-kbd-macro edit-kbd-macro) "edmacro" "edmacro.el"
-;;;;;;  (16822 52984))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from edmacro.el
 
 (defvar edmacro-eight-bits nil "\
@@ -7949,7 +8097,7 @@ or nil, use a compact 80-column format.
 ;;;***
 \f
 ;;;### (autoloads (edt-emulation-on edt-set-scroll-margins) "edt"
-;;;;;;  "emulation/edt.el" (16213 43273))
+;;;;;;  "emulation/edt.el" (17087 12564))
 ;;; Generated autoloads from emulation/edt.el
 
 (autoload (quote edt-set-scroll-margins) "edt" "\
@@ -7967,7 +8115,7 @@ Turn on EDT Emulation.
 ;;;***
 \f
 ;;;### (autoloads (electric-helpify with-electric-help) "ehelp" "ehelp.el"
-;;;;;;  (16775 26706))
+;;;;;;  (17087 12438))
 ;;; Generated autoloads from ehelp.el
 
 (autoload (quote with-electric-help) "ehelp" "\
@@ -8005,7 +8153,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (turn-on-eldoc-mode eldoc-mode eldoc-minor-mode-string)
-;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (16507 41097))
+;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (17087 12564))
 ;;; Generated autoloads from emacs-lisp/eldoc.el
 
 (defvar eldoc-minor-mode-string " ElDoc" "\
@@ -8015,16 +8163,11 @@ Not documented
 
 (autoload (quote eldoc-mode) "eldoc" "\
 Toggle ElDoc mode on or off.
-Show the defined parameters for the elisp function near point.
-
-For the emacs lisp function at the beginning of the sexp which point is
-within, show the defined parameters for the function in the echo area.
-This information is extracted directly from the function or macro if it is
-in pure lisp.  If the emacs function is a subr, the parameters are obtained
-from the documentation string if possible.
-
-If point is over a documented variable, print that variable's docstring
-instead.
+In ElDoc mode, the echo area displays information about a
+function or variable in the text where point is.  If point is
+on a documented variable, it displays the first line of that
+variable's doc string.  Otherwise it displays the argument list
+of the function called in the expression point is on.
 
 With prefix ARG, turn ElDoc mode on if and only if ARG is positive.
 
@@ -8035,10 +8178,21 @@ Unequivocally turn on eldoc-mode (see variable documentation).
 
 \(fn)" t nil)
 
+(defvar eldoc-documentation-function nil "\
+If non-nil, function to call to return doc string.
+The function of no args should return a one-line string for displaying
+doc about a function etc. appropriate to the context around point.
+It should return nil if there's no doc appropriate for the context.
+Typically doc is returned if point is on a function-like name or in its
+arg list.
+
+This variable is expected to be made buffer-local by modes (other than
+Emacs Lisp mode) that support Eldoc.")
+
 ;;;***
 \f
-;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (16768
-;;;;;;  48631))
+;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (17087
+;;;;;;  12436))
 ;;; Generated autoloads from elide-head.el
 
 (autoload (quote elide-head) "elide-head" "\
@@ -8054,7 +8208,7 @@ This is suitable as an entry on `find-file-hook' or appropriate mode hooks.
 ;;;***
 \f
 ;;;### (autoloads (elint-initialize) "elint" "emacs-lisp/elint.el"
-;;;;;;  (16870 21079))
+;;;;;;  (17087 12574))
 ;;; Generated autoloads from emacs-lisp/elint.el
 
 (autoload (quote elint-initialize) "elint" "\
@@ -8065,8 +8219,8 @@ Initialize elint.
 ;;;***
 \f
 ;;;### (autoloads (elp-results elp-instrument-package elp-instrument-list
-;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (16783
-;;;;;;  21522))
+;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (17087
+;;;;;;  12440))
 ;;; Generated autoloads from emacs-lisp/elp.el
 
 (autoload (quote elp-instrument-function) "elp" "\
@@ -8100,7 +8254,7 @@ displayed.
 ;;;***
 \f
 ;;;### (autoloads (report-emacs-bug) "emacsbug" "mail/emacsbug.el"
-;;;;;;  (16804 23129))
+;;;;;;  (17087 12582))
 ;;; Generated autoloads from mail/emacsbug.el
 
 (autoload (quote report-emacs-bug) "emacsbug" "\
@@ -8115,7 +8269,7 @@ Prompts for bug subject.  Leaves you in a mail buffer.
 ;;;;;;  emerge-revisions emerge-files-with-ancestor-remote emerge-files-remote
 ;;;;;;  emerge-files-with-ancestor-command emerge-files-command emerge-buffers-with-ancestor
 ;;;;;;  emerge-buffers emerge-files-with-ancestor emerge-files) "emerge"
-;;;;;;  "emerge.el" (16381 6707))
+;;;;;;  "emerge.el" (17087 12564))
 ;;; Generated autoloads from emerge.el
 
 (defvar menu-bar-emerge-menu (make-sparse-keymap "Emerge"))
@@ -8192,36 +8346,21 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (encoded-kbd-mode) "encoded-kb" "international/encoded-kb.el"
-;;;;;;  (16884 52115))
+;;;### (autoloads (encoded-kbd-setup-display) "encoded-kb" "international/encoded-kb.el"
+;;;;;;  (17087 11580))
 ;;; Generated autoloads from international/encoded-kb.el
 
-(defvar encoded-kbd-mode nil "\
-Non-nil if Encoded-Kbd mode is enabled.
-See the command `encoded-kbd-mode' for a description of this minor-mode.
-Setting this variable directly does not take effect;
-use either \\[customize] or the function `encoded-kbd-mode'.")
-
-(custom-autoload (quote encoded-kbd-mode) "encoded-kb")
+(autoload (quote encoded-kbd-setup-display) "encoded-kb" "\
+Set up a `key-translation-map' for `keyboard-coding-system' on DISPLAY.
 
-(autoload (quote encoded-kbd-mode) "encoded-kb" "\
-Toggle Encoded-kbd minor mode.
-With arg, turn Encoded-kbd mode on if and only if arg is positive.
+DISPLAY may be a display id, a frame, or nil for the selected frame's display.
 
-You should not turn this mode on manually, instead use the command
-\\[set-keyboard-coding-system] which turns on or off this mode
-automatically.
-
-In Encoded-kbd mode, a text sent from keyboard is accepted
-as a multilingual text encoded in a coding system set by
-\\[set-keyboard-coding-system].
-
-\(fn &optional ARG)" t nil)
+\(fn DISPLAY)" nil nil)
 
 ;;;***
 \f
 ;;;### (autoloads (enriched-decode enriched-encode enriched-mode)
-;;;;;;  "enriched" "textmodes/enriched.el" (16738 29931))
+;;;;;;  "enriched" "textmodes/enriched.el" (17087 12528))
 ;;; Generated autoloads from textmodes/enriched.el
 
 (autoload (quote enriched-mode) "enriched" "\
@@ -8251,8 +8390,8 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (16777
-;;;;;;  65418))
+;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (17087
+;;;;;;  12574))
 ;;; Generated autoloads from eshell/esh-mode.el
 
 (autoload (quote eshell-mode) "esh-mode" "\
@@ -8264,8 +8403,8 @@ Emacs shell interactive mode.
 
 ;;;***
 \f
-;;;### (autoloads (eshell-test) "esh-test" "eshell/esh-test.el" (16858
-;;;;;;  50924))
+;;;### (autoloads (eshell-test) "esh-test" "eshell/esh-test.el" (17087
+;;;;;;  12574))
 ;;; Generated autoloads from eshell/esh-test.el
 
 (autoload (quote eshell-test) "esh-test" "\
@@ -8276,7 +8415,7 @@ Test Eshell to verify that it works as expected.
 ;;;***
 \f
 ;;;### (autoloads (eshell-report-bug eshell-command-result eshell-command
-;;;;;;  eshell) "eshell" "eshell/eshell.el" (16484 6599))
+;;;;;;  eshell) "eshell" "eshell/eshell.el" (17087 12380))
 ;;; Generated autoloads from eshell/eshell.el
 
 (autoload (quote eshell) "eshell" "\
@@ -8321,8 +8460,8 @@ Please include any configuration details that might be involved.
 ;;;;;;  find-tag find-tag-noselect tags-table-files visit-tags-table-buffer
 ;;;;;;  visit-tags-table find-tag-default-function find-tag-hook
 ;;;;;;  tags-add-tables tags-compression-info-list tags-table-list
-;;;;;;  tags-case-fold-search) "etags" "progmodes/etags.el" (16746
-;;;;;;  18215))
+;;;;;;  tags-case-fold-search) "etags" "progmodes/etags.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from progmodes/etags.el
 
 (defvar tags-file-name nil "\
@@ -8619,7 +8758,7 @@ for \\[find-tag] (which see).
 ;;;;;;  ethio-fidel-to-sera-buffer ethio-fidel-to-sera-region ethio-sera-to-fidel-marker
 ;;;;;;  ethio-sera-to-fidel-mail ethio-sera-to-fidel-mail-or-marker
 ;;;;;;  ethio-sera-to-fidel-buffer ethio-sera-to-fidel-region setup-ethiopic-environment-internal)
-;;;;;;  "ethio-util" "language/ethio-util.el" (16953 20625))
+;;;;;;  "ethio-util" "language/ethio-util.el" (17087 12575))
 ;;; Generated autoloads from language/ethio-util.el
 
 (autoload (quote setup-ethiopic-environment-internal) "ethio-util" "\
@@ -8814,7 +8953,7 @@ Transcribe Ethiopic characters in ASCII depending on the file extension.
 \f
 ;;;### (autoloads (eudc-load-eudc eudc-query-form eudc-expand-inline
 ;;;;;;  eudc-get-phone eudc-get-email eudc-set-server) "eudc" "net/eudc.el"
-;;;;;;  (16884 52115))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from net/eudc.el
 
 (autoload (quote eudc-set-server) "eudc" "\
@@ -8870,7 +9009,7 @@ This does nothing except loading eudc by autoload side-effect.
 \f
 ;;;### (autoloads (eudc-display-jpeg-as-button eudc-display-jpeg-inline
 ;;;;;;  eudc-display-sound eudc-display-mail eudc-display-url eudc-display-generic-binary)
-;;;;;;  "eudc-bob" "net/eudc-bob.el" (16213 43280))
+;;;;;;  "eudc-bob" "net/eudc-bob.el" (17087 12380))
 ;;; Generated autoloads from net/eudc-bob.el
 
 (autoload (quote eudc-display-generic-binary) "eudc-bob" "\
@@ -8906,7 +9045,7 @@ Display a button for the JPEG DATA.
 ;;;***
 \f
 ;;;### (autoloads (eudc-try-bbdb-insert eudc-insert-record-at-point-into-bbdb)
-;;;;;;  "eudc-export" "net/eudc-export.el" (16213 43280))
+;;;;;;  "eudc-export" "net/eudc-export.el" (17087 12380))
 ;;; Generated autoloads from net/eudc-export.el
 
 (autoload (quote eudc-insert-record-at-point-into-bbdb) "eudc-export" "\
@@ -8923,7 +9062,7 @@ Call `eudc-insert-record-at-point-into-bbdb' if on a record.
 ;;;***
 \f
 ;;;### (autoloads (eudc-edit-hotlist) "eudc-hotlist" "net/eudc-hotlist.el"
-;;;;;;  (16213 43280))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from net/eudc-hotlist.el
 
 (autoload (quote eudc-edit-hotlist) "eudc-hotlist" "\
@@ -8935,8 +9074,8 @@ Edit the hotlist of directory servers in a specialized buffer.
 \f
 ;;;### (autoloads (executable-make-buffer-file-executable-if-script-p
 ;;;;;;  executable-self-display executable-set-magic executable-interpret
-;;;;;;  executable-find executable-command-find-posix-p) "executable"
-;;;;;;  "progmodes/executable.el" (16858 50935))
+;;;;;;  executable-command-find-posix-p) "executable" "progmodes/executable.el"
+;;;;;;  (17087 12558))
 ;;; Generated autoloads from progmodes/executable.el
 
 (autoload (quote executable-command-find-posix-p) "executable" "\
@@ -8945,12 +9084,6 @@ If PROGRAM is non-nil, use that instead of \"find\".
 
 \(fn &optional PROGRAM)" nil nil)
 
-(autoload (quote executable-find) "executable" "\
-Search for COMMAND in `exec-path' and return the absolute file name.
-Return nil if COMMAND is not found anywhere in `exec-path'.
-
-\(fn COMMAND)" nil nil)
-
 (autoload (quote executable-interpret) "executable" "\
 Run script with user-specified args, and collect output in a buffer.
 While script runs asynchronously, you can use the \\[next-error]
@@ -8984,7 +9117,7 @@ file modes.
 ;;;***
 \f
 ;;;### (autoloads (expand-jump-to-next-slot expand-jump-to-previous-slot
-;;;;;;  expand-add-abbrevs) "expand" "expand.el" (16213 43267))
+;;;;;;  expand-add-abbrevs) "expand" "expand.el" (17087 12380))
 ;;; Generated autoloads from expand.el
 
 (autoload (quote expand-add-abbrevs) "expand" "\
@@ -9027,7 +9160,7 @@ This is used only in conjunction with `expand-add-abbrevs'.
 
 ;;;***
 \f
-;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (16858 50935))
+;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (17087 12566))
 ;;; Generated autoloads from progmodes/f90.el
 
 (autoload (quote f90-mode) "f90" "\
@@ -9096,7 +9229,7 @@ with no args, if that value is non-nil.
 ;;;;;;  facemenu-remove-all facemenu-remove-face-props facemenu-set-read-only
 ;;;;;;  facemenu-set-intangible facemenu-set-invisible facemenu-set-face-from-menu
 ;;;;;;  facemenu-set-background facemenu-set-foreground facemenu-set-face)
-;;;;;;  "facemenu" "facemenu.el" (16942 52929))
+;;;;;;  "facemenu" "facemenu.el" (17087 12589))
 ;;; Generated autoloads from facemenu.el
  (define-key global-map "\M-o" 'facemenu-keymap)
  (autoload 'facemenu-keymap "facemenu" "Keymap for face-changing commands." t 'keymap)
@@ -9256,8 +9389,8 @@ argument BUFFER-NAME is nil, it defaults to *Colors*.
 ;;;***
 \f
 ;;;### (autoloads (turn-on-fast-lock fast-lock-mode) "fast-lock"
-;;;;;;  "fast-lock.el" (16777 65418))
-;;; Generated autoloads from fast-lock.el
+;;;;;;  "obsolete/fast-lock.el" (17087 12438))
+;;; Generated autoloads from obsolete/fast-lock.el
 
 (autoload (quote fast-lock-mode) "fast-lock" "\
 Toggle Fast Lock mode.
@@ -9297,7 +9430,7 @@ Unconditionally turn on Fast Lock mode.
 \f
 ;;;### (autoloads (feedmail-queue-reminder feedmail-run-the-queue
 ;;;;;;  feedmail-run-the-queue-global-prompt feedmail-run-the-queue-no-prompts
-;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (16213 43280))
+;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (17087 12564))
 ;;; Generated autoloads from mail/feedmail.el
 
 (autoload (quote feedmail-send-it) "feedmail" "\
@@ -9351,7 +9484,7 @@ you can set feedmail-queue-reminder-alist to nil.
 ;;;***
 \f
 ;;;### (autoloads (ffap-bindings dired-at-point ffap-at-mouse ffap-menu
-;;;;;;  find-file-at-point ffap-next) "ffap" "ffap.el" (16858 50909))
+;;;;;;  find-file-at-point ffap-next) "ffap" "ffap.el" (17087 12530))
 ;;; Generated autoloads from ffap.el
 
 (autoload (quote ffap-next) "ffap" "\
@@ -9410,7 +9543,7 @@ Evaluate the forms in variable `ffap-bindings'.
 ;;;***
 \f
 ;;;### (autoloads (file-cache-minibuffer-complete) "filecache" "filecache.el"
-;;;;;;  (16830 50347))
+;;;;;;  (17087 12449))
 ;;; Generated autoloads from filecache.el
 
 (autoload (quote file-cache-minibuffer-complete) "filecache" "\
@@ -9426,11 +9559,23 @@ the name is considered already unique; only the second substitution
  (define-key minibuffer-local-map [C-tab] 'file-cache-minibuffer-complete)
  (define-key minibuffer-local-must-match-map [C-tab] 'file-cache-minibuffer-complete)
 
+;;;***
+\f
+;;;### (autoloads (filesets-init) "filesets" "filesets.el" (17087
+;;;;;;  12569))
+;;; Generated autoloads from filesets.el
+
+(autoload (quote filesets-init) "filesets" "\
+Filesets initialization.
+Set up hooks, load the cache file -- if existing -- and build the menu.
+
+\(fn)" nil nil)
+
 ;;;***
 \f
 ;;;### (autoloads (find-grep-dired find-name-dired find-dired find-grep-options
 ;;;;;;  find-ls-subdir-switches find-ls-option) "find-dired" "find-dired.el"
-;;;;;;  (16908 33360))
+;;;;;;  (17087 12466))
 ;;; Generated autoloads from find-dired.el
 
 (defvar find-ls-option (if (eq system-type (quote berkeley-unix)) (quote ("-ls" . "-gilsb")) (quote ("-exec ls -ld {} \\;" . "-ld"))) "\
@@ -9491,12 +9636,12 @@ Thus ARG can also contain additional grep options.
 \f
 ;;;### (autoloads (ff-mouse-find-other-file-other-window ff-mouse-find-other-file
 ;;;;;;  ff-find-other-file ff-get-other-file) "find-file" "find-file.el"
-;;;;;;  (16767 25304))
+;;;;;;  (17087 12574))
 ;;; Generated autoloads from find-file.el
 
 (defvar ff-special-constructs (quote (("^#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]" lambda nil (setq fname (buffer-substring (match-beginning 2) (match-end 2)))))) "\
 *A list of regular expressions for `ff-find-file'.
-Specifies how to recognise special constructs such as include files
+Specifies how to recognize special constructs such as include files
 etc. and an associated method for extracting the filename from that
 construct.")
 
@@ -9537,7 +9682,7 @@ Variables of interest include:
    If non-nil, traces which directories are being searched.
 
  - `ff-special-constructs'
-   A list of regular expressions specifying how to recognise special
+   A list of regular expressions specifying how to recognize special
    constructs such as include files etc, and an associated method for
    extracting the filename from that construct.
 
@@ -9583,7 +9728,7 @@ Visit the file you click on in another window.
 ;;;;;;  find-variable find-variable-noselect find-function-other-frame
 ;;;;;;  find-function-other-window find-function find-function-noselect
 ;;;;;;  find-function-search-for-symbol find-library) "find-func"
-;;;;;;  "emacs-lisp/find-func.el" (16953 20625))
+;;;;;;  "emacs-lisp/find-func.el" (17087 12567))
 ;;; Generated autoloads from emacs-lisp/find-func.el
 
 (autoload (quote find-library) "find-func" "\
@@ -9732,7 +9877,7 @@ Define some key bindings for the find-function family of functions.
 ;;;***
 \f
 ;;;### (autoloads (find-lisp-find-dired-filter find-lisp-find-dired-subdirectories
-;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (16213 43268))
+;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (17087 12380))
 ;;; Generated autoloads from find-lisp.el
 
 (autoload (quote find-lisp-find-dired) "find-lisp" "\
@@ -9753,7 +9898,7 @@ Change the filter on a find-lisp-find-dired buffer to REGEXP.
 ;;;***
 \f
 ;;;### (autoloads (finder-by-keyword finder-commentary finder-list-keywords)
-;;;;;;  "finder" "finder.el" (16958 58756))
+;;;;;;  "finder" "finder.el" (17087 12564))
 ;;; Generated autoloads from finder.el
 
 (autoload (quote finder-list-keywords) "finder" "\
@@ -9775,7 +9920,7 @@ Find packages matching a given keyword.
 ;;;***
 \f
 ;;;### (autoloads (enable-flow-control-on enable-flow-control) "flow-ctrl"
-;;;;;;  "flow-ctrl.el" (16213 43268))
+;;;;;;  "flow-ctrl.el" (17087 12380))
 ;;; Generated autoloads from flow-ctrl.el
 
 (autoload (quote enable-flow-control) "flow-ctrl" "\
@@ -9797,7 +9942,7 @@ to get the effect of a C-q.
 ;;;***
 \f
 ;;;### (autoloads (fill-flowed fill-flowed-encode) "flow-fill" "gnus/flow-fill.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12466))
 ;;; Generated autoloads from gnus/flow-fill.el
 
 (autoload (quote fill-flowed-encode) "flow-fill" "\
@@ -9812,11 +9957,16 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (flymake-mode-off flymake-mode-on) "flymake" "progmodes/flymake.el"
-;;;;;;  (16808 48570))
+;;;### (autoloads (flymake-mode-off flymake-mode-on flymake-mode)
+;;;;;;  "flymake" "progmodes/flymake.el" (17087 12570))
 ;;; Generated autoloads from progmodes/flymake.el
 
-(unless (assq (quote flymake-mode) minor-mode-alist) (setq minor-mode-alist (cons (quote (flymake-mode flymake-mode-line)) minor-mode-alist)))
+(autoload (quote flymake-mode) "flymake" "\
+Minor mode to do on-the-fly syntax checking.
+When called interactively, toggles the minor mode.
+With arg, turn Flymake mode on if and only if arg is positive.
+
+\(fn &optional ARG)" t nil)
 
 (autoload (quote flymake-mode-on) "flymake" "\
 Turn flymake mode on.
@@ -9831,25 +9981,15 @@ Turn flymake mode off.
 ;;;***
 \f
 ;;;### (autoloads (flyspell-buffer flyspell-region flyspell-mode-off
-;;;;;;  flyspell-version flyspell-mode flyspell-prog-mode flyspell-mode-line-string)
-;;;;;;  "flyspell" "textmodes/flyspell.el" (16939 44105))
+;;;;;;  flyspell-mode flyspell-prog-mode) "flyspell" "textmodes/flyspell.el"
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from textmodes/flyspell.el
 
-(defvar flyspell-mode-line-string " Fly" "\
-*String displayed on the modeline when flyspell is active.
-Set this to nil if you don't want a modeline indicator.")
-
-(custom-autoload (quote flyspell-mode-line-string) "flyspell")
-
 (autoload (quote flyspell-prog-mode) "flyspell" "\
 Turn on `flyspell-mode' for comments and strings.
 
 \(fn)" t nil)
 
-(defvar flyspell-mode nil)
-
-(defvar flyspell-mode-map (make-sparse-keymap))
-
 (autoload (quote flyspell-mode) "flyspell" "\
 Minor mode performing on-the-fly spelling checking.
 This spawns a single Ispell process and checks each word.
@@ -9860,7 +10000,8 @@ With a prefix argument ARG, turn Flyspell minor mode on iff ARG is positive.
 Bindings:
 \\[ispell-word]: correct words (using Ispell).
 \\[flyspell-auto-correct-word]: automatically correct word.
-\\[flyspell-correct-word] (or mouse-2): popup correct words.
+\\[flyspell-auto-correct-previous-word]: automatically correct the last misspelled word.
+\\[flyspell-correct-word] (or down-mouse-2): popup correct words.
 
 Hooks:
 This runs `flyspell-mode-hook' after flyspell is entered.
@@ -9880,13 +10021,6 @@ in your .emacs file.
 
 \(fn &optional ARG)" t nil)
 
-(add-minor-mode (quote flyspell-mode) (quote flyspell-mode-line-string) flyspell-mode-map nil (quote flyspell-mode))
-
-(autoload (quote flyspell-version) "flyspell" "\
-The flyspell version
-
-\(fn)" t nil)
-
 (autoload (quote flyspell-mode-off) "flyspell" "\
 Turn Flyspell mode off.
 
@@ -9906,7 +10040,7 @@ Flyspell whole buffer.
 \f
 ;;;### (autoloads (follow-delete-other-windows-and-split follow-mode
 ;;;;;;  turn-off-follow-mode turn-on-follow-mode) "follow" "follow.el"
-;;;;;;  (16534 3807))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from follow.el
 
 (autoload (quote turn-on-follow-mode) "follow" "\
@@ -9982,7 +10116,7 @@ in your `~/.emacs' file, replacing [f7] by your favourite key:
 \f
 ;;;### (autoloads (font-lock-fontify-buffer font-lock-remove-keywords
 ;;;;;;  font-lock-add-keywords font-lock-mode-internal) "font-lock"
-;;;;;;  "font-lock.el" (16960 18194))
+;;;;;;  "font-lock.el" (17087 12574))
 ;;; Generated autoloads from font-lock.el
 
 (autoload (quote font-lock-mode-internal) "font-lock" "\
@@ -9992,6 +10126,7 @@ Not documented
 
 (autoload (quote font-lock-add-keywords) "font-lock" "\
 Add highlighting KEYWORDS for MODE.
+
 MODE should be a symbol, the major mode command name, such as `c-mode'
 or nil.  If nil, highlighting keywords are added for the current buffer.
 KEYWORDS should be a list; see the variable `font-lock-keywords'.
@@ -10009,9 +10144,22 @@ For example:
 adds two fontification patterns for C mode, to fontify `FIXME:' words, even in
 comments, and to fontify `and', `or' and `not' words as keywords.
 
-When used from an elisp package (such as a minor mode), it is recommended
-to use nil for MODE (and place the call in a loop or on a hook) to avoid
-subtle problems due to details of the implementation.
+The above procedure will only add the keywords for C mode, not
+for modes derived from C mode.  To add them for derived modes too,
+pass nil for MODE and add the call to c-mode-hook.
+
+For example:
+
+ (add-hook 'c-mode-hook
+  (lambda ()
+   (font-lock-add-keywords nil
+    '((\"\\\\\\=<\\\\(FIXME\\\\):\" 1 font-lock-warning-face prepend)
+      (\"\\\\\\=<\\\\(and\\\\|or\\\\|not\\\\)\\\\\\=>\" .
+       font-lock-keyword-face)))))
+
+The above procedure may fail to add keywords to derived modes if
+some involved major mode does not follow the standard conventions.
+File a bug report if this happens, so the major mode can be corrected.
 
 Note that some modes have specialized support for additional patterns, e.g.,
 see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
@@ -10025,9 +10173,11 @@ Remove highlighting KEYWORDS for MODE.
 MODE should be a symbol, the major mode command name, such as `c-mode'
 or nil.  If nil, highlighting keywords are removed for the current buffer.
 
-When used from an elisp package (such as a minor mode), it is recommended
-to use nil for MODE (and place the call in a loop or on a hook) to avoid
-subtle problems due to details of the implementation.
+To make the removal apply to modes derived from MODE as well,
+pass nil for MODE and add the call to MODE-hook.  This may fail
+for some derived modes if some involved major mode does not
+follow the standard conventions.  File a bug report if this
+happens, so the major mode can be corrected.
 
 \(fn MODE KEYWORDS)" nil nil)
 
@@ -10038,8 +10188,8 @@ Fontify the current buffer the way the function `font-lock-mode' would.
 
 ;;;***
 \f
-;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (16908
-;;;;;;  33362))
+;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (17087
+;;;;;;  12466))
 ;;; Generated autoloads from mail/footnote.el
 
 (autoload (quote footnote-mode) "footnote" "\
@@ -10060,7 +10210,7 @@ key             binding
 ;;;***
 \f
 ;;;### (autoloads (forms-find-file-other-window forms-find-file forms-mode)
-;;;;;;  "forms" "forms.el" (16507 41097))
+;;;;;;  "forms" "forms.el" (17087 12569))
 ;;; Generated autoloads from forms.el
 
 (autoload (quote forms-mode) "forms" "\
@@ -10097,7 +10247,7 @@ Visit a file in Forms mode in other window.
 ;;;***
 \f
 ;;;### (autoloads (fortran-mode fortran-tab-mode-default) "fortran"
-;;;;;;  "progmodes/fortran.el" (16908 33362))
+;;;;;;  "progmodes/fortran.el" (17087 12566))
 ;;; Generated autoloads from progmodes/fortran.el
 
 (defvar fortran-tab-mode-default nil "\
@@ -10122,7 +10272,7 @@ Key definitions:
 
 Variables controlling indentation style and extra features:
 
-`comment-start'
+`fortran-comment-line-start'
   To use comments starting with `!', set this to the string \"!\".
 `fortran-do-indent'
   Extra indentation within DO blocks (default 3).
@@ -10183,7 +10333,7 @@ with no args, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (fortune fortune-to-signature fortune-compile fortune-from-region
-;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (16775 26716))
+;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (17087 12558))
 ;;; Generated autoloads from play/fortune.el
 
 (autoload (quote fortune-add-fortune) "fortune" "\
@@ -10233,7 +10383,7 @@ and choose the directory as the fortune-file.
 ;;;***
 \f
 ;;;### (autoloads (fringe-indicators set-fringe-style fringe-mode
-;;;;;;  fringe-mode) "fringe" "fringe.el" (16908 33360))
+;;;;;;  fringe-mode) "fringe" "fringe.el" (17087 12466))
 ;;; Generated autoloads from fringe.el
 
 (defvar fringe-mode nil "\
@@ -10309,7 +10459,7 @@ Setting this variable, changes `default-indicate-buffer-boundaries'.")
 
 ;;;***
 \f
-;;;### (autoloads (gdba) "gdb-ui" "progmodes/gdb-ui.el" (16960 18194))
+;;;### (autoloads (gdba) "gdb-ui" "progmodes/gdb-ui.el" (17087 12582))
 ;;; Generated autoloads from progmodes/gdb-ui.el
 
 (autoload (quote gdba) "gdb-ui" "\
@@ -10366,9 +10516,10 @@ detailed description of this mode.
 
 ;;;***
 \f
-;;;### (autoloads (generic-mode generic-mode-internal define-generic-mode)
-;;;;;;  "generic" "generic.el" (16960 18194))
-;;; Generated autoloads from generic.el
+;;;### (autoloads (generic-make-keywords-list generic-mode generic-mode-internal
+;;;;;;  define-generic-mode) "generic" "emacs-lisp/generic.el" (17087
+;;;;;;  12558))
+;;; Generated autoloads from emacs-lisp/generic.el
 
 (defvar generic-mode-list nil "\
 A list of mode names for `generic-mode'.
@@ -10378,33 +10529,34 @@ instead (which see).")
 (autoload (quote define-generic-mode) "generic" "\
 Create a new generic mode MODE.
 
-MODE is the name of the command for the generic mode; it need not
-be quoted.  The optional DOCSTRING is the documentation for the
-mode command.  If you do not supply it, a default documentation
-string will be used instead.
+MODE is the name of the command for the generic mode; don't quote it.
+The optional DOCSTRING is the documentation for the mode command.  If
+you do not supply it, `define-generic-mode' uses a default
+documentation string instead.
 
-COMMENT-LIST is a list, whose entries are either a single
-character, a one or two character string or a cons pair.  If the
-entry is a character or a string, it is added to the mode's
-syntax table with `comment-start' syntax.  If the entry is a cons
-pair, the elements of the pair are considered to be
-`comment-start' and `comment-end' respectively.  (The latter
-should be nil if you want comments to end at end of line.)  Note
-that Emacs has limitations regarding comment characters.
+COMMENT-LIST is a list in which each element is either a character, a
+string of one or two characters, or a cons cell.  A character or a
+string is set up in the mode's syntax table as a \"comment starter\".
+If the entry is a cons cell, the `car' is set up as a \"comment
+starter\" and the `cdr' as a \"comment ender\".  (Use nil for the
+latter if you want comments to end at the end of the line.)  Note that
+the syntax table has limitations about what comment starters and
+enders are actually possible.
 
 KEYWORD-LIST is a list of keywords to highlight with
 `font-lock-keyword-face'.  Each keyword should be a string.
 
-FONT-LOCK-LIST is a list of additional expressions to highlight.
-Each entry in the list should have the same form as an entry in
+FONT-LOCK-LIST is a list of additional expressions to highlight.  Each
+element of this list should have the same form as an element of
 `font-lock-keywords'.
 
 AUTO-MODE-LIST is a list of regular expressions to add to
-`auto-mode-alist'.  These regexps are added to `auto-mode-alist'
-as soon as `define-generic-mode' is called.
+`auto-mode-alist'.  These regular expressions are added when Emacs
+runs the macro expansion.
 
-FUNCTION-LIST is a list of functions to call to do some
-additional setup.
+FUNCTION-LIST is a list of functions to call to do some additional
+setup.  The mode command calls these functions just before it runs the
+mode hook `MODE-hook'.
 
 See the file generic-x.el for some examples of `define-generic-mode'.
 
@@ -10413,7 +10565,7 @@ See the file generic-x.el for some examples of `define-generic-mode'.
 (autoload (quote generic-mode-internal) "generic" "\
 Go into the generic mode MODE.
 
-\(fn MODE COMMENTS KEYWORDS FONT-LOCK-LIST FUNS)" nil nil)
+\(fn MODE COMMENT-LIST KEYWORD-LIST FONT-LOCK-LIST FUNCTION-LIST)" nil nil)
 
 (autoload (quote generic-mode) "generic" "\
 Enter generic mode MODE.
@@ -10427,10 +10579,21 @@ Some generic modes are defined in `generic-x.el'.
 
 \(fn MODE)" t nil)
 
+(autoload (quote generic-make-keywords-list) "generic" "\
+Return a `font-lock-keywords' construct that highlights KEYWORD-LIST.
+KEYWORD-LIST is a list of keyword strings that should be
+highlighted with face FACE.  This function calculates a regular
+expression that matches these keywords and concatenates it with
+PREFIX and SUFFIX.  Then it returns a construct based on this
+regular expression that can be used as an element of
+`font-lock-keywords'.
+
+\(fn KEYWORD-LIST FACE &optional PREFIX SUFFIX)" nil nil)
+
 ;;;***
 \f
 ;;;### (autoloads (glasses-mode) "glasses" "progmodes/glasses.el"
-;;;;;;  (16213 43281))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from progmodes/glasses.el
 
 (autoload (quote glasses-mode) "glasses" "\
@@ -10443,7 +10606,7 @@ at places they belong to.
 ;;;***
 \f
 ;;;### (autoloads (gnus gnus-other-frame gnus-slave gnus-no-server
-;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (16954 46150))
+;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (17087 12574))
 ;;; Generated autoloads from gnus/gnus.el
 
 (autoload (quote gnus-slave-no-server) "gnus" "\
@@ -10494,7 +10657,7 @@ prompt the user for the name of an NNTP server to use.
 ;;;;;;  gnus-agent-get-undownloaded-list gnus-agent-delete-group
 ;;;;;;  gnus-agent-rename-group gnus-agent-possibly-save-gcc gnus-agentize
 ;;;;;;  gnus-slave-unplugged gnus-plugged gnus-unplugged) "gnus-agent"
-;;;;;;  "gnus/gnus-agent.el" (16908 33361))
+;;;;;;  "gnus/gnus-agent.el" (17087 12567))
 ;;; Generated autoloads from gnus/gnus-agent.el
 
 (autoload (quote gnus-unplugged) "gnus-agent" "\
@@ -10581,7 +10744,7 @@ If CLEAN, obsolete (ignore).
 ;;;***
 \f
 ;;;### (autoloads (gnus-article-prepare-display) "gnus-art" "gnus/gnus-art.el"
-;;;;;;  (16954 46150))
+;;;;;;  (17087 12589))
 ;;; Generated autoloads from gnus/gnus-art.el
 
 (autoload (quote gnus-article-prepare-display) "gnus-art" "\
@@ -10592,7 +10755,7 @@ Make the current buffer look like a nice article.
 ;;;***
 \f
 ;;;### (autoloads (gnus-audio-play) "gnus-audio" "gnus/gnus-audio.el"
-;;;;;;  (16698 21927))
+;;;;;;  (17087 12415))
 ;;; Generated autoloads from gnus/gnus-audio.el
 
 (autoload (quote gnus-audio-play) "gnus-audio" "\
@@ -10604,8 +10767,8 @@ Play a sound FILE through the speaker.
 \f
 ;;;### (autoloads (gnus-cache-delete-group gnus-cache-rename-group
 ;;;;;;  gnus-cache-generate-nov-databases gnus-cache-generate-active
-;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (16858
-;;;;;;  50925))
+;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (17087
+;;;;;;  12567))
 ;;; Generated autoloads from gnus/gnus-cache.el
 
 (autoload (quote gnus-jog-cache) "gnus-cache" "\
@@ -10643,7 +10806,7 @@ next enabled. Depends upon the caller to determine whether group deletion is sup
 ;;;***
 \f
 ;;;### (autoloads (gnus-delay-initialize gnus-delay-send-queue gnus-delay-article)
-;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (16908 33361))
+;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (17087 12530))
 ;;; Generated autoloads from gnus/gnus-delay.el
 
 (defgroup gnus-delay nil "Arrange for sending postings later." :version "22.1" :group (quote gnus))
@@ -10681,7 +10844,7 @@ Checking delayed messages is skipped if optional arg NO-CHECK is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (turn-on-gnus-dired-mode) "gnus-dired" "gnus/gnus-dired.el"
-;;;;;;  (16697 49031))
+;;;;;;  (17087 12415))
 ;;; Generated autoloads from gnus/gnus-dired.el
 
 (autoload (quote turn-on-gnus-dired-mode) "gnus-dired" "\
@@ -10692,7 +10855,7 @@ Convenience method to turn on gnus-dired-mode.
 ;;;***
 \f
 ;;;### (autoloads (gnus-draft-reminder) "gnus-draft" "gnus/gnus-draft.el"
-;;;;;;  (16764 51520))
+;;;;;;  (17087 12435))
 ;;; Generated autoloads from gnus/gnus-draft.el
 
 (autoload (quote gnus-draft-reminder) "gnus-draft" "\
@@ -10704,8 +10867,8 @@ Reminder user if there are unsent drafts.
 \f
 ;;;### (autoloads (gnus-convert-png-to-face gnus-convert-face-to-png
 ;;;;;;  gnus-face-from-file gnus-x-face-from-file gnus-insert-random-x-face-header
-;;;;;;  gnus-random-x-face) "gnus-fun" "gnus/gnus-fun.el" (16908
-;;;;;;  33361))
+;;;;;;  gnus-random-x-face) "gnus-fun" "gnus/gnus-fun.el" (17087
+;;;;;;  12466))
 ;;; Generated autoloads from gnus/gnus-fun.el
 
 (autoload (quote gnus-random-x-face) "gnus-fun" "\
@@ -10744,7 +10907,7 @@ FILE should be a PNG file that's 48x48 and smaller than or equal to
 ;;;***
 \f
 ;;;### (autoloads (gnus-fetch-group-other-frame gnus-fetch-group)
-;;;;;;  "gnus-group" "gnus/gnus-group.el" (16927 493))
+;;;;;;  "gnus-group" "gnus/gnus-group.el" (17087 12574))
 ;;; Generated autoloads from gnus/gnus-group.el
 
 (autoload (quote gnus-fetch-group) "gnus-group" "\
@@ -10761,7 +10924,7 @@ Pop up a frame and enter GROUP.
 ;;;***
 \f
 ;;;### (autoloads (gnus-batch-score) "gnus-kill" "gnus/gnus-kill.el"
-;;;;;;  (16698 21927))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from gnus/gnus-kill.el
 
 (defalias (quote gnus-batch-kill) (quote gnus-batch-score))
@@ -10776,7 +10939,7 @@ Usage: emacs -batch -l ~/.emacs -l gnus -f gnus-batch-score
 \f
 ;;;### (autoloads (gnus-mailing-list-mode gnus-mailing-list-insinuate
 ;;;;;;  turn-on-gnus-mailing-list-mode) "gnus-ml" "gnus/gnus-ml.el"
-;;;;;;  (16698 21927))
+;;;;;;  (17087 12415))
 ;;; Generated autoloads from gnus/gnus-ml.el
 
 (autoload (quote turn-on-gnus-mailing-list-mode) "gnus-ml" "\
@@ -10801,7 +10964,7 @@ Minor mode for providing mailing-list commands.
 \f
 ;;;### (autoloads (gnus-group-split-fancy gnus-group-split gnus-group-split-update
 ;;;;;;  gnus-group-split-setup) "gnus-mlspl" "gnus/gnus-mlspl.el"
-;;;;;;  (16698 21927))
+;;;;;;  (17087 12415))
 ;;; Generated autoloads from gnus/gnus-mlspl.el
 
 (autoload (quote gnus-group-split-setup) "gnus-mlspl" "\
@@ -10902,7 +11065,7 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
 ;;;***
 \f
 ;;;### (autoloads (gnus-change-server) "gnus-move" "gnus/gnus-move.el"
-;;;;;;  (16213 43273))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from gnus/gnus-move.el
 
 (autoload (quote gnus-change-server) "gnus-move" "\
@@ -10914,7 +11077,7 @@ Update the .newsrc.eld file to reflect the change of nntp server.
 ;;;***
 \f
 ;;;### (autoloads (gnus-button-reply gnus-button-mailto gnus-msg-mail)
-;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (16923 3623))
+;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (17087 12471))
 ;;; Generated autoloads from gnus/gnus-msg.el
 
 (autoload (quote gnus-msg-mail) "gnus-msg" "\
@@ -10940,7 +11103,7 @@ Like `message-reply'.
 \f
 ;;;### (autoloads (gnus-treat-newsgroups-picon gnus-treat-mail-picon
 ;;;;;;  gnus-treat-from-picon) "gnus-picon" "gnus/gnus-picon.el"
-;;;;;;  (16730 31107))
+;;;;;;  (17087 12574))
 ;;; Generated autoloads from gnus/gnus-picon.el
 
 (autoload (quote gnus-treat-from-picon) "gnus-picon" "\
@@ -10967,7 +11130,7 @@ If picons are already displayed, remove them.
 ;;;;;;  gnus-sorted-nintersection gnus-sorted-range-intersection
 ;;;;;;  gnus-sorted-intersection gnus-intersection gnus-sorted-complement
 ;;;;;;  gnus-sorted-ndifference gnus-sorted-difference) "gnus-range"
-;;;;;;  "gnus/gnus-range.el" (16764 51520))
+;;;;;;  "gnus/gnus-range.el" (17087 12435))
 ;;; Generated autoloads from gnus/gnus-range.el
 
 (autoload (quote gnus-sorted-difference) "gnus-range" "\
@@ -11035,7 +11198,7 @@ Add NUM into sorted LIST by side effect.
 ;;;***
 \f
 ;;;### (autoloads (gnus-registry-install-hooks gnus-registry-initialize)
-;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (16923 3623))
+;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (17087 12471))
 ;;; Generated autoloads from gnus/gnus-registry.el
 
 (autoload (quote gnus-registry-initialize) "gnus-registry" "\
@@ -11051,8 +11214,8 @@ Install the registry hooks.
 ;;;***
 \f
 ;;;### (autoloads (gnus-sieve-article-add-rule gnus-sieve-generate
-;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (16697
-;;;;;;  49031))
+;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from gnus/gnus-sieve.el
 
 (autoload (quote gnus-sieve-update) "gnus-sieve" "\
@@ -11080,7 +11243,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (gnus-batch-brew-soup) "gnus-soup" "gnus/gnus-soup.el"
-;;;;;;  (16698 21927))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from gnus/gnus-soup.el
 
 (autoload (quote gnus-batch-brew-soup) "gnus-soup" "\
@@ -11100,7 +11263,7 @@ Note -- this function hasn't been implemented yet.
 ;;;***
 \f
 ;;;### (autoloads (gnus-update-format) "gnus-spec" "gnus/gnus-spec.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from gnus/gnus-spec.el
 
 (autoload (quote gnus-update-format) "gnus-spec" "\
@@ -11111,8 +11274,8 @@ Update the format specification near point.
 ;;;***
 \f
 ;;;### (autoloads (gnus-fixup-nnimap-unread-after-getting-new-news
-;;;;;;  gnus-declare-backend) "gnus-start" "gnus/gnus-start.el" (16908
-;;;;;;  33361))
+;;;;;;  gnus-declare-backend) "gnus-start" "gnus/gnus-start.el" (17087
+;;;;;;  12567))
 ;;; Generated autoloads from gnus/gnus-start.el
 
 (autoload (quote gnus-declare-backend) "gnus-start" "\
@@ -11128,7 +11291,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (gnus-add-configuration) "gnus-win" "gnus/gnus-win.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12466))
 ;;; Generated autoloads from gnus/gnus-win.el
 
 (autoload (quote gnus-add-configuration) "gnus-win" "\
@@ -11138,7 +11301,7 @@ Add the window configuration CONF to `gnus-buffer-configuration'.
 
 ;;;***
 \f
-;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (16213 43281))
+;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (17087 12570))
 ;;; Generated autoloads from play/gomoku.el
 
 (autoload (quote gomoku) "gomoku" "\
@@ -11164,17 +11327,11 @@ Use \\[describe-mode] for more info.
 
 ;;;***
 \f
-;;;### (autoloads (goto-address goto-address-at-point goto-address-at-mouse)
-;;;;;;  "goto-addr" "net/goto-addr.el" (16858 50931))
+;;;### (autoloads (goto-address goto-address-at-point) "goto-addr"
+;;;;;;  "net/goto-addr.el" (17087 12554))
 ;;; Generated autoloads from net/goto-addr.el
 
-(autoload (quote goto-address-at-mouse) "goto-addr" "\
-Send to the e-mail address or load the URL clicked with the mouse.
-Send mail to address at position of mouse click.  See documentation for
-`goto-address-find-address-at-point'.  If no address is found
-there, then load the URL at or before the position of the mouse click.
-
-\(fn EVENT)" t nil)
+(define-obsolete-function-alias (quote goto-address-at-mouse) (quote goto-address-at-point) "22.1")
 
 (autoload (quote goto-address-at-point) "goto-addr" "\
 Send to the e-mail address or load the URL at point.
@@ -11182,7 +11339,7 @@ Send mail to address at point.  See documentation for
 `goto-address-find-address-at-point'.  If no address is found
 there, then load the URL at or before point.
 
-\(fn)" t nil)
+\(fn &optional EVENT)" t nil)
 
 (autoload (quote goto-address) "goto-addr" "\
 Sets up goto-address functionality in the current buffer.
@@ -11199,7 +11356,7 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and
 \f
 ;;;### (autoloads (grep-tree grep-find grep grep-compute-defaults
 ;;;;;;  grep-process-setup grep-setup-hook grep-find-command grep-command
-;;;;;;  grep-window-height) "grep" "progmodes/grep.el" (16908 33362))
+;;;;;;  grep-window-height) "grep" "progmodes/grep.el" (17087 12575))
 ;;; Generated autoloads from progmodes/grep.el
 
 (defvar grep-window-height nil "\
@@ -11230,7 +11387,7 @@ List of hook functions run by `grep-process-setup' (see `run-hooks').")
 
 (custom-autoload (quote grep-setup-hook) "grep")
 
-(defvar grep-regexp-alist (quote (("^\\(.+?\\)[:       ]+\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[:     ]" 1 (2 . 5) (4 . 6)) ("^\\(.+?\\)[:(]+\\([0-9]+\\)\\([:)]\\).*?\\(\e\\[01;41m\\)\\(.*?\\)\\(\e\\[00m\\(\e\\[K\\)?\\)" 1 2 ((lambda nil (setq compilation-error-screen-columns nil) (- (match-beginning 5) (match-end 3) 8)) lambda nil (- (match-end 5) (match-end 3) 8))) ("^Binary file \\(.+\\) matches$" 1 nil nil 1))) "\
+(defvar grep-regexp-alist (quote (("^\\(.+?\\)\\([:    ]\\)+\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\\(?:-\\(?:\\([0-9]+\\)\\4\\)?\\.?\\([0-9]+\\)?\\)?\\2" 1 (3 . 6) (5 . 7)) ("^\\(\\(.+?\\):\\([0-9]+\\):\\).*?\\(\e\\[01;41m\\)\\(.*?\\)\\(\e\\[00m\\(?:\e\\[K\\)?\\)" 2 3 ((lambda nil (setq compilation-error-screen-columns nil) (- (match-beginning 5) (match-end 1) 8)) lambda nil (- (match-end 5) (match-end 1) 8)) nil 1) ("^Binary file \\(.+\\) matches$" 1 nil nil 1))) "\
 Regexp used to match grep hits.  See `compilation-error-regexp-alist'.")
 
 (defvar grep-program "grep" "\
@@ -11318,7 +11475,7 @@ those sub directories of DIR.
 
 ;;;***
 \f
-;;;### (autoloads (gs-load-image) "gs" "gs.el" (16565 48734))
+;;;### (autoloads (gs-load-image) "gs" "gs.el" (17087 12380))
 ;;; Generated autoloads from gs.el
 
 (autoload (quote gs-load-image) "gs" "\
@@ -11332,7 +11489,7 @@ the form \"WINDOW-ID PIXMAP-ID\".  Value is non-nil if successful.
 ;;;***
 \f
 ;;;### (autoloads (gdb-script-mode bashdb jdb pdb perldb xdb dbx
-;;;;;;  sdb gdb) "gud" "progmodes/gud.el" (16896 54110))
+;;;;;;  sdb gdb) "gud" "progmodes/gud.el" (17087 12589))
 ;;; Generated autoloads from progmodes/gud.el
 
 (autoload (quote gdb) "gud" "\
@@ -11361,7 +11518,7 @@ Run xdb on program FILE in buffer *gud-FILE*.
 The directory containing FILE becomes the initial working directory
 and source-file directory for your debugger.
 
-You can set the variable 'gud-xdb-directories' to a list of program source
+You can set the variable `gud-xdb-directories' to a list of program source
 directories if your program contains sources from more than one directory.
 
 \(fn COMMAND-LINE)" t nil)
@@ -11413,8 +11570,8 @@ Major mode for editing GDB scripts
 
 ;;;***
 \f
-;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (16377
-;;;;;;  12872))
+;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (17087
+;;;;;;  12558))
 ;;; Generated autoloads from play/handwrite.el
 
 (autoload (quote handwrite) "handwrite" "\
@@ -11432,7 +11589,7 @@ Variables: handwrite-linespace     (default 12)
 ;;;***
 \f
 ;;;### (autoloads (hanoi-unix-64 hanoi-unix hanoi) "hanoi" "play/hanoi.el"
-;;;;;;  (16213 43281))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from play/hanoi.el
 
 (autoload (quote hanoi) "hanoi" "\
@@ -11462,7 +11619,7 @@ to be updated.
 ;;;### (autoloads (scan-buf-previous-region scan-buf-next-region
 ;;;;;;  scan-buf-move-to-region help-at-pt-display-when-idle help-at-pt-set-timer
 ;;;;;;  help-at-pt-cancel-timer display-local-help help-at-pt-kbd-string
-;;;;;;  help-at-pt-string) "help-at-pt" "help-at-pt.el" (16908 33360))
+;;;;;;  help-at-pt-string) "help-at-pt" "help-at-pt.el" (17087 12466))
 ;;; Generated autoloads from help-at-pt.el
 
 (autoload (quote help-at-pt-string) "help-at-pt" "\
@@ -11590,8 +11747,9 @@ different regions.  With numeric argument ARG, behaves like
 ;;;***
 \f
 ;;;### (autoloads (describe-categories describe-syntax describe-variable
-;;;;;;  variable-at-point describe-function-1 describe-function locate-library
-;;;;;;  help-with-tutorial) "help-fns" "help-fns.el" (16899 17454))
+;;;;;;  variable-at-point describe-function-1 help-C-file-name describe-function
+;;;;;;  locate-library help-with-tutorial) "help-fns" "help-fns.el"
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from help-fns.el
 
 (autoload (quote help-with-tutorial) "help-fns" "\
@@ -11624,6 +11782,12 @@ Display the full documentation of FUNCTION (a symbol).
 
 \(fn FUNCTION)" t nil)
 
+(autoload (quote help-C-file-name) "help-fns" "\
+Return the name of the C file where SUBR-OR-VAR is defined.
+KIND should be `var' for a variable or `subr' for a subroutine.
+
+\(fn SUBR-OR-VAR KIND)" nil nil)
+
 (defface help-argument-name (quote ((((supports :slant italic)) :inherit italic))) "Face to highlight argument names in *Help* buffers." :group (quote help))
 
 (autoload (quote describe-function-1) "help-fns" "\
@@ -11641,10 +11805,11 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be bound.
 (autoload (quote describe-variable) "help-fns" "\
 Display the full documentation of VARIABLE (a symbol).
 Returns the documentation as a string, also.
-If VARIABLE has a buffer-local value in BUFFER (default to the current buffer),
+If VARIABLE has a buffer-local value in BUFFER or FRAME
+\(default to the current buffer and current frame),
 it is displayed along with the global value.
 
-\(fn VARIABLE &optional BUFFER)" t nil)
+\(fn VARIABLE &optional BUFFER FRAME)" t nil)
 
 (autoload (quote describe-syntax) "help-fns" "\
 Describe the syntax specifications in the syntax table of BUFFER.
@@ -11664,7 +11829,7 @@ BUFFER should be a buffer or a buffer name.
 ;;;***
 \f
 ;;;### (autoloads (three-step-help) "help-macro" "help-macro.el"
-;;;;;;  (16875 35928))
+;;;;;;  (17087 12453))
 ;;; Generated autoloads from help-macro.el
 
 (defvar three-step-help nil "\
@@ -11680,7 +11845,7 @@ A value of nil means skip the middle step, so that
 \f
 ;;;### (autoloads (help-xref-on-pp help-insert-xref-button help-xref-button
 ;;;;;;  help-make-xrefs help-setup-xref help-mode-finish help-mode-setup
-;;;;;;  help-mode) "help-mode" "help-mode.el" (16939 44104))
+;;;;;;  help-mode) "help-mode" "help-mode.el" (17087 12582))
 ;;; Generated autoloads from help-mode.el
 
 (autoload (quote help-mode) "help-mode" "\
@@ -11763,7 +11928,7 @@ Add xrefs for symbols in `pp's output between FROM and TO.
 ;;;***
 \f
 ;;;### (autoloads (Helper-help Helper-describe-bindings) "helper"
-;;;;;;  "emacs-lisp/helper.el" (16213 43273))
+;;;;;;  "emacs-lisp/helper.el" (17087 12380))
 ;;; Generated autoloads from emacs-lisp/helper.el
 
 (autoload (quote Helper-describe-bindings) "helper" "\
@@ -11779,7 +11944,7 @@ Provide help for current mode.
 ;;;***
 \f
 ;;;### (autoloads (hexlify-buffer hexl-find-file hexl-mode) "hexl"
-;;;;;;  "hexl.el" (16858 50912))
+;;;;;;  "hexl.el" (17087 12570))
 ;;; Generated autoloads from hexl.el
 
 (autoload (quote hexl-mode) "hexl" "\
@@ -11874,8 +12039,8 @@ This discards the buffer's undo information.
 \f
 ;;;### (autoloads (hi-lock-write-interactive-patterns hi-lock-unface-buffer
 ;;;;;;  hi-lock-face-phrase-buffer hi-lock-face-buffer hi-lock-line-face-buffer
-;;;;;;  hi-lock-mode hi-lock-mode) "hi-lock" "hi-lock.el" (16898
-;;;;;;  6195))
+;;;;;;  hi-lock-mode hi-lock-mode) "hi-lock" "hi-lock.el" (17087
+;;;;;;  12531))
 ;;; Generated autoloads from hi-lock.el
 
 (defvar hi-lock-mode nil "\
@@ -11986,7 +12151,7 @@ be found in variable `hi-lock-interactive-patterns'.
 ;;;***
 \f
 ;;;### (autoloads (hide-ifdef-lines hide-ifdef-read-only hide-ifdef-initially
-;;;;;;  hide-ifdef-mode) "hideif" "progmodes/hideif.el" (16924 23221))
+;;;;;;  hide-ifdef-mode) "hideif" "progmodes/hideif.el" (17087 12528))
 ;;; Generated autoloads from progmodes/hideif.el
 
 (autoload (quote hide-ifdef-mode) "hideif" "\
@@ -12041,7 +12206,7 @@ how the hiding is done:
 ;;;***
 \f
 ;;;### (autoloads (hs-minor-mode hs-hide-comments-when-hiding-all)
-;;;;;;  "hideshow" "progmodes/hideshow.el" (16858 50936))
+;;;;;;  "hideshow" "progmodes/hideshow.el" (17087 12453))
 ;;; Generated autoloads from progmodes/hideshow.el
 
 (defvar hs-hide-comments-when-hiding-all t "\
@@ -12104,7 +12269,7 @@ Key bindings:
 ;;;;;;  highlight-compare-buffers highlight-changes-rotate-faces
 ;;;;;;  highlight-changes-previous-change highlight-changes-next-change
 ;;;;;;  highlight-changes-mode highlight-changes-remove-highlight)
-;;;;;;  "hilit-chg" "hilit-chg.el" (16876 58220))
+;;;;;;  "hilit-chg" "hilit-chg.el" (17087 12570))
 ;;; Generated autoloads from hilit-chg.el
 
 (autoload (quote highlight-changes-remove-highlight) "hilit-chg" "\
@@ -12165,7 +12330,7 @@ of `highlight-changes-face-list', one level older changes are shown in
 face described by the second element, and so on.  Very old changes remain
 shown in the last face in the list.
 
-You can automatically rotate colours when the buffer is saved
+You can automatically rotate colors when the buffer is saved
 by adding the following to `local-write-file-hooks', by evaling it in the
 buffer to be saved):
 
@@ -12234,7 +12399,7 @@ variable `highlight-changes-global-changes-existing-buffers' is non-nil).
 ;;;;;;  hippie-expand-ignore-buffers hippie-expand-max-buffers hippie-expand-no-restriction
 ;;;;;;  hippie-expand-dabbrev-as-symbol hippie-expand-dabbrev-skip-space
 ;;;;;;  hippie-expand-verbose hippie-expand-try-functions-list) "hippie-exp"
-;;;;;;  "hippie-exp.el" (16213 43268))
+;;;;;;  "hippie-exp.el" (17087 12542))
 ;;; Generated autoloads from hippie-exp.el
 
 (defvar hippie-expand-try-functions-list (quote (try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-lisp-symbol-partially try-complete-lisp-symbol)) "\
@@ -12307,7 +12472,7 @@ argument VERBOSE non-nil makes the function verbose.
 ;;;***
 \f
 ;;;### (autoloads (global-hl-line-mode hl-line-mode) "hl-line" "hl-line.el"
-;;;;;;  (16908 33360))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from hl-line.el
 
 (autoload (quote hl-line-mode) "hl-line" "\
@@ -12347,7 +12512,7 @@ Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and
 ;;;***
 \f
 ;;;### (autoloads (list-holidays holidays) "holidays" "calendar/holidays.el"
-;;;;;;  (16822 52985))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from calendar/holidays.el
 
 (autoload (quote holidays) "holidays" "\
@@ -12371,7 +12536,7 @@ The optional LABEL is used to label the buffer created.
 ;;;***
 \f
 ;;;### (autoloads (hscroll-global-mode hscroll-mode turn-on-hscroll)
-;;;;;;  "hscroll" "obsolete/hscroll.el" (16213 43281))
+;;;;;;  "hscroll" "obsolete/hscroll.el" (17087 12380))
 ;;; Generated autoloads from obsolete/hscroll.el
 
 (autoload (quote turn-on-hscroll) "hscroll" "\
@@ -12397,8 +12562,8 @@ Also see `automatic-hscrolling'.
 
 ;;;***
 \f
-;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (16777
-;;;;;;  65418))
+;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (17087
+;;;;;;  12567))
 ;;; Generated autoloads from gnus/html2text.el
 
 (autoload (quote html2text) "html2text" "\
@@ -12429,7 +12594,7 @@ Convert HTML to plain text in the current buffer.
 ;;;;;;  ibuffer-backward-filter-group ibuffer-forward-filter-group
 ;;;;;;  ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group
 ;;;;;;  ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode
-;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" (16934 57456))
+;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" (17087 12562))
 ;;; Generated autoloads from ibuf-ext.el
 
 (autoload (quote ibuffer-auto-mode) "ibuf-ext" "\
@@ -12790,8 +12955,8 @@ defaults to one.
 ;;;***
 \f
 ;;;### (autoloads (define-ibuffer-filter define-ibuffer-op define-ibuffer-sorter
-;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (16544
-;;;;;;  33333))
+;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from ibuf-macs.el
 
 (autoload (quote define-ibuffer-column) "ibuf-macs" "\
@@ -12877,7 +13042,7 @@ bound to the current value of the filter.
 ;;;***
 \f
 ;;;### (autoloads (ibuffer ibuffer-other-window ibuffer-list-buffers)
-;;;;;;  "ibuffer" "ibuffer.el" (16908 33360))
+;;;;;;  "ibuffer" "ibuffer.el" (17087 12566))
 ;;; Generated autoloads from ibuffer.el
 
 (autoload (quote ibuffer-list-buffers) "ibuffer" "\
@@ -12918,7 +13083,7 @@ locally in this buffer.
 \f
 ;;;### (autoloads (icalendar-import-buffer icalendar-import-file
 ;;;;;;  icalendar-export-region icalendar-export-file) "icalendar"
-;;;;;;  "calendar/icalendar.el" (16939 44105))
+;;;;;;  "calendar/icalendar.el" (17087 12567))
 ;;; Generated autoloads from calendar/icalendar.el
 
 (autoload (quote icalendar-export-file) "icalendar" "\
@@ -12970,8 +13135,8 @@ buffer `*icalendar-errors*'.
 
 ;;;***
 \f
-;;;### (autoloads (icomplete-mode) "icomplete" "icomplete.el" (16960
-;;;;;;  18194))
+;;;### (autoloads (icomplete-mode) "icomplete" "icomplete.el" (17087
+;;;;;;  12524))
 ;;; Generated autoloads from icomplete.el
 
 (defvar icomplete-mode nil "\
@@ -12990,7 +13155,7 @@ With a numeric argument, turn Icomplete mode on iff ARG is positive.
 
 ;;;***
 \f
-;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (16858 50936))
+;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (17087 12566))
 ;;; Generated autoloads from progmodes/icon.el
 
 (autoload (quote icon-mode) "icon" "\
@@ -13031,7 +13196,7 @@ with no args, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (idlwave-shell) "idlw-shell" "progmodes/idlw-shell.el"
-;;;;;;  (16830 50350))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from progmodes/idlw-shell.el
 
 (autoload (quote idlwave-shell) "idlw-shell" "\
@@ -13057,7 +13222,7 @@ See also the variable `idlwave-shell-prompt-pattern'.
 ;;;***
 \f
 ;;;### (autoloads (idlwave-mode) "idlwave" "progmodes/idlwave.el"
-;;;;;;  (16958 58759))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from progmodes/idlwave.el
 
 (autoload (quote idlwave-mode) "idlwave" "\
@@ -13141,7 +13306,7 @@ The main features of this mode are
    \\i         IF statement template
    \\elif      IF-ELSE statement template
    \\b         BEGIN
-   
+
    For a full list, use \\[idlwave-list-abbrevs].  Some templates also
    have direct keybindings - see the list of keybindings below.
 
@@ -13193,13 +13358,13 @@ The main features of this mode are
 ;;;;;;  ido-find-alternate-file ido-find-file-other-window ido-find-file
 ;;;;;;  ido-find-file-in-dir ido-switch-buffer-other-frame ido-insert-buffer
 ;;;;;;  ido-kill-buffer ido-display-buffer ido-switch-buffer-other-window
-;;;;;;  ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (16916
-;;;;;;  30957))
+;;;;;;  ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (17087
+;;;;;;  12574))
 ;;; Generated autoloads from ido.el
 
 (defvar ido-mode nil "\
 Determines for which functional group (buffer and files) ido behavior
-should be enabled. The following values are possible:
+should be enabled.  The following values are possible:
 - `buffer': Turn only on ido buffer behavior (switching, killing,
   displaying...)
 - `file': Turn only on ido file behavior (finding, writing, inserting...)
@@ -13231,9 +13396,9 @@ in another frame.
 
 As you type in a string, all of the buffers matching the string are
 displayed if substring-matching is used (default). Look at
-`ido-enable-prefix' and `ido-toggle-prefix'. When you have found the
-buffer you want, it can then be selected. As you type, most keys have their
-normal keybindings, except for the following: \\<ido-mode-map>
+`ido-enable-prefix' and `ido-toggle-prefix'.  When you have found the
+buffer you want, it can then be selected.  As you type, most keys have
+their normal keybindings, except for the following: \\<ido-mode-map>
 
 RET Select the buffer at the front of the list of matches.  If the
 list is empty, possibly prompt to create new buffer.
@@ -13305,11 +13470,11 @@ The file is displayed according to `ido-default-file-method' -- the
 default is to show it in the same window, unless it is already
 visible in another frame.
 
-The file name is selected interactively by typing a substring. As you type
-in a string, all of the filenames matching the string are displayed if
-substring-matching is used (default). Look at `ido-enable-prefix' and
-`ido-toggle-prefix'. When you have found the filename you want, it can
-then be selected. As you type, most keys have their normal keybindings,
+The file name is selected interactively by typing a substring.  As you
+type in a string, all of the filenames matching the string are displayed
+if substring-matching is used (default).  Look at `ido-enable-prefix' and
+`ido-toggle-prefix'.  When you have found the filename you want, it can
+then be selected.  As you type, most keys have their normal keybindings,
 except for the following: \\<ido-mode-map>
 
 RET Select the file at the front of the list of matches.  If the
@@ -13417,7 +13582,7 @@ Ido replacement for the built-in `read-buffer'.
 Return the name of a buffer selected.
 PROMPT is the prompt to give to the user.  DEFAULT if given is the default
 buffer to be selected, which will go to the front of the list.
-If REQUIRE-MATCH is non-nil, an existing-buffer must be selected.
+If REQUIRE-MATCH is non-nil, an existing buffer must be selected.
 
 \(fn PROMPT &optional DEFAULT REQUIRE-MATCH)" nil nil)
 
@@ -13455,7 +13620,7 @@ DEF, if non-nil, is the default value.
 
 ;;;***
 \f
-;;;### (autoloads (ielm) "ielm" "ielm.el" (16908 33360))
+;;;### (autoloads (ielm) "ielm" "ielm.el" (17087 12570))
 ;;; Generated autoloads from ielm.el
  (add-hook 'same-window-buffer-names "*ielm*")
 
@@ -13468,7 +13633,7 @@ Switches to the buffer `*ielm*', or creates it if it does not exist.
 ;;;***
 \f
 ;;;### (autoloads (iimage-mode turn-on-iimage-mode) "iimage" "iimage.el"
-;;;;;;  (16619 14967))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from iimage.el
 
 (autoload (quote turn-on-iimage-mode) "iimage" "\
@@ -13486,22 +13651,9 @@ Toggle inline image minor mode.
 ;;;### (autoloads (defimage find-image remove-images insert-sliced-image
 ;;;;;;  insert-image put-image create-image image-type-available-p
 ;;;;;;  image-type-from-file-header image-type-from-data) "image"
-;;;;;;  "image.el" (16954 46150))
+;;;;;;  "image.el" (17087 12566))
 ;;; Generated autoloads from image.el
 
-(defvar image-library-alist nil "\
-Alist of image types vs external libraries needed to display them.
-
-Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol
-representing a supported image type, and the rest are strings giving
-alternate filenames for the corresponding external libraries.
-
-Emacs tries to load the libraries in the order they appear on the
-list; if none is loaded, the running session of Emacs won't
-support the image type.  Types 'pbm and 'xbm don't need to be
-listed; they're always supported.")
- (put 'image-library-alist 'risky-local-variable t)
-
 (autoload (quote image-type-from-data) "image" "\
 Determine the image type from image data DATA.
 Value is a symbol specifying the image type or nil if type cannot
@@ -13517,7 +13669,7 @@ be determined.
 \(fn FILE)" nil nil)
 
 (autoload (quote image-type-available-p) "image" "\
-Value is non-nil if image type TYPE is available.
+Return non-nil if image type TYPE is available.
 Image types are symbols like `xbm' or `jpeg'.
 
 \(fn TYPE)" nil nil)
@@ -13632,7 +13784,7 @@ Example:
 \f
 ;;;### (autoloads (auto-image-file-mode insert-image-file image-file-name-regexp
 ;;;;;;  image-file-name-regexps image-file-name-extensions) "image-file"
-;;;;;;  "image-file.el" (16942 52930))
+;;;;;;  "image-file.el" (17087 12504))
 ;;; Generated autoloads from image-file.el
 
 (defvar image-file-name-extensions (quote ("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm" "xpm" "pbm" "pgm" "ppm" "pnm")) "\
@@ -13692,21 +13844,15 @@ Image files are those whose name has an extension in
 
 ;;;***
 \f
-;;;### (autoloads (image-mode) "image-mode" "image-mode.el" (16960
-;;;;;;  18194))
+;;;### (autoloads (image-mode-maybe image-minor-mode image-mode)
+;;;;;;  "image-mode" "image-mode.el" (17087 12524))
 ;;; Generated autoloads from image-mode.el
- (push '("\\.jpg\\'" . image-mode) auto-mode-alist)
- (push '("\\.jpeg\\'" . image-mode) auto-mode-alist)
- (push '("\\.gif\\'" . image-mode) auto-mode-alist)
- (push '("\\.png\\'" . image-mode) auto-mode-alist)
- (push '("\\.tiff\\'" . image-mode) auto-mode-alist)
- (push '("\\.tif\\'" . image-mode) auto-mode-alist)
- (push '("\\.xbm\\'" . image-mode) auto-mode-alist)
- (push '("\\.xpm\\'" . image-mode) auto-mode-alist)
- (push '("\\.pbm\\'" . image-mode) auto-mode-alist)
- (push '("\\.pgm\\'" . image-mode) auto-mode-alist)
- (push '("\\.ppm\\'" . image-mode) auto-mode-alist)
- (push '("\\.pnm\\'" . image-mode) auto-mode-alist)
+ (push '("\\.jpe?g\\'"    . image-mode) auto-mode-alist)
+ (push '("\\.png\\'"      . image-mode) auto-mode-alist)
+ (push '("\\.gif\\'"      . image-mode) auto-mode-alist)
+ (push '("\\.tiff?\\'"    . image-mode) auto-mode-alist)
+ (push '("\\.p[bpgn]m\\'" . image-mode) auto-mode-alist)
+ (push '("\\.x[bp]m\\'"   . image-mode-maybe) auto-mode-alist)
 
 (autoload (quote image-mode) "image-mode" "\
 Major mode for image files.
@@ -13715,10 +13861,29 @@ to toggle between display as an image and display as text.
 
 \(fn)" t nil)
 
+(autoload (quote image-minor-mode) "image-mode" "\
+Toggle Image minor mode.
+With arg, turn Image minor mode on if arg is positive, off otherwise.
+See the command `image-mode' for more information on this mode.
+
+\(fn &optional ARG)" t nil)
+
+(autoload (quote image-mode-maybe) "image-mode" "\
+Set major or minor mode for image files.
+Set Image major mode only when there are no other major modes
+associated with a filename in `auto-mode-alist'.  When an image
+filename matches another major mode in `auto-mode-alist' then
+set that major mode and Image minor mode.
+
+See commands `image-mode' and `image-minor-mode' for more
+information on these modes.
+
+\(fn)" t nil)
+
 ;;;***
 \f
 ;;;### (autoloads (imenu imenu-add-menubar-index imenu-add-to-menubar
-;;;;;;  imenu-sort-function) "imenu" "imenu.el" (16908 33360))
+;;;;;;  imenu-sort-function) "imenu" "imenu.el" (17087 12566))
 ;;; Generated autoloads from imenu.el
 
 (defvar imenu-sort-function nil "\
@@ -13741,32 +13906,9 @@ element should come before the second.  The arguments are cons cells;
 (defvar imenu-generic-expression nil "\
 The regex pattern to use for creating a buffer index.
 
-If non-nil this pattern is passed to `imenu--generic-function'
-to create a buffer index.
-
-The value should be an alist with elements that look like this:
- (MENU-TITLE REGEXP INDEX)
-or like this:
- (MENU-TITLE REGEXP INDEX FUNCTION ARGUMENTS...)
-with zero or more ARGUMENTS.  The former format creates a simple element in
-the index alist when it matches; the latter creates a special element
-of the form  (NAME POSITION-MARKER FUNCTION ARGUMENTS...)
-with FUNCTION and ARGUMENTS copied from `imenu-generic-expression'.
-
-MENU-TITLE is a string used as the title for the submenu or nil if the
-entries are not nested.
-
-REGEXP is a regexp that should match a construct in the buffer that is
-to be displayed in the menu; i.e., function or variable definitions,
-etc.  It contains a substring which is the name to appear in the
-menu.  See the info section on Regexps for more information.
-
-INDEX points to the substring in REGEXP that contains the name (of the
-function, variable or type) that is to appear in the menu.
-
-The variable `imenu-case-fold-search' determines whether or not the
-regexp matches are case sensitive, and `imenu-syntax-alist' can be
-used to alter the syntax table for the search.
+If non-nil this pattern is passed to `imenu--generic-function' to
+create a buffer index.  Look there for the documentation of this
+pattern's structure.
 
 For example, see the value of `fortran-imenu-generic-expression' used by
 `fortran-mode' with `imenu-syntax-alist' set locally to give the
@@ -13861,11 +14003,11 @@ for more information.
 \f
 ;;;### (autoloads (indian-char-glyph indian-glyph-char in-is13194-pre-write-conversion
 ;;;;;;  in-is13194-post-read-conversion indian-compose-string indian-compose-region)
-;;;;;;  "ind-util" "language/ind-util.el" (16303 21394))
+;;;;;;  "ind-util" "language/ind-util.el" (17087 12380))
 ;;; Generated autoloads from language/ind-util.el
 
 (autoload (quote indian-compose-region) "ind-util" "\
-Compose the region according to `composition-function-table'.
+Compose the region according to `composition-function-table'. 
 
 \(fn FROM TO)" t nil)
 
@@ -13902,8 +14044,9 @@ See also the function `indian-glyph-char'.
 
 ;;;***
 \f
-;;;### (autoloads (inferior-lisp) "inf-lisp" "progmodes/inf-lisp.el"
-;;;;;;  (16213 43282))
+;;;### (autoloads (inferior-lisp inferior-lisp-prompt inferior-lisp-load-command
+;;;;;;  inferior-lisp-program inferior-lisp-filter-regexp) "inf-lisp"
+;;;;;;  "progmodes/inf-lisp.el" (17087 12575))
 ;;; Generated autoloads from progmodes/inf-lisp.el
 
 (defvar inferior-lisp-filter-regexp "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'" "\
@@ -13912,8 +14055,12 @@ Input matching this regexp is not saved on the input history in Inferior Lisp
 mode.  Default is whitespace followed by 0 or 1 single-letter colon-keyword
 \(as in :a, :c, etc.)")
 
+(custom-autoload (quote inferior-lisp-filter-regexp) "inf-lisp")
+
 (defvar inferior-lisp-program "lisp" "\
-*Program name for invoking an inferior Lisp with for Inferior Lisp mode.")
+*Program name for invoking an inferior Lisp in Inferior Lisp mode.")
+
+(custom-autoload (quote inferior-lisp-program) "inf-lisp")
 
 (defvar inferior-lisp-load-command "(load \"%s\")\n" "\
 *Format-string for building a Lisp expression to load a file.
@@ -13924,21 +14071,25 @@ The string \"(progn (load \\\"%s\\\" :verbose nil :print t) (values))\\n\"
 produces cosmetically superior output for this application,
 but it works only in Common Lisp.")
 
+(custom-autoload (quote inferior-lisp-load-command) "inf-lisp")
+
 (defvar inferior-lisp-prompt "^[^> \n]*>+:? *" "\
-Regexp to recognise prompts in the Inferior Lisp mode.
+Regexp to recognize prompts in the Inferior Lisp mode.
 Defaults to \"^[^> \\n]*>+:? *\", which works pretty good for Lucid, kcl,
 and franz.  This variable is used to initialize `comint-prompt-regexp' in the
 Inferior Lisp buffer.
 
 This variable is only used if the variable
-`comint-use-prompt-regexp-instead-of-fields' is non-nil.
+`comint-use-prompt-regexp' is non-nil.
 
 More precise choices:
 Lucid Common Lisp: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\"
 franz: \"^\\\\(->\\\\|<[0-9]*>:\\\\) *\"
 kcl: \"^>+ *\"
 
-This is a fine thing to set in your .emacs file.")
+This is a fine thing to set in your .emacs file or through Custom.")
+
+(custom-autoload (quote inferior-lisp-prompt) "inf-lisp")
 
 (defvar inferior-lisp-mode-hook (quote nil) "\
 *Hook for customising Inferior Lisp mode.")
@@ -13961,9 +14112,8 @@ of `inferior-lisp-program').  Runs the hooks from
 \f
 ;;;### (autoloads (Info-restore-desktop-buffer Info-speedbar-browser
 ;;;;;;  Info-goto-emacs-key-command-node Info-goto-emacs-command-node
-;;;;;;  info-apropos Info-index Info-directory Info-goto-node info-standalone
-;;;;;;  info-emacs-manual info info-other-window) "info" "info.el"
-;;;;;;  (16953 20624))
+;;;;;;  info-apropos Info-index Info-directory info-standalone info-emacs-manual
+;;;;;;  info info-other-window) "info" "info.el" (17087 12574))
 ;;; Generated autoloads from info.el
 
 (autoload (quote info-other-window) "info" "\
@@ -14007,18 +14157,6 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself.
 
 \(fn)" nil nil)
 
-(autoload (quote Info-goto-node) "info" "\
-Go to info node named NODENAME.  Give just NODENAME or (FILENAME)NODENAME.
-If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file
-FILENAME; otherwise, NODENAME should be in the current Info file (or one of
-its sub-files).
-Completion is available, but only for node names in the current Info file.
-If FORK is non-nil (interactively with a prefix arg), show the node in
-a new info buffer.
-If FORK is a string, it is the name to use for the new buffer.
-
-\(fn NODENAME &optional FORK)" t nil)
-
 (autoload (quote Info-directory) "info" "\
 Go to the Info directory node.
 
@@ -14075,7 +14213,7 @@ Restore an info buffer specified in a desktop file.
 \f
 ;;;### (autoloads (info-complete-file info-complete-symbol info-lookup-file
 ;;;;;;  info-lookup-symbol info-lookup-reset) "info-look" "info-look.el"
-;;;;;;  (16875 35928))
+;;;;;;  (17087 12453))
 ;;; Generated autoloads from info-look.el
 
 (autoload (quote info-lookup-reset) "info-look" "\
@@ -14123,7 +14261,7 @@ Perform completion on file preceding point.
 ;;;***
 \f
 ;;;### (autoloads (info-xref-check-all-custom info-xref-check-all
-;;;;;;  info-xref-check) "info-xref" "info-xref.el" (16484 6598))
+;;;;;;  info-xref-check) "info-xref" "info-xref.el" (17087 12380))
 ;;; Generated autoloads from info-xref.el
 
 (autoload (quote info-xref-check) "info-xref" "\
@@ -14150,7 +14288,7 @@ quite a while.
 ;;;***
 \f
 ;;;### (autoloads (batch-info-validate Info-validate Info-split Info-tagify)
-;;;;;;  "informat" "informat.el" (16213 43269))
+;;;;;;  "informat" "informat.el" (17087 12380))
 ;;; Generated autoloads from informat.el
 
 (autoload (quote Info-tagify) "informat" "\
@@ -14191,7 +14329,7 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\"
 \f
 ;;;### (autoloads (isearch-process-search-multibyte-characters isearch-toggle-input-method
 ;;;;;;  isearch-toggle-specified-input-method) "isearch-x" "international/isearch-x.el"
-;;;;;;  (16829 43426))
+;;;;;;  (17087 12558))
 ;;; Generated autoloads from international/isearch-x.el
 
 (autoload (quote isearch-toggle-specified-input-method) "isearch-x" "\
@@ -14211,8 +14349,8 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (16541
-;;;;;;  47351))
+;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from isearchb.el
 
 (autoload (quote isearchb-activate) "isearchb" "\
@@ -14225,9 +14363,9 @@ accessed via isearchb.
 
 ;;;***
 \f
-;;;### (autoloads (iso-accents-mode) "iso-acc" "international/iso-acc.el"
-;;;;;;  (16927 496))
-;;; Generated autoloads from international/iso-acc.el
+;;;### (autoloads (iso-accents-mode) "iso-acc" "obsolete/iso-acc.el"
+;;;;;;  (17087 12588))
+;;; Generated autoloads from obsolete/iso-acc.el
 
 (autoload (quote iso-accents-mode) "iso-acc" "\
 Toggle ISO Accents mode, in which accents modify the following letter.
@@ -14259,7 +14397,7 @@ and a negative argument disables it.
 ;;;### (autoloads (iso-cvt-define-menu iso-cvt-write-only iso-cvt-read-only
 ;;;;;;  iso-sgml2iso iso-iso2sgml iso-iso2duden iso-iso2gtex iso-gtex2iso
 ;;;;;;  iso-tex2iso iso-iso2tex iso-german iso-spanish) "iso-cvt"
-;;;;;;  "international/iso-cvt.el" (16795 7139))
+;;;;;;  "international/iso-cvt.el" (17087 12570))
 ;;; Generated autoloads from international/iso-cvt.el
 
 (autoload (quote iso-spanish) "iso-cvt" "\
@@ -14343,10 +14481,10 @@ Add submenus to the File menu, to convert to and from various formats.
 ;;;***
 \f
 ;;;### (autoloads nil "iso-transl" "international/iso-transl.el"
-;;;;;;  (16213 43274))
+;;;;;;  (17087 12588))
 ;;; Generated autoloads from international/iso-transl.el
- (or key-translation-map (setq key-translation-map (make-sparse-keymap)))
- (define-key key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
+ (or global-key-translation-map (setq global-key-translation-map (make-sparse-keymap)))
+ (define-key global-key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
  (autoload 'iso-transl-ctl-x-8-map "iso-transl" "Keymap for C-x 8 prefix." t 'keymap)
 
 ;;;***
@@ -14356,7 +14494,7 @@ Add submenus to the File menu, to convert to and from various formats.
 ;;;;;;  ispell-region ispell-change-dictionary ispell-kill-ispell
 ;;;;;;  ispell-help ispell-pdict-save ispell-word ispell-local-dictionary-alist
 ;;;;;;  ispell-personal-dictionary) "ispell" "textmodes/ispell.el"
-;;;;;;  (16954 46151))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from textmodes/ispell.el
 
 (defvar ispell-personal-dictionary nil "\
@@ -14386,7 +14524,7 @@ re-start emacs.")
 
 (setq ispell-dictionary-alist-5 (quote (("norsk" "[A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]" "[^A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]" "[\"]" nil nil "~list" iso-8859-1) ("norsk7-tex" "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]" "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1) ("polish" "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" "" nil nil nil iso-8859-2) ("portugues" "[a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]" "[^a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]" "[']" t ("-C") "~latin1" iso-8859-1))))
 
-(setq ispell-dictionary-alist-6 (quote (("russian" "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" "[^\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" "" nil nil nil koi8-r) ("russianw" "[\300\301\302\303\304\305\250\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\334\333\332\335\336\337\340\341\342\343\344\345\270\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\374\373\372\375\376\377]" "[^\300\301\302\303\304\305\250\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\334\333\332\335\336\337\340\341\342\343\344\345\270\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\374\373\372\375\376\377]" "" nil nil nil windows-1251) ("slovak" "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "" nil ("-B") nil iso-8859-2) ("svenska" "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[']" nil ("-C") "~list" iso-8859-1))))
+(setq ispell-dictionary-alist-6 (quote (("russian" "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" "[^\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" "" nil nil nil koi8-r) ("russianw" "[\300\301\302\303\304\305\250\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\334\333\332\335\336\337\340\341\342\343\344\345\270\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\374\373\372\375\376\377]" "[^\300\301\302\303\304\305\250\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\334\333\332\335\336\337\340\341\342\343\344\345\270\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\374\373\372\375\376\377]" "" nil nil nil windows-1251) ("slovak" "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "" nil ("-B") nil iso-8859-2) ("slovenian" "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]" "" nil ("-B" "-d" "slovenian") nil iso-8859-2) ("svenska" "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[']" nil ("-C") "~list" iso-8859-1))))
 
 (defvar ispell-dictionary-alist (append ispell-dictionary-alist-1 ispell-dictionary-alist-2 ispell-dictionary-alist-3 ispell-dictionary-alist-4 ispell-dictionary-alist-5 ispell-dictionary-alist-6) "\
 An alist of dictionaries and their associated parameters.
@@ -14454,7 +14592,7 @@ and added as a submenu of the \"Edit\" menu.")
 
 (if ispell-menu-map-needed (let ((dicts (if (fboundp (quote ispell-valid-dictionary-list)) (ispell-valid-dictionary-list) (mapcar (lambda (x) (or (car x) "default")) ispell-dictionary-alist))) (dict-map (make-sparse-keymap "Dictionaries"))) (setq ispell-menu-map (make-sparse-keymap "Spell")) (if (not dicts) (define-key ispell-menu-map [default] (quote ("Select Default Dict" "Dictionary for which Ispell was configured" lambda nil (interactive) (ispell-change-dictionary "default"))))) (fset (quote ispell-dict-map) dict-map) (define-key ispell-menu-map [dictionaries] (\` (menu-item "Select Dict" ispell-dict-map))) (dolist (name dicts) (define-key dict-map (vector (intern name)) (cons (concat "Select " (capitalize name) " Dict") (\` (lambda nil (interactive) (ispell-change-dictionary (\, name)))))))))
 
-(if ispell-menu-map-needed (progn (define-key ispell-menu-map [ispell-change-dictionary] (quote (menu-item "Change Dictionary..." ispell-change-dictionary :help "Supply explicit dictionary file name"))) (define-key ispell-menu-map [ispell-kill-ispell] (quote (menu-item "Kill Process" ispell-kill-ispell :enable (and (boundp (quote ispell-process)) ispell-process (eq (ispell-process-status) (quote run))) :help "Terminate Ispell subprocess"))) (define-key ispell-menu-map [ispell-pdict-save] (quote (menu-item "Save Dictionary" (lambda nil (interactive) (ispell-pdict-save t t)) :help "Save personal dictionary"))) (define-key ispell-menu-map [ispell-customize] (quote (menu-item "Customize..." (lambda nil (interactive) (customize-group (quote ispell))) :help "Customize spell checking options"))) (define-key ispell-menu-map [ispell-help] (quote (menu-item "Help" (lambda nil (interactive) (describe-function (quote ispell-help))) :help "Show standard Ispell keybindings and commands"))) (define-key ispell-menu-map [flyspell-mode] (quote (menu-item "Automatic spell checking (Flyspell)" flyspell-mode :help "Check spelling while you edit the text" :button (:toggle . flyspell-mode)))) (define-key ispell-menu-map [ispell-complete-word] (quote (menu-item "Complete Word" ispell-complete-word :help "Complete word at cursor using dictionary"))) (define-key ispell-menu-map [ispell-complete-word-interior-frag] (quote (menu-item "Complete Word Fragment" ispell-complete-word-interior-frag :help "Complete word fragment at cursor")))))
+(if ispell-menu-map-needed (progn (define-key ispell-menu-map [ispell-change-dictionary] (quote (menu-item "Change Dictionary..." ispell-change-dictionary :help "Supply explicit dictionary file name"))) (define-key ispell-menu-map [ispell-kill-ispell] (quote (menu-item "Kill Process" ispell-kill-ispell :enable (and (boundp (quote ispell-process)) ispell-process (eq (ispell-process-status) (quote run))) :help "Terminate Ispell subprocess"))) (define-key ispell-menu-map [ispell-pdict-save] (quote (menu-item "Save Dictionary" (lambda nil (interactive) (ispell-pdict-save t t)) :help "Save personal dictionary"))) (define-key ispell-menu-map [ispell-customize] (quote (menu-item "Customize..." (lambda nil (interactive) (customize-group (quote ispell))) :help "Customize spell checking options"))) (define-key ispell-menu-map [ispell-help] (quote (menu-item "Help" (lambda nil (interactive) (describe-function (quote ispell-help))) :help "Show standard Ispell keybindings and commands"))) (define-key ispell-menu-map [flyspell-mode] (quote (menu-item "Automatic spell checking (Flyspell)" flyspell-mode :help "Check spelling while you edit the text" :button (:toggle bound-and-true-p flyspell-mode)))) (define-key ispell-menu-map [ispell-complete-word] (quote (menu-item "Complete Word" ispell-complete-word :help "Complete word at cursor using dictionary"))) (define-key ispell-menu-map [ispell-complete-word-interior-frag] (quote (menu-item "Complete Word Fragment" ispell-complete-word-interior-frag :help "Complete word fragment at cursor")))))
 
 (if ispell-menu-map-needed (progn (define-key ispell-menu-map [ispell-continue] (quote (menu-item "Continue Spell-Checking" ispell-continue :enable (and (boundp (quote ispell-region-end)) (marker-position ispell-region-end) (equal (marker-buffer ispell-region-end) (current-buffer))) :help "Continue spell checking last region"))) (define-key ispell-menu-map [ispell-word] (quote (menu-item "Spell-Check Word" ispell-word :help "Spell-check word at cursor"))) (define-key ispell-menu-map [ispell-comments-and-strings] (quote (menu-item "Spell-Check Comments" ispell-comments-and-strings :help "Spell-check only comments and strings")))))
 
@@ -14644,8 +14782,8 @@ You can bind this to the key C-c i in GNUS or mail by adding to
 
 ;;;***
 \f
-;;;### (autoloads (iswitchb-mode) "iswitchb" "iswitchb.el" (16681
-;;;;;;  45592))
+;;;### (autoloads (iswitchb-mode) "iswitchb" "iswitchb.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from iswitchb.el
 
 (defvar iswitchb-mode nil "\
@@ -14669,7 +14807,7 @@ This mode enables switching between buffers using substrings.  See
 ;;;### (autoloads (read-hiragana-string japanese-zenkaku-region japanese-hankaku-region
 ;;;;;;  japanese-hiragana-region japanese-katakana-region japanese-zenkaku
 ;;;;;;  japanese-hankaku japanese-hiragana japanese-katakana setup-japanese-environment-internal)
-;;;;;;  "japan-util" "language/japan-util.el" (16213 43280))
+;;;;;;  "japan-util" "language/japan-util.el" (17087 12562))
 ;;; Generated autoloads from language/japan-util.el
 
 (autoload (quote setup-japanese-environment-internal) "japan-util" "\
@@ -14746,8 +14884,8 @@ If non-nil, second arg INITIAL-INPUT is a string to insert before reading.
 
 ;;;***
 \f
-;;;### (autoloads (jit-lock-register) "jit-lock" "jit-lock.el" (16939
-;;;;;;  44104))
+;;;### (autoloads (jit-lock-register) "jit-lock" "jit-lock.el" (17087
+;;;;;;  12567))
 ;;; Generated autoloads from jit-lock.el
 
 (autoload (quote jit-lock-register) "jit-lock" "\
@@ -14760,35 +14898,33 @@ If non-nil, CONTEXTUAL means that a contextual fontification would be useful.
 
 ;;;***
 \f
-;;;### (autoloads (with-auto-compression-mode auto-compression-mode)
-;;;;;;  "jka-compr" "jka-compr.el" (16960 18194))
+;;;### (autoloads (jka-compr-uninstall jka-compr-handler) "jka-compr"
+;;;;;;  "jka-compr.el" (17087 12589))
 ;;; Generated autoloads from jka-compr.el
 
-(defvar auto-compression-mode nil "\
-Non-nil if Auto-Compression mode is enabled.
-See the command `auto-compression-mode' for a description of this minor-mode.
-Setting this variable directly does not take effect;
-use either \\[customize] or the function `auto-compression-mode'.")
+(defvar jka-compr-inhibit nil "\
+Non-nil means inhibit automatic uncompression temporarily.
+Lisp programs can bind this to t to do that.
+It is not recommended to set this variable permanently to anything but nil.")
 
-(custom-autoload (quote auto-compression-mode) "jka-compr")
-
-(autoload (quote auto-compression-mode) "jka-compr" "\
-Toggle automatic file compression and uncompression.
-With prefix argument ARG, turn auto compression on if positive, else off.
-Returns the new status of auto compression (non-nil means on).
+(autoload (quote jka-compr-handler) "jka-compr" "\
+Not documented
 
-\(fn &optional ARG)" t nil)
+\(fn OPERATION &rest ARGS)" nil nil)
 
-(autoload (quote with-auto-compression-mode) "jka-compr" "\
-Evalute BODY with automatic file compression and uncompression enabled.
+(autoload (quote jka-compr-uninstall) "jka-compr" "\
+Uninstall jka-compr.
+This removes the entries in `file-name-handler-alist' and `auto-mode-alist'
+and `inhibit-first-line-modes-suffixes' that were added
+by `jka-compr-installed'.
 
-\(fn &rest BODY)" nil (quote macro))
+\(fn)" nil nil)
 
 ;;;***
 \f
 ;;;### (autoloads (keypad-setup keypad-numlock-shifted-setup keypad-shifted-setup
 ;;;;;;  keypad-numlock-setup keypad-setup) "keypad" "emulation/keypad.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12466))
 ;;; Generated autoloads from emulation/keypad.el
 
 (defvar keypad-setup nil "\
@@ -14844,7 +14980,7 @@ the decimal key on the keypad is mapped to DECIMAL instead of `.'
 ;;;***
 \f
 ;;;### (autoloads (kinsoku) "kinsoku" "international/kinsoku.el"
-;;;;;;  (16213 43274))
+;;;;;;  (17087 12558))
 ;;; Generated autoloads from international/kinsoku.el
 
 (autoload (quote kinsoku) "kinsoku" "\
@@ -14865,8 +15001,8 @@ the context of text formatting.
 
 ;;;***
 \f
-;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (16213
-;;;;;;  43274))
+;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (17087
+;;;;;;  12558))
 ;;; Generated autoloads from international/kkc.el
 
 (defvar kkc-after-update-conversion-functions nil "\
@@ -14891,7 +15027,7 @@ and the return value is the length of the conversion.
 ;;;### (autoloads (kmacro-end-call-mouse kmacro-end-and-call-macro
 ;;;;;;  kmacro-end-or-call-macro kmacro-start-macro-or-insert-counter
 ;;;;;;  kmacro-call-macro kmacro-end-macro kmacro-start-macro) "kmacro"
-;;;;;;  "kmacro.el" (16908 33360))
+;;;;;;  "kmacro.el" (17087 12570))
 ;;; Generated autoloads from kmacro.el
  (global-set-key "\C-x(" 'kmacro-start-macro)
  (global-set-key "\C-x)" 'kmacro-end-macro)
@@ -14945,7 +15081,7 @@ A prefix argument serves as a repeat count.  Zero means repeat until error.
 When you call the macro, you can call the macro again by repeating
 just the last key in the key sequence that you used to call this
 command.  See `kmacro-call-repeat-key' and `kmacro-call-repeat-with-arg'
-for details on how to adjust or disable this behaviour.
+for details on how to adjust or disable this behavior.
 
 To make a macro permanent so you can call it even after defining
 others, use \\[kmacro-name-last-macro].
@@ -14998,7 +15134,7 @@ If kbd macro currently being defined end it before activating it.
 \f
 ;;;### (autoloads (kannada-post-read-conversion kannada-compose-string
 ;;;;;;  kannada-compose-region) "knd-util" "language/knd-util.el"
-;;;;;;  (16303 15430))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from language/knd-util.el
 
 (defconst kannada-consonant "[\x51f75-\x51fb9]")
@@ -15021,7 +15157,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (setup-korean-environment-internal) "korea-util"
-;;;;;;  "language/korea-util.el" (16213 43280))
+;;;;;;  "language/korea-util.el" (17087 12562))
 ;;; Generated autoloads from language/korea-util.el
 
 (defvar default-korean-keyboard (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) "3" "") "\
@@ -15036,7 +15172,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (lm lm-test-run) "landmark" "play/landmark.el"
-;;;;;;  (16478 51573))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from play/landmark.el
 
 (defalias (quote landmark-repeat) (quote lm-test-run))
@@ -15070,8 +15206,8 @@ Use \\[describe-mode] for more info.
 \f
 ;;;### (autoloads (lao-compose-region lao-composition-function lao-post-read-conversion
 ;;;;;;  lao-transcribe-roman-to-lao-string lao-transcribe-single-roman-syllable-to-lao
-;;;;;;  lao-compose-string) "lao-util" "language/lao-util.el" (16213
-;;;;;;  43280))
+;;;;;;  lao-compose-string) "lao-util" "language/lao-util.el" (17087
+;;;;;;  12562))
 ;;; Generated autoloads from language/lao-util.el
 
 (autoload (quote lao-compose-string) "lao-util" "\
@@ -15116,10 +15252,42 @@ Not documented
 
 \(fn FROM TO)" t nil)
 
+;;;***
+\f
+;;;### (autoloads (latexenc-find-file-coding-system latexenc-coding-system-to-inputenc
+;;;;;;  latexenc-inputenc-to-coding-system latex-inputenc-coding-alist)
+;;;;;;  "latexenc" "international/latexenc.el" (17087 12570))
+;;; Generated autoloads from international/latexenc.el
+
+(defvar latex-inputenc-coding-alist (quote (("ansinew" . windows-1252) ("applemac" . mac-roman) ("ascii" . us-ascii) ("cp1250" . windows-1250) ("cp1252" . windows-1252) ("cp1257" . cp1257) ("cp437de" . cp437) ("cp437" . cp437) ("cp850" . cp850) ("cp852" . cp852) ("cp865" . cp865) ("latin1" . iso-8859-1) ("latin2" . iso-8859-2) ("latin3" . iso-8859-3) ("latin4" . iso-8859-4) ("latin5" . iso-8859-5) ("latin9" . iso-8859-15) ("next" . next) ("utf8" . utf-8) ("utf8x" . utf-8))) "\
+Mapping from encoding names used by LaTeX's \"inputenc.sty\" to Emacs coding systems.
+Used by the function `latexenc-find-file-coding-system'.")
+
+(custom-autoload (quote latex-inputenc-coding-alist) "latexenc")
+
+(autoload (quote latexenc-inputenc-to-coding-system) "latexenc" "\
+Return the corresponding coding-system for the specified input encoding.
+Return nil if no matching coding system can be found.
+
+\(fn INPUTENC)" nil nil)
+
+(autoload (quote latexenc-coding-system-to-inputenc) "latexenc" "\
+Return the corresponding input encoding for the specified coding system.
+Return nil if no matching input encoding can be found.
+
+\(fn CS)" nil nil)
+
+(autoload (quote latexenc-find-file-coding-system) "latexenc" "\
+Determine the coding system of a LaTeX file if it uses \"inputenc.sty\".
+The mapping from LaTeX's \"inputenc.sty\" encoding names to Emacs
+coding system names is determined from `latex-inputenc-coding-alist'.
+
+\(fn ARG-LIST)" nil nil)
+
 ;;;***
 \f
 ;;;### (autoloads (latin1-display-ucs-per-lynx latin1-display latin1-display)
-;;;;;;  "latin1-disp" "international/latin1-disp.el" (16908 33362))
+;;;;;;  "latin1-disp" "international/latin1-disp.el" (17087 12558))
 ;;; Generated autoloads from international/latin1-disp.el
 
 (defvar latin1-display nil "\
@@ -15163,8 +15331,8 @@ use either \\[customize] or the function `latin1-display'.")
 ;;;***
 \f
 ;;;### (autoloads (turn-on-lazy-lock lazy-lock-mode) "lazy-lock"
-;;;;;;  "lazy-lock.el" (16213 43269))
-;;; Generated autoloads from lazy-lock.el
+;;;;;;  "obsolete/lazy-lock.el" (17087 12570))
+;;; Generated autoloads from obsolete/lazy-lock.el
 
 (autoload (quote lazy-lock-mode) "lazy-lock" "\
 Toggle Lazy Lock mode.
@@ -15210,7 +15378,7 @@ When Lazy Lock mode is enabled, fontification can be lazy in a number of ways:
   been idle for `lazy-lock-stealth-time' seconds, while Emacs remains idle.
   This is useful if any buffer has any deferred fontification.
 
-Basic Font Lock mode on-the-fly fontification behaviour fontifies modified
+Basic Font Lock mode on-the-fly fontification behavior fontifies modified
 lines only.  Thus, if `lazy-lock-defer-contextually' is non-nil, Lazy Lock mode
 on-the-fly fontification may fontify differently, albeit correctly.  In any
 event, to refontify some lines you can use \\[font-lock-fontify-block].
@@ -15231,7 +15399,7 @@ Unconditionally turn on Lazy Lock mode.
 ;;;***
 \f
 ;;;### (autoloads (ld-script-mode) "ld-script" "progmodes/ld-script.el"
-;;;;;;  (16239 25259))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from progmodes/ld-script.el
 
 (add-to-list (quote auto-mode-alist) (quote ("\\.lds" . ld-script-mode)))
@@ -15244,7 +15412,7 @@ A major mode to edit GNU ld script files
 ;;;***
 \f
 ;;;### (autoloads (ledit-from-lisp-mode ledit-mode) "ledit" "ledit.el"
-;;;;;;  (16213 43269))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from ledit.el
 
 (defconst ledit-save-files t "\
@@ -15278,7 +15446,7 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (life) "life" "play/life.el" (16793 54110))
+;;;### (autoloads (life) "life" "play/life.el" (17087 12558))
 ;;; Generated autoloads from play/life.el
 
 (autoload (quote life) "life" "\
@@ -15291,8 +15459,8 @@ generations (this defaults to 1).
 
 ;;;***
 \f
-;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (16858
-;;;;;;  50917))
+;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (17087
+;;;;;;  12537))
 ;;; Generated autoloads from loadhist.el
 
 (autoload (quote unload-feature) "loadhist" "\
@@ -15315,7 +15483,7 @@ such as redefining an Emacs function.
 ;;;***
 \f
 ;;;### (autoloads (locate-with-filter locate locate-ls-subdir-switches)
-;;;;;;  "locate" "locate.el" (16908 33360))
+;;;;;;  "locate" "locate.el" (17087 12566))
 ;;; Generated autoloads from locate.el
 
 (defvar locate-ls-subdir-switches "-al" "\
@@ -15340,7 +15508,7 @@ shown; this is often useful to constrain a big search.
 
 ;;;***
 \f
-;;;### (autoloads (log-edit) "log-edit" "log-edit.el" (16908 33360))
+;;;### (autoloads (log-edit) "log-edit" "log-edit.el" (17087 12570))
 ;;; Generated autoloads from log-edit.el
 
 (autoload (quote log-edit) "log-edit" "\
@@ -15361,8 +15529,8 @@ If BUFFER is non-nil `log-edit' will jump to that buffer, use it to edit the
 
 ;;;***
 \f
-;;;### (autoloads (log-view-mode) "log-view" "log-view.el" (16923
-;;;;;;  3606))
+;;;### (autoloads (log-view-mode) "log-view" "log-view.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from log-view.el
 
 (autoload (quote log-view-mode) "log-view" "\
@@ -15370,11 +15538,32 @@ Major mode for browsing CVS log output.
 
 \(fn)" t nil)
 
+;;;***
+\f
+;;;### (autoloads (longlines-mode) "longlines" "longlines.el" (17087
+;;;;;;  12575))
+;;; Generated autoloads from longlines.el
+
+(autoload (quote longlines-mode) "longlines" "\
+Toggle Long Lines mode.
+In Long Lines mode, long lines are wrapped if they extend beyond
+`fill-column'.  The soft newlines used for line wrapping will not
+show up when the text is yanked or saved to disk.
+
+If the variable `longlines-auto-wrap' is non-nil, lines are automatically
+wrapped whenever the buffer is changed.  You can always call
+`fill-paragraph' to fill individual paragraphs.
+
+If the variable `longlines-show-hard-newlines' is non-nil, hard newlines
+are indicated with a symbol.
+
+\(fn &optional ARG)" t nil)
+
 ;;;***
 \f
 ;;;### (autoloads (print-region lpr-region print-buffer lpr-buffer
-;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (16213
-;;;;;;  43269))
+;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from lpr.el
 
 (defvar lpr-windows-system (memq system-type (quote (emx win32 w32 mswindows ms-dos windows-nt))))
@@ -15468,7 +15657,7 @@ for further customization of the printer command.
 ;;;***
 \f
 ;;;### (autoloads (ls-lisp-support-shell-wildcards) "ls-lisp" "ls-lisp.el"
-;;;;;;  (16727 56921))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from ls-lisp.el
 
 (defvar ls-lisp-support-shell-wildcards t "\
@@ -15479,8 +15668,8 @@ Otherwise they are treated as Emacs regexps (for backward compatibility).")
 
 ;;;***
 \f
-;;;### (autoloads (phases-of-moon) "lunar" "calendar/lunar.el" (16213
-;;;;;;  43272))
+;;;### (autoloads (phases-of-moon) "lunar" "calendar/lunar.el" (17087
+;;;;;;  12528))
 ;;; Generated autoloads from calendar/lunar.el
 
 (autoload (quote phases-of-moon) "lunar" "\
@@ -15493,8 +15682,8 @@ This function is suitable for execution in a .emacs file.
 
 ;;;***
 \f
-;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (16213
-;;;;;;  43282))
+;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from progmodes/m4-mode.el
 
 (autoload (quote m4-mode) "m4-mode" "\
@@ -15506,7 +15695,7 @@ A major mode to edit m4 macro files.
 ;;;***
 \f
 ;;;### (autoloads (macroexpand-all) "macroexp" "emacs-lisp/macroexp.el"
-;;;;;;  (16424 14687))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from emacs-lisp/macroexp.el
 
 (autoload (quote macroexpand-all) "macroexp" "\
@@ -15520,7 +15709,7 @@ definitions to shadow the loaded ones for use in file byte-compilation.
 ;;;***
 \f
 ;;;### (autoloads (apply-macro-to-region-lines kbd-macro-query insert-kbd-macro
-;;;;;;  name-last-kbd-macro) "macros" "macros.el" (16810 63790))
+;;;;;;  name-last-kbd-macro) "macros" "macros.el" (17087 12444))
 ;;; Generated autoloads from macros.el
 
 (autoload (quote name-last-kbd-macro) "macros" "\
@@ -15609,7 +15798,7 @@ and then select the region of un-tablified names and use
 ;;;***
 \f
 ;;;### (autoloads (what-domain mail-extract-address-components) "mail-extr"
-;;;;;;  "mail/mail-extr.el" (16908 33362))
+;;;;;;  "mail/mail-extr.el" (17087 12466))
 ;;; Generated autoloads from mail/mail-extr.el
 
 (autoload (quote mail-extract-address-components) "mail-extr" "\
@@ -15640,7 +15829,7 @@ Convert mail domain DOMAIN to the country it corresponds to.
 \f
 ;;;### (autoloads (mail-hist-put-headers-into-history mail-hist-keep-history
 ;;;;;;  mail-hist-enable mail-hist-define-keys) "mail-hist" "mail/mail-hist.el"
-;;;;;;  (16213 43280))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from mail/mail-hist.el
 
 (autoload (quote mail-hist-define-keys) "mail-hist" "\
@@ -15671,8 +15860,8 @@ This function normally would be called when the message is sent.
 \f
 ;;;### (autoloads (mail-fetch-field mail-unquote-printable-region
 ;;;;;;  mail-unquote-printable mail-quote-printable mail-file-babyl-p
-;;;;;;  mail-use-rfc822) "mail-utils" "mail/mail-utils.el" (16456
-;;;;;;  21757))
+;;;;;;  mail-use-rfc822) "mail-utils" "mail/mail-utils.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from mail/mail-utils.el
 
 (defvar mail-use-rfc822 nil "\
@@ -15724,7 +15913,7 @@ If 4th arg LIST is non-nil, return a list of all such fields.
 ;;;***
 \f
 ;;;### (autoloads (define-mail-abbrev build-mail-abbrevs mail-abbrevs-setup)
-;;;;;;  "mailabbrev" "mail/mailabbrev.el" (16858 50930))
+;;;;;;  "mailabbrev" "mail/mailabbrev.el" (17087 12453))
 ;;; Generated autoloads from mail/mailabbrev.el
 
 (autoload (quote mail-abbrevs-setup) "mailabbrev" "\
@@ -15747,8 +15936,8 @@ If DEFINITION contains multiple addresses, separate them with commas.
 ;;;***
 \f
 ;;;### (autoloads (mail-complete define-mail-alias expand-mail-aliases
-;;;;;;  mail-complete-style) "mailalias" "mail/mailalias.el" (16213
-;;;;;;  43280))
+;;;;;;  mail-complete-style) "mailalias" "mail/mailalias.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from mail/mailalias.el
 
 (defvar mail-complete-style (quote angles) "\
@@ -15793,13 +15982,25 @@ current header, calls `mail-complete-function' and passes prefix arg if any.
 
 ;;;***
 \f
-;;;### (autoloads (makefile-mode) "make-mode" "progmodes/make-mode.el"
-;;;;;;  (16719 60888))
+;;;### (autoloads (makefile-bsdmake-mode makefile-makepp-mode makefile-gmake-mode
+;;;;;;  makefile-automake-mode makefile-mode) "make-mode" "progmodes/make-mode.el"
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from progmodes/make-mode.el
 
 (autoload (quote makefile-mode) "make-mode" "\
-Major mode for editing Makefiles.
-This function ends by invoking the function(s) `makefile-mode-hook'.
+Major mode for editing standard Makefiles.
+
+If you are editing a file for a different make, try one of the
+variants `makefile-automake-mode', `makefile-gmake-mode',
+`makefile-makepp-mode' or `makefile-bsdmake-mode'.  All but the
+last should be correctly chosen based on the file name, except if
+it is *.mk.  This function ends by invoking the function(s)
+`makefile-mode-hook'.
+
+It is strongly recommended to use `font-lock-mode', because that
+provides additional parsing information.  This is used for
+example to see that a rule action `echo foo: bar' is a not rule
+dependency, despite the colon.
 
 \\{makefile-mode-map}
 
@@ -15873,10 +16074,30 @@ Makefile mode can be configured by modifying the following variables:
 
 \(fn)" t nil)
 
+(autoload (quote makefile-automake-mode) "make-mode" "\
+An adapted `makefile-mode' that knows about automake.
+
+\(fn)" t nil)
+
+(autoload (quote makefile-gmake-mode) "make-mode" "\
+An adapted `makefile-mode' that knows about gmake.
+
+\(fn)" t nil)
+
+(autoload (quote makefile-makepp-mode) "make-mode" "\
+An adapted `makefile-mode' that knows about makepp.
+
+\(fn)" t nil)
+
+(autoload (quote makefile-bsdmake-mode) "make-mode" "\
+An adapted `makefile-mode' that knows about BSD make.
+
+\(fn)" t nil)
+
 ;;;***
 \f
-;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (16213
-;;;;;;  43269))
+;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from makesum.el
 
 (autoload (quote make-command-summary) "makesum" "\
@@ -15887,7 +16108,7 @@ Previous contents of that buffer are killed first.
 
 ;;;***
 \f
-;;;### (autoloads (man-follow man) "man" "man.el" (16958 58756))
+;;;### (autoloads (man-follow man) "man" "man.el" (17087 12570))
 ;;; Generated autoloads from man.el
 
 (defalias (quote manual-entry) (quote man))
@@ -15914,7 +16135,7 @@ Get a Un*x manual page of the item under point and put it in a buffer.
 
 ;;;***
 \f
-;;;### (autoloads (master-mode) "master" "master.el" (16213 43269))
+;;;### (autoloads (master-mode) "master" "master.el" (17087 12528))
 ;;; Generated autoloads from master.el
 
 (autoload (quote master-mode) "master" "\
@@ -15936,8 +16157,8 @@ yourself the value of `master-of' by calling `master-show-slave'.
 
 ;;;***
 \f
-;;;### (autoloads (menu-bar-mode) "menu-bar" "menu-bar.el" (16939
-;;;;;;  44104))
+;;;### (autoloads (menu-bar-mode) "menu-bar" "menu-bar.el" (17087
+;;;;;;  12575))
 ;;; Generated autoloads from menu-bar.el
 
 (put (quote menu-bar-mode) (quote standard-value) (quote (t)))
@@ -15974,7 +16195,7 @@ turn on menu bars; otherwise, turn off menu bars.
 ;;;;;;  message-signature message-indent-citation-function message-cite-function
 ;;;;;;  message-yank-prefix message-citation-line-function message-send-mail-function
 ;;;;;;  message-user-organization-file message-signature-separator
-;;;;;;  message-from-style) "message" "gnus/message.el" (16953 20625))
+;;;;;;  message-from-style) "message" "gnus/message.el" (17087 12574))
 ;;; Generated autoloads from gnus/message.el
 
 (defvar message-from-style (quote default) "\
@@ -16280,7 +16501,7 @@ which specify the range to operate on.
 ;;;***
 \f
 ;;;### (autoloads (metapost-mode metafont-mode) "meta-mode" "progmodes/meta-mode.el"
-;;;;;;  (16923 3630))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from progmodes/meta-mode.el
 
 (autoload (quote metafont-mode) "meta-mode" "\
@@ -16307,7 +16528,7 @@ Turning on MetaPost mode calls the value of the variable
 \f
 ;;;### (autoloads (metamail-region metamail-buffer metamail-interpret-body
 ;;;;;;  metamail-interpret-header) "metamail" "mail/metamail.el"
-;;;;;;  (16507 41097))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from mail/metamail.el
 
 (autoload (quote metamail-interpret-header) "metamail" "\
@@ -16351,8 +16572,8 @@ redisplayed as output is inserted.
 ;;;***
 \f
 ;;;### (autoloads (mh-letter-mode mh-smail-other-window mh-user-agent-compose
-;;;;;;  mh-smail-batch mh-smail) "mh-comp" "mh-e/mh-comp.el" (16684
-;;;;;;  26435))
+;;;;;;  mh-smail-batch mh-smail) "mh-comp" "mh-e/mh-comp.el" (17087
+;;;;;;  12575))
 ;;; Generated autoloads from mh-e/mh-comp.el
 
 (autoload (quote mh-smail) "mh-comp" "\
@@ -16423,12 +16644,11 @@ When a message is composed, the hooks `text-mode-hook' and
 \\{mh-letter-mode-map}
 
 \(fn)" t nil)
-(add-to-list 'auto-mode-alist '("/drafts/[0-9]+\\'" . mh-letter-mode))
 
 ;;;***
 \f
 ;;;### (autoloads (mh-restore-desktop-buffer mh-version mh-nmail
-;;;;;;  mh-rmail) "mh-e" "mh-e/mh-e.el" (16684 26435))
+;;;;;;  mh-rmail) "mh-e" "mh-e/mh-e.el" (17087 12567))
 ;;; Generated autoloads from mh-e/mh-e.el
 
 (autoload (quote mh-rmail) "mh-e" "\
@@ -16461,7 +16681,7 @@ DESKTOP-BUFFER-MISC holds a list of miscellaneous info used by the
 
 ;;;***
 \f
-;;;### (autoloads nil "mh-init" "mh-e/mh-init.el" (16684 26435))
+;;;### (autoloads nil "mh-init" "mh-e/mh-init.el" (17087 12567))
 ;;; Generated autoloads from mh-e/mh-init.el
 
 (put (quote mh-progs) (quote risky-local-variable) t)
@@ -16473,7 +16693,7 @@ DESKTOP-BUFFER-MISC holds a list of miscellaneous info used by the
 ;;;***
 \f
 ;;;### (autoloads (midnight-delay-set clean-buffer-list) "midnight"
-;;;;;;  "midnight.el" (16423 23568))
+;;;;;;  "midnight.el" (17087 12537))
 ;;; Generated autoloads from midnight.el
 
 (autoload (quote clean-buffer-list) "midnight" "\
@@ -16500,7 +16720,7 @@ to its second argument TM.
 ;;;***
 \f
 ;;;### (autoloads (minibuffer-electric-default-mode) "minibuf-eldef"
-;;;;;;  "minibuf-eldef.el" (16575 1356))
+;;;;;;  "minibuf-eldef.el" (17087 12380))
 ;;; Generated autoloads from minibuf-eldef.el
 
 (defvar minibuffer-electric-default-mode nil "\
@@ -16527,7 +16747,7 @@ Returns non-nil if the new state is enabled.
 ;;;***
 \f
 ;;;### (autoloads (mixal-mode) "mixal-mode" "progmodes/mixal-mode.el"
-;;;;;;  (16858 50936))
+;;;;;;  (17087 12451))
 ;;; Generated autoloads from progmodes/mixal-mode.el
 
 (autoload (quote mixal-mode) "mixal-mode" "\
@@ -16542,7 +16762,7 @@ Major mode for the mixal asm language.
 \f
 ;;;### (autoloads (malayalam-composition-function malayalam-post-read-conversion
 ;;;;;;  malayalam-compose-region) "mlm-util" "language/mlm-util.el"
-;;;;;;  (16233 29568))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from language/mlm-util.el
 
 (autoload (quote malayalam-compose-region) "mlm-util" "\
@@ -16557,7 +16777,7 @@ Not documented
 
 (autoload (quote malayalam-composition-function) "mlm-util" "\
 Compose Malayalam characters in REGION, or STRING if specified.
-Assume that the REGION or STRING must fully match the composable
+Assume that the REGION or STRING must fully match the composable 
 PATTERN regexp.
 
 \(fn FROM TO PATTERN &optional STRING)" nil nil)
@@ -16565,7 +16785,7 @@ PATTERN regexp.
 ;;;***
 \f
 ;;;### (autoloads (mm-inline-external-body) "mm-extern" "gnus/mm-extern.el"
-;;;;;;  (16697 49031))
+;;;;;;  (17087 12574))
 ;;; Generated autoloads from gnus/mm-extern.el
 
 (autoload (quote mm-inline-external-body) "mm-extern" "\
@@ -16579,7 +16799,7 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing.
 ;;;***
 \f
 ;;;### (autoloads (mm-inline-partial) "mm-partial" "gnus/mm-partial.el"
-;;;;;;  (16698 21928))
+;;;;;;  (17087 12415))
 ;;; Generated autoloads from gnus/mm-partial.el
 
 (autoload (quote mm-inline-partial) "mm-partial" "\
@@ -16593,7 +16813,7 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing.
 ;;;***
 \f
 ;;;### (autoloads (mm-url-insert-file-contents-external mm-url-insert-file-contents)
-;;;;;;  "mm-url" "gnus/mm-url.el" (16954 46150))
+;;;;;;  "mm-url" "gnus/mm-url.el" (17087 12531))
 ;;; Generated autoloads from gnus/mm-url.el
 
 (autoload (quote mm-url-insert-file-contents) "mm-url" "\
@@ -16609,8 +16829,8 @@ Insert file contents of URL using `mm-url-program'.
 
 ;;;***
 \f
-;;;### (autoloads (mm-uu-dissect) "mm-uu" "gnus/mm-uu.el" (16908
-;;;;;;  33361))
+;;;### (autoloads (mm-uu-dissect) "mm-uu" "gnus/mm-uu.el" (17087
+;;;;;;  12466))
 ;;; Generated autoloads from gnus/mm-uu.el
 
 (autoload (quote mm-uu-dissect) "mm-uu" "\
@@ -16621,7 +16841,7 @@ Dissect the current buffer and return a list of uu handles.
 ;;;***
 \f
 ;;;### (autoloads (mml1991-sign mml1991-encrypt) "mml1991" "gnus/mml1991.el"
-;;;;;;  (16697 49031))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from gnus/mml1991.el
 
 (autoload (quote mml1991-encrypt) "mml1991" "\
@@ -16638,7 +16858,7 @@ Not documented
 \f
 ;;;### (autoloads (mml2015-self-encrypt mml2015-sign mml2015-encrypt
 ;;;;;;  mml2015-verify-test mml2015-verify mml2015-decrypt-test mml2015-decrypt)
-;;;;;;  "mml2015" "gnus/mml2015.el" (16908 33361))
+;;;;;;  "mml2015" "gnus/mml2015.el" (17087 12567))
 ;;; Generated autoloads from gnus/mml2015.el
 
 (autoload (quote mml2015-decrypt) "mml2015" "\
@@ -16679,7 +16899,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (modula-2-mode) "modula2" "progmodes/modula2.el"
-;;;;;;  (16858 50936))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from progmodes/modula2.el
 
 (autoload (quote modula-2-mode) "modula2" "\
@@ -16711,7 +16931,7 @@ followed by the first character of the construct.
 ;;;***
 \f
 ;;;### (autoloads (unmorse-region morse-region) "morse" "play/morse.el"
-;;;;;;  (16442 4954))
+;;;;;;  (17087 12558))
 ;;; Generated autoloads from play/morse.el
 
 (autoload (quote morse-region) "morse" "\
@@ -16726,8 +16946,8 @@ Convert morse coded text in region to ordinary ASCII text.
 
 ;;;***
 \f
-;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (16770
-;;;;;;  10720))
+;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (17087
+;;;;;;  12558))
 ;;; Generated autoloads from mouse-sel.el
 
 (defvar mouse-sel-mode nil "\
@@ -16778,7 +16998,7 @@ primary selection and region.
 
 ;;;***
 \f
-;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (16213 43281))
+;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (17087 12570))
 ;;; Generated autoloads from play/mpuz.el
 
 (autoload (quote mpuz) "mpuz" "\
@@ -16788,7 +17008,7 @@ Multiplication puzzle with GNU Emacs.
 
 ;;;***
 \f
-;;;### (autoloads (msb-mode) "msb" "msb.el" (16764 51518))
+;;;### (autoloads (msb-mode) "msb" "msb.el" (17087 12528))
 ;;; Generated autoloads from msb.el
 
 (defvar msb-mode nil "\
@@ -16814,7 +17034,7 @@ different buffer menu using the function `msb'.
 ;;;;;;  describe-current-coding-system describe-current-coding-system-briefly
 ;;;;;;  describe-coding-system describe-character-set list-charset-chars
 ;;;;;;  read-charset list-character-sets) "mule-diag" "international/mule-diag.el"
-;;;;;;  (16515 33869))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from international/mule-diag.el
 
 (defvar non-iso-charset-alist (\` ((mac-roman (ascii latin-iso8859-1 mule-unicode-2500-33ff mule-unicode-0100-24ff mule-unicode-e000-ffff) mac-roman-decoder ((0 255))) (viscii (ascii vietnamese-viscii-lower vietnamese-viscii-upper) viet-viscii-nonascii-translation-table ((0 255))) (vietnamese-tcvn (ascii vietnamese-viscii-lower vietnamese-viscii-upper) viet-tcvn-nonascii-translation-table ((0 255))) (koi8-r (ascii cyrillic-iso8859-5) cyrillic-koi8-r-nonascii-translation-table ((32 255))) (alternativnyj (ascii cyrillic-iso8859-5) cyrillic-alternativnyj-nonascii-translation-table ((32 255))) (koi8-u (ascii cyrillic-iso8859-5 mule-unicode-0100-24ff) cyrillic-koi8-u-nonascii-translation-table ((32 255))) (big5 (ascii chinese-big5-1 chinese-big5-2) decode-big5-char ((32 127) ((161 254) 64 126 161 254))) (sjis (ascii katakana-jisx0201 japanese-jisx0208) decode-sjis-char ((32 127 161 223) ((129 159 224 239) 64 126 128 252))))) "\
@@ -16987,7 +17207,7 @@ system which uses fontsets).
 ;;;;;;  coding-system-translation-table-for-decode coding-system-pre-write-conversion
 ;;;;;;  coding-system-post-read-conversion lookup-nested-alist set-nested-alist
 ;;;;;;  truncate-string-to-width store-substring string-to-sequence)
-;;;;;;  "mule-util" "international/mule-util.el" (16908 33362))
+;;;;;;  "mule-util" "international/mule-util.el" (17087 12558))
 ;;; Generated autoloads from international/mule-util.el
 
 (autoload (quote string-to-sequence) "mule-util" "\
@@ -17035,10 +17255,6 @@ defaults to \"...\".
 
 \(fn STR END-COLUMN &optional START-COLUMN PADDING ELLIPSIS)" nil nil)
 
-(defalias (quote truncate-string) (quote truncate-string-to-width))
-
-(make-obsolete (quote truncate-string) (quote truncate-string-to-width) "20.1")
-
 (defsubst nested-alist-p (obj) "\
 Return t if OBJ is a nested alist.
 
@@ -17120,7 +17336,7 @@ basis, this may not be accurate.
 ;;;***
 \f
 ;;;### (autoloads (mwheel-install mouse-wheel-mode) "mwheel" "mwheel.el"
-;;;;;;  (16788 34909))
+;;;;;;  (17087 12440))
 ;;; Generated autoloads from mwheel.el
 
 (defvar mouse-wheel-mode nil "\
@@ -17148,7 +17364,7 @@ Enable mouse wheel support.
 ;;;### (autoloads (network-connection network-connection-to-service
 ;;;;;;  whois-reverse-lookup whois finger ftp dig dns-lookup-host
 ;;;;;;  nslookup nslookup-host route arp netstat ipconfig ping traceroute)
-;;;;;;  "net-utils" "net/net-utils.el" (16719 60888))
+;;;;;;  "net-utils" "net/net-utils.el" (17087 12564))
 ;;; Generated autoloads from net/net-utils.el
 
 (autoload (quote traceroute) "net-utils" "\
@@ -17244,7 +17460,7 @@ Open a network connection to HOST on PORT.
 ;;;;;;  comment-kill comment-set-column comment-indent comment-indent-default
 ;;;;;;  comment-normalize-vars comment-multi-line comment-padding
 ;;;;;;  comment-style comment-column) "newcomment" "newcomment.el"
-;;;;;;  (16764 51518))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from newcomment.el
 
 (defalias (quote indent-for-comment) (quote comment-indent))
@@ -17426,7 +17642,7 @@ unless optional argument SOFT is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (nndiary-generate-nov-databases) "nndiary" "gnus/nndiary.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from gnus/nndiary.el
 
 (autoload (quote nndiary-generate-nov-databases) "nndiary" "\
@@ -17436,8 +17652,8 @@ Generate NOV databases in all nndiary directories.
 
 ;;;***
 \f
-;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (16698
-;;;;;;  21928))
+;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (17087
+;;;;;;  12567))
 ;;; Generated autoloads from gnus/nndoc.el
 
 (autoload (quote nndoc-add-type) "nndoc" "\
@@ -17452,7 +17668,7 @@ symbol in the alist.
 ;;;***
 \f
 ;;;### (autoloads (nnfolder-generate-active-file) "nnfolder" "gnus/nnfolder.el"
-;;;;;;  (16927 494))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from gnus/nnfolder.el
 
 (autoload (quote nnfolder-generate-active-file) "nnfolder" "\
@@ -17464,7 +17680,7 @@ This command does not work if you use short group names.
 ;;;***
 \f
 ;;;### (autoloads (nnkiboze-generate-groups) "nnkiboze" "gnus/nnkiboze.el"
-;;;;;;  (16698 21928))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from gnus/nnkiboze.el
 
 (autoload (quote nnkiboze-generate-groups) "nnkiboze" "\
@@ -17476,7 +17692,7 @@ Finds out what articles are to be part of the nnkiboze groups.
 ;;;***
 \f
 ;;;### (autoloads (nnml-generate-nov-databases) "nnml" "gnus/nnml.el"
-;;;;;;  (16792 36614))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from gnus/nnml.el
 
 (autoload (quote nnml-generate-nov-databases) "nnml" "\
@@ -17487,7 +17703,7 @@ Generate NOV databases in all nnml directories.
 ;;;***
 \f
 ;;;### (autoloads (nnsoup-revert-variables nnsoup-set-variables nnsoup-pack-replies)
-;;;;;;  "nnsoup" "gnus/nnsoup.el" (16698 21929))
+;;;;;;  "nnsoup" "gnus/nnsoup.el" (17087 12567))
 ;;; Generated autoloads from gnus/nnsoup.el
 
 (autoload (quote nnsoup-pack-replies) "nnsoup" "\
@@ -17508,7 +17724,7 @@ Revert posting and mailing methods to the standard Emacs methods.
 ;;;***
 \f
 ;;;### (autoloads (disable-command enable-command disabled-command-function)
-;;;;;;  "novice" "novice.el" (16939 44104))
+;;;;;;  "novice" "novice.el" (17087 12542))
 ;;; Generated autoloads from novice.el
 
 (defvar disabled-command-function (quote disabled-command-function) "\
@@ -17542,7 +17758,7 @@ to future sessions.
 ;;;***
 \f
 ;;;### (autoloads (nroff-mode) "nroff-mode" "textmodes/nroff-mode.el"
-;;;;;;  (16213 43283))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from textmodes/nroff-mode.el
 
 (autoload (quote nroff-mode) "nroff-mode" "\
@@ -17557,7 +17773,7 @@ closing requests for requests that are used in matched pairs.
 ;;;***
 \f
 ;;;### (autoloads (octave-help) "octave-hlp" "progmodes/octave-hlp.el"
-;;;;;;  (16213 43282))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from progmodes/octave-hlp.el
 
 (autoload (quote octave-help) "octave-hlp" "\
@@ -17571,7 +17787,7 @@ If KEY is not a string, prompt for it with completion.
 ;;;***
 \f
 ;;;### (autoloads (inferior-octave) "octave-inf" "progmodes/octave-inf.el"
-;;;;;;  (16288 58564))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from progmodes/octave-inf.el
 
 (autoload (quote inferior-octave) "octave-inf" "\
@@ -17594,7 +17810,7 @@ startup file, `~/.emacs-octave'.
 ;;;***
 \f
 ;;;### (autoloads (octave-mode) "octave-mod" "progmodes/octave-mod.el"
-;;;;;;  (16284 63121))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from progmodes/octave-mod.el
 
 (autoload (quote octave-mode) "octave-mod" "\
@@ -17693,7 +17909,7 @@ including a reproducible test case and send the message.
 ;;;***
 \f
 ;;;### (autoloads (edit-options list-options) "options" "obsolete/options.el"
-;;;;;;  (16213 43281))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from obsolete/options.el
 
 (autoload (quote list-options) "options" "\
@@ -17716,12 +17932,12 @@ The Custom feature is intended to make this obsolete.
 \f
 ;;;### (autoloads (orgtbl-mode turn-on-orgtbl org-remember-handler
 ;;;;;;  org-remember-annotation org-store-link org-diary org-agenda
-;;;;;;  org-agenda-mode org-mode) "org" "textmodes/org.el" (16876
-;;;;;;  58220))
+;;;;;;  org-agenda-mode org-mode) "org" "textmodes/org.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from textmodes/org.el
 
 (autoload (quote org-mode) "org" "\
-Outline-based notes management and organizer, alias 
+Outline-based notes management and organizer, alias
 \"Carstens outline-mode for keeping track of everything.\"
 
 Org-mode develops organizational tasks around a NOTES file which
@@ -17733,13 +17949,13 @@ calendar.  Tables are easily created with a built-in table editor.
 Plain text URL-like links connect to websites, emails (VM), Usenet
 messages (Gnus), BBDB entries, and any files related to the project.
 For printing and sharing of notes, an Org-mode file (or a part of it)
-can be exported as a well-structured ASCII or HTML file.
+can be exported as a structured ASCII or HTML file.
 
 The following commands are available:
 
 \\{org-mode-map}
 
-\(fn &optional ARG)" t nil)
+\(fn)" t nil)
 
 (autoload (quote org-agenda-mode) "org" "\
 Mode for time-sorted view on action items in Org-mode files.
@@ -17754,7 +17970,7 @@ The following commands are available:
 Produce a weekly view from all files in variable `org-agenda-files'.
 The view will be for the current week, but from the overview buffer you
 will be able to go to other weeks.
-With one C-u prefix argument INCLUDE-ALL, all unfinished TODO items will
+With one \\[universal-argument] prefix argument INCLUDE-ALL, all unfinished TODO items will
 also be shown, under the current date.
 START-DAY defaults to TODAY, or to the most recent match for the weekday
 given in `org-agenda-start-on-weekday'.
@@ -17763,8 +17979,8 @@ NDAYS defaults to `org-agenda-ndays'.
 \(fn &optional INCLUDE-ALL START-DAY NDAYS)" t nil)
 
 (autoload (quote org-diary) "org" "\
-Returns diary information from org-files.
-This function can be used in an \"sexp\" diary entry in the Emacs calendar.
+Return diary information from org-files.
+This function can be used in a \"sexp\" diary entry in the Emacs calendar.
 It accesses org files and extracts information from those files to be
 listed in the diary.  The function accepts arguments specifying what
 items should be listed.  The following arguments are allowed:
@@ -17784,7 +18000,7 @@ items should be listed.  The following arguments are allowed:
 
    :todo         List all TODO items from the org-file.  This may be a
                  long list - so this is not turned on by default.
-                 Like deadlines, these entires only show up in the
+                 Like deadlines, these entries only show up in the
                  diary for *today*, not at any other date.
 
 The call in the diary file should look like this:
@@ -17863,19 +18079,19 @@ See also the variable `org-reverse-note-order'.
 \(fn)" nil nil)
 
 (autoload (quote turn-on-orgtbl) "org" "\
-Unconditionally turn on orgtbl-mode.
+Unconditionally turn on `orgtbl-mode'.
 
 \(fn)" nil nil)
 
 (autoload (quote orgtbl-mode) "org" "\
-The org-mode table editor as a minor mode for use in other modes.
+The `org-mode' table editor as a minor mode for use in other modes.
 
 \(fn &optional ARG)" t nil)
 
 ;;;***
 \f
 ;;;### (autoloads (outline-minor-mode outline-mode) "outline" "outline.el"
-;;;;;;  (16780 55376))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from outline.el
 
 (autoload (quote outline-mode) "outline" "\
@@ -17930,7 +18146,7 @@ See the command `outline-mode' for more information on this mode.
 
 ;;;***
 \f
-;;;### (autoloads (show-paren-mode) "paren" "paren.el" (16821 35887))
+;;;### (autoloads (show-paren-mode) "paren" "paren.el" (17087 12570))
 ;;; Generated autoloads from paren.el
 
 (defvar show-paren-mode nil "\
@@ -17954,7 +18170,7 @@ in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time.
 ;;;***
 \f
 ;;;### (autoloads (parse-time-string) "parse-time" "calendar/parse-time.el"
-;;;;;;  (16243 62806))
+;;;;;;  (17087 12379))
 ;;; Generated autoloads from calendar/parse-time.el
 
 (autoload (quote parse-time-string) "parse-time" "\
@@ -17966,8 +18182,8 @@ unknown are returned as nil.
 
 ;;;***
 \f
-;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (16213
-;;;;;;  43282))
+;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from progmodes/pascal.el
 
 (autoload (quote pascal-mode) "pascal" "\
@@ -18020,7 +18236,7 @@ no args, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (pc-bindings-mode) "pc-mode" "emulation/pc-mode.el"
-;;;;;;  (16213 43273))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from emulation/pc-mode.el
 
 (autoload (quote pc-bindings-mode) "pc-mode" "\
@@ -18038,7 +18254,7 @@ C-Escape does list-buffers.
 ;;;***
 \f
 ;;;### (autoloads (pc-selection-mode pc-selection-mode) "pc-select"
-;;;;;;  "emulation/pc-select.el" (16589 26258))
+;;;;;;  "emulation/pc-select.el" (17087 12569))
 ;;; Generated autoloads from emulation/pc-select.el
 
 (defvar pc-selection-mode nil "\
@@ -18050,7 +18266,7 @@ use either \\[customize] or the function `pc-selection-mode'.")
 (custom-autoload (quote pc-selection-mode) "pc-select")
 
 (autoload (quote pc-selection-mode) "pc-select" "\
-Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style.
+Change mark behavior to emulate Motif, MAC or MS-Windows cut and paste style.
 
 This mode enables Delete Selection mode and Transient Mark mode.
 
@@ -18103,7 +18319,7 @@ but before calling PC Selection mode):
 
 (defvar pc-selection-mode nil "\
 Toggle PC Selection mode.
-Change mark behaviour to emulate Motif, MAC or MS-Windows cut and paste style,
+Change mark behavior to emulate Motif, MAC or MS-Windows cut and paste style,
 and cursor movement commands.
 This mode enables Delete Selection mode and Transient Mark mode.
 Setting this variable directly does not take effect;
@@ -18113,8 +18329,8 @@ you must modify it using \\[customize] or \\[pc-selection-mode].")
 
 ;;;***
 \f
-;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (16213
-;;;;;;  43269))
+;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from pcmpl-cvs.el
 
 (autoload (quote pcomplete/cvs) "pcmpl-cvs" "\
@@ -18125,7 +18341,7 @@ Completion rules for the `cvs' command.
 ;;;***
 \f
 ;;;### (autoloads (pcomplete/tar pcomplete/make pcomplete/bzip2 pcomplete/gzip)
-;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (16213 43269))
+;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (17087 12380))
 ;;; Generated autoloads from pcmpl-gnu.el
 
 (autoload (quote pcomplete/gzip) "pcmpl-gnu" "\
@@ -18153,7 +18369,7 @@ Completion for the GNU tar utility.
 ;;;***
 \f
 ;;;### (autoloads (pcomplete/mount pcomplete/umount pcomplete/kill)
-;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (16213 43269))
+;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (17087 12380))
 ;;; Generated autoloads from pcmpl-linux.el
 
 (autoload (quote pcomplete/kill) "pcmpl-linux" "\
@@ -18173,8 +18389,8 @@ Completion for GNU/Linux `mount'.
 
 ;;;***
 \f
-;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (16213
-;;;;;;  43269))
+;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from pcmpl-rpm.el
 
 (autoload (quote pcomplete/rpm) "pcmpl-rpm" "\
@@ -18190,7 +18406,7 @@ You can use \\[eshell-report-bug] to do so.
 \f
 ;;;### (autoloads (pcomplete/chgrp pcomplete/chown pcomplete/which
 ;;;;;;  pcomplete/xargs pcomplete/rm pcomplete/rmdir pcomplete/cd)
-;;;;;;  "pcmpl-unix" "pcmpl-unix.el" (16213 43269))
+;;;;;;  "pcmpl-unix" "pcmpl-unix.el" (17087 12380))
 ;;; Generated autoloads from pcmpl-unix.el
 
 (autoload (quote pcomplete/cd) "pcmpl-unix" "\
@@ -18236,8 +18452,8 @@ Completion for the `chgrp' command.
 \f
 ;;;### (autoloads (pcomplete-shell-setup pcomplete-comint-setup pcomplete-list
 ;;;;;;  pcomplete-help pcomplete-expand pcomplete-continue pcomplete-expand-and-complete
-;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (16880
-;;;;;;  58563))
+;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (17087
+;;;;;;  12453))
 ;;; Generated autoloads from pcomplete.el
 
 (autoload (quote pcomplete) "pcomplete" "\
@@ -18296,7 +18512,7 @@ Setup shell-mode to use pcomplete.
 \f
 ;;;### (autoloads (cvs-dired-use-hook cvs-dired-action cvs-status
 ;;;;;;  cvs-update cvs-examine cvs-quickdir cvs-checkout) "pcvs"
-;;;;;;  "pcvs.el" (16953 20624))
+;;;;;;  "pcvs.el" (17087 12570))
 ;;; Generated autoloads from pcvs.el
 
 (autoload (quote cvs-checkout) "pcvs" "\
@@ -18306,7 +18522,7 @@ and run `cvs-mode' on it.
 
 With a prefix argument, prompt for cvs FLAGS to use.
 
-\(fn MODULES DIR FLAGS)" t nil)
+\(fn MODULES DIR FLAGS &optional ROOT)" t nil)
 
 (autoload (quote cvs-quickdir) "pcvs" "\
 Open a *cvs* buffer on DIR without running cvs.
@@ -18373,7 +18589,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (when (stringp d
 
 ;;;***
 \f
-;;;### (autoloads nil "pcvs-defs" "pcvs-defs.el" (16858 50918))
+;;;### (autoloads nil "pcvs-defs" "pcvs-defs.el" (17087 12578))
 ;;; Generated autoloads from pcvs-defs.el
 
 (defvar cvs-global-menu (let ((m (make-sparse-keymap "PCL-CVS"))) (define-key m [status] (quote (menu-item "Directory Status" cvs-status :help "A more verbose status of a workarea"))) (define-key m [checkout] (quote (menu-item "Checkout Module" cvs-checkout :help "Check out a module from the repository"))) (define-key m [update] (quote (menu-item "Update Directory" cvs-update :help "Fetch updates from the repository"))) (define-key m [examine] (quote (menu-item "Examine Directory" cvs-examine :help "Examine the current state of a workarea"))) (fset (quote cvs-global-menu) m)))
@@ -18381,7 +18597,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (when (stringp d
 ;;;***
 \f
 ;;;### (autoloads (perl-mode) "perl-mode" "progmodes/perl-mode.el"
-;;;;;;  (16958 58759))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from progmodes/perl-mode.el
 
 (autoload (quote perl-mode) "perl-mode" "\
@@ -18439,7 +18655,7 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'.
 ;;;### (autoloads (pgg-snarf-keys pgg-snarf-keys-region pgg-insert-key
 ;;;;;;  pgg-verify pgg-verify-region pgg-sign pgg-sign-region pgg-decrypt
 ;;;;;;  pgg-decrypt-region pgg-encrypt pgg-encrypt-region) "pgg"
-;;;;;;  "gnus/pgg.el" (16697 49031))
+;;;;;;  "gnus/pgg.el" (17087 12567))
 ;;; Generated autoloads from gnus/pgg.el
 
 (autoload (quote pgg-encrypt-region) "pgg" "\
@@ -18527,7 +18743,7 @@ Import public keys in the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (picture-mode) "picture" "textmodes/picture.el"
-;;;;;;  (16534 3822))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from textmodes/picture.el
 
 (autoload (quote picture-mode) "picture" "\
@@ -18599,7 +18815,7 @@ they are not defaultly assigned to keys.
 ;;;***
 \f
 ;;;### (autoloads (po-find-file-coding-system) "po" "textmodes/po.el"
-;;;;;;  (16213 43283))
+;;;;;;  (17087 12554))
 ;;; Generated autoloads from textmodes/po.el
 
 (autoload (quote po-find-file-coding-system) "po" "\
@@ -18610,7 +18826,7 @@ Called through `file-coding-system-alist', before the file is visited for real.
 
 ;;;***
 \f
-;;;### (autoloads (pong) "pong" "play/pong.el" (16213 43281))
+;;;### (autoloads (pong) "pong" "play/pong.el" (17087 12558))
 ;;; Generated autoloads from play/pong.el
 
 (autoload (quote pong) "pong" "\
@@ -18627,7 +18843,7 @@ pong-mode keybindings:\\<pong-mode-map>
 ;;;***
 \f
 ;;;### (autoloads (pp-eval-last-sexp pp-eval-expression pp pp-buffer
-;;;;;;  pp-to-string) "pp" "emacs-lisp/pp.el" (16609 26453))
+;;;;;;  pp-to-string) "pp" "emacs-lisp/pp.el" (17087 12391))
 ;;; Generated autoloads from emacs-lisp/pp.el
 
 (autoload (quote pp-to-string) "pp" "\
@@ -18685,7 +18901,7 @@ Ignores leading comment characters.
 ;;;;;;  pr-ps-buffer-print pr-ps-buffer-using-ghostscript pr-ps-buffer-preview
 ;;;;;;  pr-ps-directory-ps-print pr-ps-directory-print pr-ps-directory-using-ghostscript
 ;;;;;;  pr-ps-directory-preview pr-interface) "printing" "printing.el"
-;;;;;;  (16801 58022))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from printing.el
 
 (autoload (quote pr-interface) "printing" "\
@@ -19273,7 +19489,7 @@ are both set to t.
 ;;;***
 \f
 ;;;### (autoloads (run-prolog prolog-mode) "prolog" "progmodes/prolog.el"
-;;;;;;  (16814 63075))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from progmodes/prolog.el
 
 (autoload (quote prolog-mode) "prolog" "\
@@ -19293,7 +19509,7 @@ Run an inferior Prolog process, input and output via buffer *prolog*.
 
 ;;;***
 \f
-;;;### (autoloads nil "ps-bdf" "ps-bdf.el" (16213 43271))
+;;;### (autoloads nil "ps-bdf" "ps-bdf.el" (17087 12380))
 ;;; Generated autoloads from ps-bdf.el
 
 (defvar bdf-directory-list (if (memq system-type (quote (ms-dos windows-nt))) (list (expand-file-name "fonts/bdf" installation-directory)) (quote ("/usr/local/share/emacs/fonts/bdf"))) "\
@@ -19302,8 +19518,8 @@ The default value is '(\"/usr/local/share/emacs/fonts/bdf\").")
 
 ;;;***
 \f
-;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (16213
-;;;;;;  43282))
+;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (17087
+;;;;;;  12575))
 ;;; Generated autoloads from progmodes/ps-mode.el
 
 (autoload (quote ps-mode) "ps-mode" "\
@@ -19352,7 +19568,7 @@ Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number
 ;;;### (autoloads (ps-mule-begin-page ps-mule-begin-job ps-mule-encode-header-string
 ;;;;;;  ps-mule-initialize ps-mule-plot-composition ps-mule-plot-string
 ;;;;;;  ps-mule-set-ascii-font ps-mule-prepare-ascii-font ps-multibyte-buffer)
-;;;;;;  "ps-mule" "ps-mule.el" (16923 3608))
+;;;;;;  "ps-mule" "ps-mule.el" (17087 12528))
 ;;; Generated autoloads from ps-mule.el
 
 (defvar ps-multibyte-buffer nil "\
@@ -19473,8 +19689,8 @@ Not documented
 ;;;;;;  ps-spool-region ps-spool-buffer-with-faces ps-spool-buffer
 ;;;;;;  ps-print-region-with-faces ps-print-region ps-print-buffer-with-faces
 ;;;;;;  ps-print-buffer ps-print-customize ps-print-color-p ps-paper-type
-;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (16958
-;;;;;;  58756))
+;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (17087
+;;;;;;  12582))
 ;;; Generated autoloads from ps-print.el
 
 (defvar ps-page-dimensions-database (list (list (quote a4) (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54) "A4") (list (quote a3) (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54) "A3") (list (quote letter) (* 72 8.5) (* 72 11.0) "Letter") (list (quote legal) (* 72 8.5) (* 72 14.0) "Legal") (list (quote letter-small) (* 72 7.68) (* 72 10.16) "LetterSmall") (list (quote tabloid) (* 72 11.0) (* 72 17.0) "Tabloid") (list (quote ledger) (* 72 17.0) (* 72 11.0) "Ledger") (list (quote statement) (* 72 5.5) (* 72 8.5) "Statement") (list (quote executive) (* 72 7.5) (* 72 10.0) "Executive") (list (quote a4small) (* 72 7.47) (* 72 10.85) "A4Small") (list (quote b4) (* 72 10.125) (* 72 14.33) "B4") (list (quote b5) (* 72 7.16) (* 72 10.125) "B5")) "\
@@ -19671,7 +19887,7 @@ If EXTENSION is any other symbol, it is ignored.
 ;;;***
 \f
 ;;;### (autoloads (jython-mode python-mode run-python) "python" "progmodes/python.el"
-;;;;;;  (16908 33362))
+;;;;;;  (17087 12542))
 ;;; Generated autoloads from progmodes/python.el
 
 (add-to-list (quote interpreter-mode-alist) (quote ("jython" . jython-mode)))
@@ -19735,7 +19951,7 @@ Runs `jython-mode-hook' after `python-mode-hook'.
 ;;;***
 \f
 ;;;### (autoloads (quoted-printable-decode-region) "qp" "gnus/qp.el"
-;;;;;;  (16698 21929))
+;;;;;;  (17087 12567))
 ;;; Generated autoloads from gnus/qp.el
 
 (autoload (quote quoted-printable-decode-region) "qp" "\
@@ -19758,7 +19974,7 @@ them into characters should be done separately.
 ;;;;;;  quail-defrule quail-install-decode-map quail-install-map
 ;;;;;;  quail-define-rules quail-show-keyboard-layout quail-set-keyboard-layout
 ;;;;;;  quail-define-package quail-use-package quail-title) "quail"
-;;;;;;  "international/quail.el" (16954 46150))
+;;;;;;  "international/quail.el" (17087 12558))
 ;;; Generated autoloads from international/quail.el
 
 (autoload (quote quail-title) "quail" "\
@@ -19989,8 +20205,8 @@ of each directory.
 \f
 ;;;### (autoloads (quickurl-list quickurl-list-mode quickurl-edit-urls
 ;;;;;;  quickurl-browse-url-ask quickurl-browse-url quickurl-add-url
-;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (16543
-;;;;;;  16567))
+;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from net/quickurl.el
 
 (defconst quickurl-reread-hook-postfix "\n;; Local Variables:\n;; eval: (progn (require 'quickurl) (add-hook 'local-write-file-hooks (lambda () (quickurl-read) nil)))\n;; End:\n" "\
@@ -20061,8 +20277,8 @@ Display `quickurl-list' as a formatted list using `quickurl-list-mode'.
 
 ;;;***
 \f
-;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (16213
-;;;;;;  43280))
+;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from net/rcompile.el
 
 (autoload (quote remote-compile) "rcompile" "\
@@ -20074,7 +20290,7 @@ See \\[compile].
 ;;;***
 \f
 ;;;### (autoloads (re-builder regexp-builder) "re-builder" "emacs-lisp/re-builder.el"
-;;;;;;  (16930 25649))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from emacs-lisp/re-builder.el
 
 (autoload (quote regexp-builder) "re-builder" "\
@@ -20089,7 +20305,7 @@ Construct a regexp interactively.
 
 ;;;***
 \f
-;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (16958 58756))
+;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (17087 12570))
 ;;; Generated autoloads from recentf.el
 
 (defvar recentf-mode nil "\
@@ -20115,8 +20331,8 @@ that were operated on recently.
 ;;;### (autoloads (clear-rectangle string-insert-rectangle string-rectangle
 ;;;;;;  delete-whitespace-rectangle open-rectangle insert-rectangle
 ;;;;;;  yank-rectangle kill-rectangle extract-rectangle delete-extract-rectangle
-;;;;;;  delete-rectangle move-to-column-force) "rect" "rect.el" (16894
-;;;;;;  3339))
+;;;;;;  delete-rectangle move-to-column-force) "rect" "rect.el" (17087
+;;;;;;  12453))
 ;;; Generated autoloads from rect.el
 
 (autoload (quote move-to-column-force) "rect" "\
@@ -20238,8 +20454,8 @@ rectangle which were empty.
 
 ;;;***
 \f
-;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (16884
-;;;;;;  52115))
+;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (17087
+;;;;;;  12529))
 ;;; Generated autoloads from textmodes/refill.el
 
 (autoload (quote refill-mode) "refill" "\
@@ -20255,7 +20471,7 @@ refilling if they would cause auto-filling.
 ;;;***
 \f
 ;;;### (autoloads (reftex-reset-scanning-information reftex-mode
-;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (16896 54112))
+;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (17087 12570))
 ;;; Generated autoloads from textmodes/reftex.el
 
 (autoload (quote turn-on-reftex) "reftex" "\
@@ -20305,7 +20521,7 @@ This enforces rescanning the buffer on next use.
 ;;;***
 \f
 ;;;### (autoloads (reftex-citation) "reftex-cite" "textmodes/reftex-cite.el"
-;;;;;;  (16913 6364))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from textmodes/reftex-cite.el
 
 (autoload (quote reftex-citation) "reftex-cite" "\
@@ -20335,11 +20551,9 @@ While entering the regexp, completion on knows citation keys is possible.
 ;;;***
 \f
 ;;;### (autoloads (reftex-isearch-minor-mode) "reftex-global" "textmodes/reftex-global.el"
-;;;;;;  (16887 27629))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from textmodes/reftex-global.el
 
-(defvar reftex-isearch-minor-mode nil)
-
 (autoload (quote reftex-isearch-minor-mode) "reftex-global" "\
 When on, isearch searches the whole document, not only the current file.
 This minor mode allows isearch to search through all the files of
@@ -20354,7 +20568,7 @@ With no argument, this command toggles
 ;;;***
 \f
 ;;;### (autoloads (reftex-index-phrases-mode) "reftex-index" "textmodes/reftex-index.el"
-;;;;;;  (16875 35929))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from textmodes/reftex-index.el
 
 (autoload (quote reftex-index-phrases-mode) "reftex-index" "\
@@ -20387,7 +20601,7 @@ Here are all local bindings.
 ;;;***
 \f
 ;;;### (autoloads (reftex-all-document-files) "reftex-parse" "textmodes/reftex-parse.el"
-;;;;;;  (16875 35929))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from textmodes/reftex-parse.el
 
 (autoload (quote reftex-all-document-files) "reftex-parse" "\
@@ -20400,7 +20614,7 @@ of master file.
 ;;;***
 \f
 ;;;### (autoloads (regexp-opt-depth regexp-opt) "regexp-opt" "emacs-lisp/regexp-opt.el"
-;;;;;;  (16821 35887))
+;;;;;;  (17087 12574))
 ;;; Generated autoloads from emacs-lisp/regexp-opt.el
 
 (autoload (quote regexp-opt) "regexp-opt" "\
@@ -20421,13 +20635,13 @@ by \\=\\< and \\>.
 (autoload (quote regexp-opt-depth) "regexp-opt" "\
 Return the depth of REGEXP.
 This means the number of non-shy regexp grouping constructs
-\(parenthesised expressions) in REGEXP.
+\(parenthesized expressions) in REGEXP.
 
 \(fn REGEXP)" nil nil)
 
 ;;;***
 \f
-;;;### (autoloads (repeat) "repeat" "repeat.el" (16213 43271))
+;;;### (autoloads (repeat) "repeat" "repeat.el" (17087 12533))
 ;;; Generated autoloads from repeat.el
 
 (autoload (quote repeat) "repeat" "\
@@ -20445,7 +20659,7 @@ can be modified by the global variable `repeat-on-final-keystroke'.
 ;;;***
 \f
 ;;;### (autoloads (reporter-submit-bug-report) "reporter" "mail/reporter.el"
-;;;;;;  (16213 43280))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from mail/reporter.el
 
 (autoload (quote reporter-submit-bug-report) "reporter" "\
@@ -20477,7 +20691,7 @@ mail-sending package is used for editing and sending the message.
 ;;;***
 \f
 ;;;### (autoloads (reposition-window) "reposition" "reposition.el"
-;;;;;;  (16213 43271))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from reposition.el
 
 (autoload (quote reposition-window) "reposition" "\
@@ -20504,8 +20718,8 @@ first comment line visible (if point is in a comment).
 
 ;;;***
 \f
-;;;### (autoloads (resume-suspend-hook) "resume" "resume.el" (16213
-;;;;;;  43271))
+;;;### (autoloads (resume-suspend-hook) "resume" "resume.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from resume.el
 
 (autoload (quote resume-suspend-hook) "resume" "\
@@ -20516,7 +20730,7 @@ Clear out the file used for transmitting args when Emacs resumes.
 ;;;***
 \f
 ;;;### (autoloads (global-reveal-mode reveal-mode) "reveal" "reveal.el"
-;;;;;;  (16942 52930))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from reveal.el
 
 (autoload (quote reveal-mode) "reveal" "\
@@ -20551,7 +20765,7 @@ With zero or negative ARG turn mode off.
 \f
 ;;;### (autoloads (file-name-shadow-mode file-name-shadow-tty-properties
 ;;;;;;  file-name-shadow-properties) "rfn-eshadow" "rfn-eshadow.el"
-;;;;;;  (16213 43271))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from rfn-eshadow.el
 
 (defvar file-name-shadow-properties (quote (face file-name-shadow field shadow)) "\
@@ -20594,7 +20808,7 @@ Returns non-nil if the new state is enabled.
 ;;;***
 \f
 ;;;### (autoloads (make-ring ring-p) "ring" "emacs-lisp/ring.el"
-;;;;;;  (16213 43273))
+;;;;;;  (17087 12581))
 ;;; Generated autoloads from emacs-lisp/ring.el
 
 (autoload (quote ring-p) "ring" "\
@@ -20609,7 +20823,7 @@ Make a ring that can contain SIZE elements.
 
 ;;;***
 \f
-;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (16507 41097))
+;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (17087 12564))
 ;;; Generated autoloads from net/rlogin.el
  (add-hook 'same-window-regexps "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)")
 
@@ -20660,8 +20874,8 @@ variable.
 ;;;;;;  rmail-mail-new-frame rmail-primary-inbox-list rmail-delete-after-output
 ;;;;;;  rmail-highlight-face rmail-highlighted-headers rmail-retry-ignored-headers
 ;;;;;;  rmail-displayed-headers rmail-ignored-headers rmail-dont-reply-to-names
-;;;;;;  rmail-movemail-variant-p) "rmail" "mail/rmail.el" (16954
-;;;;;;  46150))
+;;;;;;  rmail-movemail-variant-p) "rmail" "mail/rmail.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from mail/rmail.el
 
 (autoload (quote rmail-movemail-variant-p) "rmail" "\
@@ -20684,7 +20898,7 @@ variable `rmail-dont-reply-to-names', for when the user does not set
 value is the user's email address and name.)
 It is useful to set this variable in the site customization file.")
 
-(defvar rmail-ignored-headers (concat "^via:\\|^mail-from:\\|^origin:\\|^references:" "\\|^status:\\|^received:\\|^x400-originator:\\|^x400-recipients:" "\\|^x400-received:\\|^x400-mts-identifier:\\|^x400-content-type:" "\\|^\\(resent-\\|\\)message-id:\\|^summary-line:\\|^resent-date:" "\\|^nntp-posting-host:\\|^path:\\|^x-char.*:\\|^x-face:\\|^face:" "\\|^x-mailer:\\|^delivered-to:\\|^lines:\\|^mime-version:" "\\|^content-transfer-encoding:\\|^x-coding-system:" "\\|^return-path:\\|^errors-to:\\|^return-receipt-to:" "\\|^x-sign:\\|^x-beenthere:\\|^x-mailman-version:" "\\|^precedence:\\|^list-help:\\|^list-post:\\|^list-subscribe:" "\\|^list-id:\\|^list-unsubscribe:\\|^list-archive:" "\\|^content-type:\\|^content-length:" "\\|^x-attribution:\\|^x-disclaimer:\\|^x-trace:" "\\|^x-complaints-to:\\|^nntp-posting-date:\\|^user-agent" "\\|^importance:\\|^envelope-to:\\|^delivery-date" "\\|^x.*-priority:\\|^x-mimeole:") "\
+(defvar rmail-ignored-headers (concat "^via:\\|^mail-from:\\|^origin:\\|^references:\\|^sender:" "\\|^status:\\|^received:\\|^x400-originator:\\|^x400-recipients:" "\\|^x400-received:\\|^x400-mts-identifier:\\|^x400-content-type:" "\\|^\\(resent-\\|\\)message-id:\\|^summary-line:\\|^resent-date:" "\\|^nntp-posting-host:\\|^path:\\|^x-char.*:\\|^x-face:\\|^face:" "\\|^x-mailer:\\|^delivered-to:\\|^lines:\\|^mime-version:" "\\|^content-transfer-encoding:\\|^x-coding-system:" "\\|^return-path:\\|^errors-to:\\|^return-receipt-to:" "\\|^x-sign:\\|^x-beenthere:\\|^x-mailman-version:\\|^x-mailman-copy:" "\\|^precedence:\\|^list-help:\\|^list-post:\\|^list-subscribe:" "\\|^list-id:\\|^list-unsubscribe:\\|^list-archive:" "\\|^content-type:\\|^content-length:" "\\|^x-attribution:\\|^x-disclaimer:\\|^x-trace:" "\\|^x-complaints-to:\\|^nntp-posting-date:\\|^user-agent" "\\|^importance:\\|^envelope-to:\\|^delivery-date" "\\|^x.*-priority:\\|^x-mimeole:\\|^x-archive:" "\\|^resent-face:\\|^resent-x.*:\\|^resent-organization\\|^resent-openpgp" "\\|^openpgp:\\|^x-request-pgp:\\|^x-original.*:" "\\|^x-virus-scanned:\\|^x-spam-[^s].*:") "\
 *Regexp to match header fields that Rmail should normally hide.
 This variable is used for reformatting the message header,
 which normally happens once for each message,
@@ -20922,7 +21136,7 @@ Restore an rmail buffer specified in a desktop file.
 ;;;***
 \f
 ;;;### (autoloads (rmail-edit-current-message) "rmailedit" "mail/rmailedit.el"
-;;;;;;  (16213 43280))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from mail/rmailedit.el
 
 (autoload (quote rmail-edit-current-message) "rmailedit" "\
@@ -20934,7 +21148,7 @@ Edit the contents of this message.
 \f
 ;;;### (autoloads (rmail-next-labeled-message rmail-previous-labeled-message
 ;;;;;;  rmail-read-label rmail-kill-label rmail-add-label) "rmailkwd"
-;;;;;;  "mail/rmailkwd.el" (16213 43280))
+;;;;;;  "mail/rmailkwd.el" (17087 12380))
 ;;; Generated autoloads from mail/rmailkwd.el
 
 (autoload (quote rmail-add-label) "rmailkwd" "\
@@ -20973,7 +21187,7 @@ With prefix argument N moves forward N messages with these labels.
 ;;;***
 \f
 ;;;### (autoloads (set-rmail-inbox-list) "rmailmsc" "mail/rmailmsc.el"
-;;;;;;  (16213 43280))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from mail/rmailmsc.el
 
 (autoload (quote set-rmail-inbox-list) "rmailmsc" "\
@@ -20987,7 +21201,7 @@ If FILE-NAME is empty, remove any existing inbox list.
 \f
 ;;;### (autoloads (rmail-output-body-to-file rmail-output rmail-fields-not-to-output
 ;;;;;;  rmail-output-to-rmail-file rmail-output-file-alist) "rmailout"
-;;;;;;  "mail/rmailout.el" (16213 43280))
+;;;;;;  "mail/rmailout.el" (17087 12380))
 ;;; Generated autoloads from mail/rmailout.el
 
 (defvar rmail-output-file-alist nil "\
@@ -21054,8 +21268,8 @@ FILE-NAME defaults, interactively, from the Subject field of the message.
 \f
 ;;;### (autoloads (rmail-sort-by-labels rmail-sort-by-lines rmail-sort-by-correspondent
 ;;;;;;  rmail-sort-by-recipient rmail-sort-by-author rmail-sort-by-subject
-;;;;;;  rmail-sort-by-date) "rmailsort" "mail/rmailsort.el" (16213
-;;;;;;  43280))
+;;;;;;  rmail-sort-by-date) "rmailsort" "mail/rmailsort.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from mail/rmailsort.el
 
 (autoload (quote rmail-sort-by-date) "rmailsort" "\
@@ -21107,7 +21321,7 @@ KEYWORDS is a comma-separated list of labels.
 ;;;;;;  rmail-summary-by-senders rmail-summary-by-topic rmail-summary-by-regexp
 ;;;;;;  rmail-summary-by-recipients rmail-summary-by-labels rmail-summary
 ;;;;;;  rmail-summary-line-count-flag rmail-summary-scroll-between-messages)
-;;;;;;  "rmailsum" "mail/rmailsum.el" (16294 21153))
+;;;;;;  "rmailsum" "mail/rmailsum.el" (17087 12566))
 ;;; Generated autoloads from mail/rmailsum.el
 
 (defvar rmail-summary-scroll-between-messages t "\
@@ -21189,7 +21403,7 @@ Setting this variable has an effect only before reading a mail.")
 ;;;***
 \f
 ;;;### (autoloads (news-post-news) "rnewspost" "obsolete/rnewspost.el"
-;;;;;;  (16213 43281))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from obsolete/rnewspost.el
 
 (autoload (quote news-post-news) "rnewspost" "\
@@ -21202,7 +21416,7 @@ If NOQUERY is non-nil, we do not query before doing the work.
 ;;;***
 \f
 ;;;### (autoloads (toggle-rot13-mode rot13-other-window rot13-region
-;;;;;;  rot13-string rot13) "rot13" "rot13.el" (16213 43271))
+;;;;;;  rot13-string rot13) "rot13" "rot13.el" (17087 12380))
 ;;; Generated autoloads from rot13.el
 
 (autoload (quote rot13) "rot13" "\
@@ -21243,7 +21457,7 @@ Toggle the use of rot 13 encoding for the current window.
 ;;;;;;  resize-minibuffer-frame-max-height resize-minibuffer-frame
 ;;;;;;  resize-minibuffer-window-exactly resize-minibuffer-window-max-height
 ;;;;;;  resize-minibuffer-mode) "rsz-mini" "obsolete/rsz-mini.el"
-;;;;;;  (16507 41097))
+;;;;;;  (17087 12564))
 ;;; Generated autoloads from obsolete/rsz-mini.el
 
 (defvar resize-minibuffer-mode nil "\
@@ -21283,8 +21497,8 @@ This function is obsolete.
 
 ;;;***
 \f
-;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (16908
-;;;;;;  33360))
+;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from ruler-mode.el
 
 (autoload (quote ruler-mode) "ruler-mode" "\
@@ -21294,8 +21508,8 @@ Display a ruler in the header line if ARG > 0.
 
 ;;;***
 \f
-;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (16534
-;;;;;;  3808))
+;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (17087
+;;;;;;  12524))
 ;;; Generated autoloads from emacs-lisp/rx.el
 
 (autoload (quote rx-to-string) "rx" "\
@@ -21603,7 +21817,7 @@ enclosed in `(and ...)'.
 ;;;***
 \f
 ;;;### (autoloads (dsssl-mode scheme-mode) "scheme" "progmodes/scheme.el"
-;;;;;;  (16923 3630))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from progmodes/scheme.el
 
 (autoload (quote scheme-mode) "scheme" "\
@@ -21645,7 +21859,7 @@ that variable's value is a string.
 ;;;***
 \f
 ;;;### (autoloads (gnus-score-mode) "score-mode" "gnus/score-mode.el"
-;;;;;;  (16698 21929))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from gnus/score-mode.el
 
 (autoload (quote gnus-score-mode) "score-mode" "\
@@ -21658,8 +21872,8 @@ This mode is an extended emacs-lisp mode.
 
 ;;;***
 \f
-;;;### (autoloads (scribe-mode) "scribe" "obsolete/scribe.el" (16213
-;;;;;;  43281))
+;;;### (autoloads (scribe-mode) "scribe" "obsolete/scribe.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from obsolete/scribe.el
 
 (autoload (quote scribe-mode) "scribe" "\
@@ -21684,7 +21898,7 @@ Interesting variables:
 ;;;***
 \f
 ;;;### (autoloads (scroll-all-mode) "scroll-all" "scroll-all.el"
-;;;;;;  (16213 43271))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from scroll-all.el
 
 (defvar scroll-all-mode nil "\
@@ -21711,7 +21925,7 @@ apply to all visible windows in the same frame.
 ;;;;;;  mail-archive-file-name mail-header-separator send-mail-function
 ;;;;;;  mail-yank-ignored-headers mail-interactive mail-self-blind
 ;;;;;;  mail-specify-envelope-from mail-from-style) "sendmail" "mail/sendmail.el"
-;;;;;;  (16954 46150))
+;;;;;;  (17087 12582))
 ;;; Generated autoloads from mail/sendmail.el
 
 (defvar mail-from-style (quote angles) "\
@@ -21941,18 +22155,32 @@ Like `mail' command, but display mail buffer in another frame.
 
 ;;;***
 \f
-;;;### (autoloads (server-mode server-start) "server" "server.el"
-;;;;;;  (16908 33360))
+;;;### (autoloads (server-mode server-start server-getenv) "server"
+;;;;;;  "server.el" (17087 12564))
 ;;; Generated autoloads from server.el
 
+(autoload (quote server-getenv) "server" "\
+Get the value of VARIABLE in the client environment of frame FRAME.
+VARIABLE should be a string.  Value is nil if VARIABLE is undefined in
+the environment.  Otherwise, value is a string.
+
+If FRAME is an emacsclient frame, then the variable is looked up
+in the environment of the emacsclient process; otherwise the
+function consults the environment of the Emacs process.
+
+If FRAME is nil or missing, then the selected frame is used.
+
+\(fn VARIABLE &optional FRAME)" nil nil)
+
 (autoload (quote server-start) "server" "\
 Allow this Emacs process to be a server for client processes.
 This starts a server communications subprocess through which
-client \"editors\" can send your editing commands to this Emacs job.
-To use the server, set up the program `emacsclient' in the
+client \"editors\" can send your editing commands to this Emacs
+job.  To use the server, set up the program `emacsclient' in the
 Emacs distribution as your standard \"editor\".
 
-Prefix arg means just kill any existing server communications subprocess.
+Prefix arg LEAVE-DEAD means just kill any existing server
+communications subprocess.
 
 \(fn &optional LEAVE-DEAD)" t nil)
 
@@ -21974,7 +22202,7 @@ Server mode runs a process that accepts commands from the
 
 ;;;***
 \f
-;;;### (autoloads (ses-mode) "ses" "ses.el" (16923 3608))
+;;;### (autoloads (ses-mode) "ses" "ses.el" (17087 12578))
 ;;; Generated autoloads from ses.el
 
 (autoload (quote ses-mode) "ses" "\
@@ -21993,7 +22221,7 @@ These are active only in the minibuffer, when entering or editing a formula:
 ;;;***
 \f
 ;;;### (autoloads (html-mode sgml-mode) "sgml-mode" "textmodes/sgml-mode.el"
-;;;;;;  (16942 52931))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from textmodes/sgml-mode.el
 
 (autoload (quote sgml-mode) "sgml-mode" "\
@@ -22039,7 +22267,7 @@ have <h1>Very Major Headlines</h1> through <h6>Very Minor Headlines</h6>
 
 <p>Paragraphs only need an opening tag.  Line breaks and multiple spaces are
 ignored unless the text is <pre>preformatted.</pre>  Text can be marked as
-<b>bold</b>, <i>italic</i> or <u>underlined</u> using the normal  M-g  or
+<b>bold</b>, <i>italic</i> or <u>underlined</u> using the normal M-o or
 Edit/Text Properties/Face commands.
 
 Pages can have <a name=\"SOMENAME\">named points</a> and can link other points
@@ -22061,7 +22289,7 @@ To work around that, do:
 ;;;***
 \f
 ;;;### (autoloads (sh-mode) "sh-script" "progmodes/sh-script.el"
-;;;;;;  (16878 27292))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from progmodes/sh-script.el
 
 (autoload (quote sh-mode) "sh-script" "\
@@ -22124,7 +22352,7 @@ with your script for an edit-interpret-debug cycle.
 
 ;;;***
 \f
-;;;### (autoloads (sha1) "sha1" "gnus/sha1.el" (16908 33361))
+;;;### (autoloads (sha1) "sha1" "gnus/sha1.el" (17087 12466))
 ;;; Generated autoloads from gnus/sha1.el
 
 (autoload (quote sha1) "sha1" "\
@@ -22139,7 +22367,7 @@ If BINARY is non-nil, return a string in binary form.
 ;;;***
 \f
 ;;;### (autoloads (list-load-path-shadows) "shadow" "emacs-lisp/shadow.el"
-;;;;;;  (16377 12872))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from emacs-lisp/shadow.el
 
 (autoload (quote list-load-path-shadows) "shadow" "\
@@ -22186,8 +22414,8 @@ buffer called `*Shadows*'.  Shadowings are located by calling the
 ;;;***
 \f
 ;;;### (autoloads (shadow-initialize shadow-define-regexp-group shadow-define-literal-group
-;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (16768
-;;;;;;  48631))
+;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (17087
+;;;;;;  12564))
 ;;; Generated autoloads from shadowfile.el
 
 (autoload (quote shadow-define-cluster) "shadowfile" "\
@@ -22226,7 +22454,7 @@ Set up file shadowing.
 ;;;***
 \f
 ;;;### (autoloads (shell shell-dumb-shell-regexp) "shell" "shell.el"
-;;;;;;  (16377 12872))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from shell.el
 
 (defvar shell-dumb-shell-regexp "cmd\\(proxy\\)?\\.exe" "\
@@ -22273,7 +22501,7 @@ Otherwise, one argument `-i' is passed to the shell.
 ;;;***
 \f
 ;;;### (autoloads (sieve-upload-and-bury sieve-upload sieve-manage)
-;;;;;;  "sieve" "gnus/sieve.el" (16908 33361))
+;;;;;;  "sieve" "gnus/sieve.el" (17087 12466))
 ;;; Generated autoloads from gnus/sieve.el
 
 (autoload (quote sieve-manage) "sieve" "\
@@ -22294,7 +22522,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (sieve-mode) "sieve-mode" "gnus/sieve-mode.el"
-;;;;;;  (16697 49031))
+;;;;;;  (17087 12574))
 ;;; Generated autoloads from gnus/sieve-mode.el
 
 (autoload (quote sieve-mode) "sieve-mode" "\
@@ -22309,8 +22537,8 @@ Turning on Sieve mode runs `sieve-mode-hook'.
 
 ;;;***
 \f
-;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (16858
-;;;;;;  50937))
+;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (17087
+;;;;;;  12451))
 ;;; Generated autoloads from progmodes/simula.el
 
 (autoload (quote simula-mode) "simula" "\
@@ -22359,7 +22587,7 @@ with no arguments, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (skeleton-pair-insert-maybe skeleton-insert skeleton-proxy-new
-;;;;;;  define-skeleton) "skeleton" "skeleton.el" (16213 43271))
+;;;;;;  define-skeleton) "skeleton" "skeleton.el" (17087 12570))
 ;;; Generated autoloads from skeleton.el
 
 (defvar skeleton-filter (quote identity) "\
@@ -22469,7 +22697,7 @@ symmetrical ones, and the same character twice for the others.
 ;;;***
 \f
 ;;;### (autoloads (smerge-mode smerge-ediff) "smerge-mode" "smerge-mode.el"
-;;;;;;  (16534 3808))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from smerge-mode.el
 
 (autoload (quote smerge-ediff) "smerge-mode" "\
@@ -22488,7 +22716,7 @@ Minor mode to simplify editing output from the diff3 program.
 ;;;***
 \f
 ;;;### (autoloads (smiley-buffer smiley-region) "smiley" "gnus/smiley.el"
-;;;;;;  (16912 31021))
+;;;;;;  (17087 12470))
 ;;; Generated autoloads from gnus/smiley.el
 
 (autoload (quote smiley-region) "smiley" "\
@@ -22506,7 +22734,7 @@ interactively. If there's no argument, do it at the current buffer
 ;;;***
 \f
 ;;;### (autoloads (smtpmail-send-queued-mail smtpmail-send-it) "smtpmail"
-;;;;;;  "mail/smtpmail.el" (16908 33362))
+;;;;;;  "mail/smtpmail.el" (17087 12566))
 ;;; Generated autoloads from mail/smtpmail.el
 
 (autoload (quote smtpmail-send-it) "smtpmail" "\
@@ -22521,7 +22749,7 @@ Send mail that was queued as a result of setting `smtpmail-queue-mail'.
 
 ;;;***
 \f
-;;;### (autoloads (snake) "snake" "play/snake.el" (16213 43281))
+;;;### (autoloads (snake) "snake" "play/snake.el" (17087 12566))
 ;;; Generated autoloads from play/snake.el
 
 (autoload (quote snake) "snake" "\
@@ -22545,7 +22773,7 @@ Snake mode keybindings:
 ;;;***
 \f
 ;;;### (autoloads (snmpv2-mode snmp-mode) "snmp-mode" "net/snmp-mode.el"
-;;;;;;  (16858 50931))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from net/snmp-mode.el
 
 (autoload (quote snmp-mode) "snmp-mode" "\
@@ -22576,7 +22804,7 @@ then `snmpv2-mode-hook'.
 \f
 ;;;### (autoloads (solar-equinoxes-solstices sunrise-sunset calendar-location-name
 ;;;;;;  calendar-longitude calendar-latitude calendar-time-display-form)
-;;;;;;  "solar" "calendar/solar.el" (16213 43272))
+;;;;;;  "solar" "calendar/solar.el" (17087 12564))
 ;;; Generated autoloads from calendar/solar.el
 
 (defvar calendar-time-display-form (quote (12-hours ":" minutes am-pm (if time-zone " (") time-zone (if time-zone ")"))) "\
@@ -22647,8 +22875,8 @@ Requires floating point.
 
 ;;;***
 \f
-;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (16213
-;;;;;;  43281))
+;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (17087
+;;;;;;  12566))
 ;;; Generated autoloads from play/solitaire.el
 
 (autoload (quote solitaire) "solitaire" "\
@@ -22725,7 +22953,7 @@ Pick your favourite shortcuts:
 \f
 ;;;### (autoloads (reverse-region sort-columns sort-regexp-fields
 ;;;;;;  sort-fields sort-numeric-fields sort-pages sort-paragraphs
-;;;;;;  sort-lines sort-subr) "sort" "sort.el" (16460 18645))
+;;;;;;  sort-lines sort-subr) "sort" "sort.el" (17087 12380))
 ;;; Generated autoloads from sort.el
 
 (autoload (quote sort-subr) "sort" "\
@@ -22867,8 +23095,8 @@ From a program takes two point or marker arguments, BEG and END.
 
 ;;;***
 \f
-;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (16908
-;;;;;;  33362))
+;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (17087
+;;;;;;  12574))
 ;;; Generated autoloads from gnus/spam.el
 
 (autoload (quote spam-initialize) "spam" "\
@@ -22876,10 +23104,54 @@ Install the spam.el hooks and do other initialization
 
 \(fn)" t nil)
 
+;;;***
+\f
+;;;### (autoloads (spam-report-deagentize spam-report-agentize spam-report-url-to-file
+;;;;;;  spam-report-url-ping-mm-url spam-report-process-queue) "spam-report"
+;;;;;;  "gnus/spam-report.el" (17087 12567))
+;;; Generated autoloads from gnus/spam-report.el
+
+(autoload (quote spam-report-process-queue) "spam-report" "\
+Report all queued requests from `spam-report-requests-file'.
+
+If FILE is given, use it instead of `spam-report-requests-file'.
+If KEEP is t, leave old requests in the file.  If KEEP is the
+symbol `ask', query before flushing the queue file.
+
+\(fn &optional FILE KEEP)" t nil)
+
+(autoload (quote spam-report-url-ping-mm-url) "spam-report" "\
+Ping a host through HTTP, addressing a specific GET resource. Use
+the external program specified in `mm-url-program' to connect to
+server.
+
+\(fn HOST REPORT)" nil nil)
+
+(autoload (quote spam-report-url-to-file) "spam-report" "\
+Collect spam report requests in `spam-report-requests-file'.
+Customize `spam-report-url-ping-function' to use this function.
+
+\(fn HOST REPORT)" nil nil)
+
+(autoload (quote spam-report-agentize) "spam-report" "\
+Add spam-report support to the Agent.
+Spam reports will be queued with \\[spam-report-url-to-file] when
+the Agent is unplugged, and will be submitted in a batch when the
+Agent is plugged.
+
+\(fn)" t nil)
+
+(autoload (quote spam-report-deagentize) "spam-report" "\
+Remove spam-report support from the Agent.
+Spam reports will be queued with the method used when
+\\[spam-report-agentize] was run.
+
+\(fn)" t nil)
+
 ;;;***
 \f
 ;;;### (autoloads (speedbar-get-focus speedbar-frame-mode) "speedbar"
-;;;;;;  "speedbar.el" (16931 6984))
+;;;;;;  "speedbar.el" (17087 12566))
 ;;; Generated autoloads from speedbar.el
 
 (defalias (quote speedbar) (quote speedbar-frame-mode))
@@ -22904,7 +23176,7 @@ selected.  If the speedbar frame is active, then select the attached frame.
 ;;;***
 \f
 ;;;### (autoloads (spell-string spell-region spell-word spell-buffer)
-;;;;;;  "spell" "textmodes/spell.el" (16213 43284))
+;;;;;;  "spell" "textmodes/spell.el" (17087 12564))
 ;;; Generated autoloads from textmodes/spell.el
 
 (put (quote spell-filter) (quote risky-local-variable) t)
@@ -22940,8 +23212,8 @@ Check spelling of string supplied as argument.
 
 ;;;***
 \f
-;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (16213
-;;;;;;  43281))
+;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from play/spook.el
 
 (autoload (quote spook) "spook" "\
@@ -22959,8 +23231,8 @@ Return a vector containing the lines from `spook-phrases-file'.
 ;;;### (autoloads (sql-linter sql-db2 sql-interbase sql-postgres
 ;;;;;;  sql-ms sql-ingres sql-solid sql-mysql sql-sqlite sql-informix
 ;;;;;;  sql-sybase sql-oracle sql-product-interactive sql-mode sql-help
-;;;;;;  sql-add-product-keywords) "sql" "progmodes/sql.el" (16908
-;;;;;;  33362))
+;;;;;;  sql-add-product-keywords) "sql" "progmodes/sql.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from progmodes/sql.el
 
 (autoload (quote sql-add-product-keywords) "sql" "\
@@ -23391,8 +23663,8 @@ input.  See `sql-interactive-mode'.
 ;;;;;;  strokes-mode strokes-list-strokes strokes-load-user-strokes
 ;;;;;;  strokes-help strokes-describe-stroke strokes-do-complex-stroke
 ;;;;;;  strokes-do-stroke strokes-read-complex-stroke strokes-read-stroke
-;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (16768
-;;;;;;  48632))
+;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from strokes.el
 
 (autoload (quote strokes-global-set-stroke) "strokes" "\
@@ -23501,7 +23773,7 @@ Read a complex stroke and insert its glyph into the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (studlify-buffer studlify-word studlify-region)
-;;;;;;  "studly" "play/studly.el" (16213 43281))
+;;;;;;  "studly" "play/studly.el" (17087 12380))
 ;;; Generated autoloads from play/studly.el
 
 (autoload (quote studlify-region) "studly" "\
@@ -23522,7 +23794,7 @@ Studlify-case the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (sc-cite-original) "supercite" "mail/supercite.el"
-;;;;;;  (16830 50349))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from mail/supercite.el
 
 (autoload (quote sc-cite-original) "supercite" "\
@@ -23554,8 +23826,8 @@ before, and `sc-post-hook' is run after the guts of this function.
 
 ;;;***
 \f
-;;;### (autoloads (syntax-ppss) "syntax" "emacs-lisp/syntax.el" (16213
-;;;;;;  43273))
+;;;### (autoloads (syntax-ppss) "syntax" "emacs-lisp/syntax.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from emacs-lisp/syntax.el
 
 (autoload (quote syntax-ppss) "syntax" "\
@@ -23568,7 +23840,7 @@ Point is at POS when this function returns.
 
 ;;;***
 \f
-;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (16213 43271))
+;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (17087 12380))
 ;;; Generated autoloads from tabify.el
 
 (autoload (quote untabify) "tabify" "\
@@ -23603,7 +23875,7 @@ The variable `tab-width' controls the spacing of tab stops.
 ;;;;;;  table-recognize table-insert-row-column table-insert-column
 ;;;;;;  table-insert-row table-insert table-point-left-cell-hook
 ;;;;;;  table-point-entered-cell-hook table-load-hook table-cell-map-hook)
-;;;;;;  "table" "textmodes/table.el" (16958 58759))
+;;;;;;  "table" "textmodes/table.el" (17087 12570))
 ;;; Generated autoloads from textmodes/table.el
 
 (defvar table-cell-map-hook nil "\
@@ -24191,7 +24463,7 @@ converts a table into plain text without frames.  It is a companion to
 
 ;;;***
 \f
-;;;### (autoloads (talk-connect) "talk" "talk.el" (16213 43271))
+;;;### (autoloads (talk talk-connect) "talk" "talk.el" (17087 12393))
 ;;; Generated autoloads from talk.el
 
 (autoload (quote talk-connect) "talk" "\
@@ -24199,9 +24471,14 @@ Connect to display DISPLAY for the Emacs talk group.
 
 \(fn DISPLAY)" t nil)
 
+(autoload (quote talk) "talk" "\
+Connect to the Emacs talk group from the current X display or tty frame.
+
+\(fn)" t nil)
+
 ;;;***
 \f
-;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (16954 46150))
+;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (17087 12509))
 ;;; Generated autoloads from tar-mode.el
 
 (autoload (quote tar-mode) "tar-mode" "\
@@ -24225,7 +24502,7 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
 ;;;***
 \f
 ;;;### (autoloads (tcl-help-on-word inferior-tcl tcl-mode) "tcl"
-;;;;;;  "progmodes/tcl.el" (16808 48570))
+;;;;;;  "progmodes/tcl.el" (17087 12564))
 ;;; Generated autoloads from progmodes/tcl.el
 
 (autoload (quote tcl-mode) "tcl" "\
@@ -24276,7 +24553,7 @@ Prefix argument means invert sense of `tcl-use-smart-word-finder'.
 
 ;;;***
 \f
-;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (16548 34615))
+;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (17087 12564))
 ;;; Generated autoloads from net/telnet.el
  (add-hook 'same-window-regexps "\\*telnet-.*\\*\\(\\|<[0-9]+>\\)")
 
@@ -24303,8 +24580,8 @@ Normally input is edited in Emacs and sent a line at a time.
 
 ;;;***
 \f
-;;;### (autoloads (ansi-term term make-term) "term" "term.el" (16829
-;;;;;;  43426))
+;;;### (autoloads (ansi-term term make-term) "term" "term.el" (17087
+;;;;;;  12575))
 ;;; Generated autoloads from term.el
 
 (autoload (quote make-term) "term" "\
@@ -24332,8 +24609,8 @@ Start a terminal-emulator in a new buffer.
 
 ;;;***
 \f
-;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (16698
-;;;;;;  21926))
+;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from terminal.el
 
 (autoload (quote terminal-emulator) "terminal" "\
@@ -24356,7 +24633,7 @@ This escape character may be changed using the variable `terminal-escape-char'.
 
 `Meta' characters may not currently be sent through the terminal emulator.
 
-Here is a list of some of the variables which control the behaviour
+Here is a list of some of the variables which control the behavior
 of the emulator -- see their documentation for more information:
 terminal-escape-char, terminal-scrolling, terminal-more-processing,
 terminal-redisplay-interval.
@@ -24370,7 +24647,7 @@ subprocess started.
 ;;;***
 \f
 ;;;### (autoloads (testcover-this-defun) "testcover" "emacs-lisp/testcover.el"
-;;;;;;  (16635 35907))
+;;;;;;  (17087 12569))
 ;;; Generated autoloads from emacs-lisp/testcover.el
 
 (autoload (quote testcover-this-defun) "testcover" "\
@@ -24380,7 +24657,7 @@ Start coverage on function under point.
 
 ;;;***
 \f
-;;;### (autoloads (tetris) "tetris" "play/tetris.el" (16213 43281))
+;;;### (autoloads (tetris) "tetris" "play/tetris.el" (17087 12566))
 ;;; Generated autoloads from play/tetris.el
 
 (autoload (quote tetris) "tetris" "\
@@ -24411,7 +24688,7 @@ tetris-mode keybindings:
 ;;;;;;  tex-start-commands tex-start-options slitex-run-command latex-run-command
 ;;;;;;  tex-run-command tex-offer-save tex-main-file tex-first-line-header-regexp
 ;;;;;;  tex-directory tex-shell-file-name) "tex-mode" "textmodes/tex-mode.el"
-;;;;;;  (16958 58759))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from textmodes/tex-mode.el
 
 (defvar tex-shell-file-name nil "\
@@ -24713,7 +24990,7 @@ Major mode to edit DocTeX files.
 ;;;***
 \f
 ;;;### (autoloads (texi2info texinfo-format-region texinfo-format-buffer)
-;;;;;;  "texinfmt" "textmodes/texinfmt.el" (16939 44105))
+;;;;;;  "texinfmt" "textmodes/texinfmt.el" (17087 12565))
 ;;; Generated autoloads from textmodes/texinfmt.el
 
 (autoload (quote texinfo-format-buffer) "texinfmt" "\
@@ -24753,7 +25030,7 @@ if large.  You can use Info-split to do this manually.
 ;;;***
 \f
 ;;;### (autoloads (texinfo-mode texinfo-close-quote texinfo-open-quote)
-;;;;;;  "texinfo" "textmodes/texinfo.el" (16858 50941))
+;;;;;;  "texinfo" "textmodes/texinfo.el" (17087 12570))
 ;;; Generated autoloads from textmodes/texinfo.el
 
 (defvar texinfo-open-quote "``" "\
@@ -24840,7 +25117,7 @@ value of `texinfo-mode-hook'.
 ;;;### (autoloads (thai-auto-composition-mode thai-composition-function
 ;;;;;;  thai-post-read-conversion thai-compose-buffer thai-compose-string
 ;;;;;;  thai-compose-region) "thai-util" "language/thai-util.el"
-;;;;;;  (16954 46150))
+;;;;;;  (17087 12528))
 ;;; Generated autoloads from language/thai-util.el
 
 (autoload (quote thai-compose-region) "thai-util" "\
@@ -24884,7 +25161,7 @@ Minor mode for automatically correct Thai character composition.
 \f
 ;;;### (autoloads (list-at-point number-at-point symbol-at-point
 ;;;;;;  sexp-at-point thing-at-point bounds-of-thing-at-point forward-thing)
-;;;;;;  "thingatpt" "thingatpt.el" (16213 43271))
+;;;;;;  "thingatpt" "thingatpt.el" (17087 12380))
 ;;; Generated autoloads from thingatpt.el
 
 (autoload (quote forward-thing) "thingatpt" "\
@@ -24941,7 +25218,7 @@ Not documented
 \f
 ;;;### (autoloads (thumbs-dired-setroot thumbs-dired-show-all thumbs-dired-show-marked
 ;;;;;;  thumbs-show-all-from-dir thumbs-find-thumb) "thumbs" "thumbs.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from thumbs.el
 
 (autoload (quote thumbs-find-thumb) "thumbs" "\
@@ -24957,7 +25234,7 @@ and SAME-WINDOW to show thumbs in the same window.
 \(fn DIR &optional REG SAME-WINDOW)" t nil)
 
 (autoload (quote thumbs-dired-show-marked) "thumbs" "\
-In Dired, make a thumbs buffer with all marked files.
+In dired, make a thumbs buffer with all marked files.
 
 \(fn)" t nil)
 
@@ -24969,7 +25246,7 @@ In dired, make a thumbs buffer with all files in current directory.
 (defalias (quote thumbs) (quote thumbs-show-all-from-dir))
 
 (autoload (quote thumbs-dired-setroot) "thumbs" "\
-In dired, Call the setroot program on the image at point.
+In dired, call the setroot program on the image at point.
 
 \(fn)" t nil)
 
@@ -24980,7 +25257,7 @@ In dired, Call the setroot program on the image at point.
 ;;;;;;  tibetan-composition-function tibetan-decompose-string tibetan-decompose-region
 ;;;;;;  tibetan-compose-region tibetan-compose-string tibetan-transcription-to-tibetan
 ;;;;;;  tibetan-tibetan-to-transcription tibetan-char-p) "tibet-util"
-;;;;;;  "language/tibet-util.el" (16213 43280))
+;;;;;;  "language/tibet-util.el" (17087 12562))
 ;;; Generated autoloads from language/tibet-util.el
 
 (autoload (quote tibetan-char-p) "tibet-util" "\
@@ -25059,7 +25336,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (tildify-buffer tildify-region) "tildify" "textmodes/tildify.el"
-;;;;;;  (16213 43284))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from textmodes/tildify.el
 
 (autoload (quote tildify-region) "tildify" "\
@@ -25083,7 +25360,7 @@ This function performs no refilling of the changed text.
 ;;;***
 \f
 ;;;### (autoloads (display-time-mode display-time display-time-day-and-date)
-;;;;;;  "time" "time.el" (16908 33361))
+;;;;;;  "time" "time.el" (17087 12570))
 ;;; Generated autoloads from time.el
 
 (defvar display-time-day-and-date nil "\
@@ -25124,8 +25401,8 @@ This runs the normal hook `display-time-hook' after each update.
 ;;;### (autoloads (safe-date-to-time time-to-days time-to-day-in-year
 ;;;;;;  date-leap-year-p days-between date-to-day time-add time-subtract
 ;;;;;;  time-since days-to-time time-less-p seconds-to-time time-to-seconds
-;;;;;;  date-to-time) "time-date" "calendar/time-date.el" (16698
-;;;;;;  21926))
+;;;;;;  date-to-time) "time-date" "calendar/time-date.el" (17087
+;;;;;;  12531))
 ;;; Generated autoloads from calendar/time-date.el
 
 (autoload (quote date-to-time) "time-date" "\
@@ -25211,7 +25488,7 @@ If DATE is malformed, return a time value of zeros.
 ;;;***
 \f
 ;;;### (autoloads (time-stamp-toggle-active time-stamp) "time-stamp"
-;;;;;;  "time-stamp.el" (16589 26258))
+;;;;;;  "time-stamp.el" (17087 12565))
 ;;; Generated autoloads from time-stamp.el
 
 (autoload (quote time-stamp) "time-stamp" "\
@@ -25246,7 +25523,7 @@ With ARG, turn time stamping on if and only if arg is positive.
 ;;;;;;  timeclock-workday-remaining-string timeclock-reread-log timeclock-query-out
 ;;;;;;  timeclock-change timeclock-status-string timeclock-out timeclock-in
 ;;;;;;  timeclock-modeline-display) "timeclock" "calendar/timeclock.el"
-;;;;;;  (16534 3808))
+;;;;;;  (17087 12530))
 ;;; Generated autoloads from calendar/timeclock.el
 
 (autoload (quote timeclock-modeline-display) "timeclock" "\
@@ -25347,7 +25624,7 @@ relative only to the time worked today, and not to past time.
 \f
 ;;;### (autoloads (with-timeout run-with-idle-timer add-timeout run-with-timer
 ;;;;;;  run-at-time cancel-function-timers cancel-timer) "timer"
-;;;;;;  "emacs-lisp/timer.el" (16908 33361))
+;;;;;;  "emacs-lisp/timer.el" (17087 12466))
 ;;; Generated autoloads from emacs-lisp/timer.el
 
 (defalias (quote disable-timeout) (quote cancel-timer))
@@ -25420,7 +25697,7 @@ be detected.
 ;;;***
 \f
 ;;;### (autoloads (batch-titdic-convert titdic-convert) "titdic-cnv"
-;;;;;;  "international/titdic-cnv.el" (16534 3808))
+;;;;;;  "international/titdic-cnv.el" (17087 12558))
 ;;; Generated autoloads from international/titdic-cnv.el
 
 (autoload (quote titdic-convert) "titdic-cnv" "\
@@ -25443,8 +25720,8 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\".
 ;;;***
 \f
 ;;;### (autoloads (tamil-composition-function tamil-post-read-conversion
-;;;;;;  tamil-compose-region) "tml-util" "language/tml-util.el" (16233
-;;;;;;  29568))
+;;;;;;  tamil-compose-region) "tml-util" "language/tml-util.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from language/tml-util.el
 
 (autoload (quote tamil-compose-region) "tml-util" "\
@@ -25459,7 +25736,7 @@ Not documented
 
 (autoload (quote tamil-composition-function) "tml-util" "\
 Compose Tamil characters in REGION, or STRING if specified.
-Assume that the REGION or STRING must fully match the composable
+Assume that the REGION or STRING must fully match the composable 
 PATTERN regexp.
 
 \(fn FROM TO PATTERN &optional STRING)" nil nil)
@@ -25467,7 +25744,7 @@ PATTERN regexp.
 ;;;***
 \f
 ;;;### (autoloads (tmm-prompt tmm-menubar-mouse tmm-menubar) "tmm"
-;;;;;;  "tmm.el" (16213 43271))
+;;;;;;  "tmm.el" (17087 12570))
 ;;; Generated autoloads from tmm.el
  (define-key global-map "\M-`" 'tmm-menubar)
  (define-key global-map [f10] 'tmm-menubar)
@@ -25508,7 +25785,7 @@ Its value should be an event that has a binding in MENU.
 \f
 ;;;### (autoloads (todo-show todo-cp todo-mode todo-print todo-top-priorities
 ;;;;;;  todo-insert-item todo-add-item-non-interactively todo-add-category)
-;;;;;;  "todo-mode" "calendar/todo-mode.el" (16507 41097))
+;;;;;;  "todo-mode" "calendar/todo-mode.el" (17087 12569))
 ;;; Generated autoloads from calendar/todo-mode.el
 
 (autoload (quote todo-add-category) "todo-mode" "\
@@ -25569,7 +25846,7 @@ Show TODO list.
 \f
 ;;;### (autoloads (tool-bar-local-item-from-menu tool-bar-add-item-from-menu
 ;;;;;;  tool-bar-local-item tool-bar-add-item tool-bar-mode) "tool-bar"
-;;;;;;  "toolbar/tool-bar.el" (16775 26718))
+;;;;;;  "toolbar/tool-bar.el" (17087 12565))
 ;;; Generated autoloads from toolbar/tool-bar.el
 
 (defvar tool-bar-mode nil "\
@@ -25651,10 +25928,10 @@ MAP must contain appropriate binding for `[menu-bar]' which holds a keymap.
 
 ;;;***
 \f
-;;;### (autoloads (tooltip-mode) "tooltip" "tooltip.el" (16960 18194))
+;;;### (autoloads (tooltip-mode) "tooltip" "tooltip.el" (17087 12575))
 ;;; Generated autoloads from tooltip.el
 
-(defvar tooltip-mode nil "\
+(defvar tooltip-mode (not (or noninteractive (and (boundp (quote emacs-quick-startup)) emacs-quick-startup) (not (and (fboundp (quote display-graphic-p)) (display-graphic-p))) (not (fboundp (quote x-show-tip))))) "\
 Non-nil if Tooltip mode is enabled.
 See the command `tooltip-mode' for a description of this minor-mode.
 Setting this variable directly does not take effect;
@@ -25670,8 +25947,8 @@ With ARG, turn tooltip mode on if and only if ARG is positive.
 
 ;;;***
 \f
-;;;### (autoloads (tpu-edt-on) "tpu-edt" "emulation/tpu-edt.el" (16812
-;;;;;;  26772))
+;;;### (autoloads (tpu-edt-on) "tpu-edt" "emulation/tpu-edt.el" (17087
+;;;;;;  12564))
 ;;; Generated autoloads from emulation/tpu-edt.el
 
 (defalias (quote tpu-edt-mode) (quote tpu-edt-on))
@@ -25686,7 +25963,7 @@ Turn on TPU/edt emulation.
 ;;;***
 \f
 ;;;### (autoloads (tpu-set-cursor-bound tpu-set-cursor-free tpu-set-scroll-margins)
-;;;;;;  "tpu-extras" "emulation/tpu-extras.el" (16213 43273))
+;;;;;;  "tpu-extras" "emulation/tpu-extras.el" (17087 12566))
 ;;; Generated autoloads from emulation/tpu-extras.el
 
 (autoload (quote tpu-set-scroll-margins) "tpu-extras" "\
@@ -25706,7 +25983,7 @@ Constrain the cursor to the flow of the text.
 
 ;;;***
 \f
-;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (16227 13384))
+;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (17087 12380))
 ;;; Generated autoloads from emacs-lisp/tq.el
 
 (autoload (quote tq-create) "tq" "\
@@ -25720,7 +25997,7 @@ to a tcp server on another machine.
 ;;;***
 \f
 ;;;### (autoloads (trace-function-background trace-function trace-buffer)
-;;;;;;  "trace" "emacs-lisp/trace.el" (16930 25650))
+;;;;;;  "trace" "emacs-lisp/trace.el" (17087 12477))
 ;;; Generated autoloads from emacs-lisp/trace.el
 
 (defvar trace-buffer "*trace-output*" "\
@@ -25753,7 +26030,7 @@ the window or buffer configuration at all.
 \f
 ;;;### (autoloads (tramp-completion-file-name-handler tramp-file-name-handler
 ;;;;;;  tramp-completion-file-name-regexp tramp-file-name-regexp)
-;;;;;;  "tramp" "net/tramp.el" (16958 58758))
+;;;;;;  "tramp" "net/tramp.el" (17087 12575))
 ;;; Generated autoloads from net/tramp.el
 
 (defvar tramp-unified-filenames (not (featurep (quote xemacs))) "\
@@ -25830,7 +26107,7 @@ Falls back to normal file name handler if no tramp file name handler exists.
 ;;;***
 \f
 ;;;### (autoloads (2C-split 2C-associate-buffer 2C-two-columns) "two-column"
-;;;;;;  "textmodes/two-column.el" (16213 43285))
+;;;;;;  "textmodes/two-column.el" (17087 12380))
 ;;; Generated autoloads from textmodes/two-column.el
  (autoload '2C-command "two-column" () t 'keymap)
  (global-set-key "\C-x6" '2C-command)
@@ -25881,7 +26158,7 @@ First column's text    sSs  Second column's text
 ;;;;;;  type-break type-break-mode type-break-keystroke-threshold
 ;;;;;;  type-break-good-break-interval type-break-good-rest-interval
 ;;;;;;  type-break-interval type-break-mode) "type-break" "type-break.el"
-;;;;;;  (16884 52115))
+;;;;;;  (17087 12453))
 ;;; Generated autoloads from type-break.el
 
 (defvar type-break-mode nil "\
@@ -26064,7 +26341,7 @@ FRAC should be the inverse of the fractional value; for example, a value of
 ;;;***
 \f
 ;;;### (autoloads (ununderline-region underline-region) "underline"
-;;;;;;  "textmodes/underline.el" (16213 43286))
+;;;;;;  "textmodes/underline.el" (17087 12380))
 ;;; Generated autoloads from textmodes/underline.el
 
 (autoload (quote underline-region) "underline" "\
@@ -26085,7 +26362,7 @@ which specify the range to operate on.
 ;;;***
 \f
 ;;;### (autoloads (unforward-rmail-message undigestify-rmail-message)
-;;;;;;  "undigest" "mail/undigest.el" (16213 43280))
+;;;;;;  "undigest" "mail/undigest.el" (17087 12570))
 ;;; Generated autoloads from mail/undigest.el
 
 (autoload (quote undigestify-rmail-message) "undigest" "\
@@ -26104,7 +26381,7 @@ following the containing message.
 ;;;***
 \f
 ;;;### (autoloads (unrmail batch-unrmail) "unrmail" "mail/unrmail.el"
-;;;;;;  (16544 33334))
+;;;;;;  (17087 12380))
 ;;; Generated autoloads from mail/unrmail.el
 
 (autoload (quote batch-unrmail) "unrmail" "\
@@ -26123,8 +26400,8 @@ Convert Rmail file FILE to system inbox format file TO-FILE.
 
 ;;;***
 \f
-;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (16213
-;;;;;;  43273))
+;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (17087
+;;;;;;  12380))
 ;;; Generated autoloads from emacs-lisp/unsafep.el
 
 (autoload (quote unsafep) "unsafep" "\
@@ -26136,7 +26413,7 @@ of symbols with local bindings.
 
 ;;;***
 \f
-;;;### (autoloads nil "url" "url/url.el" (16875 35929))
+;;;### (autoloads nil "url" "url/url.el" (17087 12570))
 ;;; Generated autoloads from url/url.el
 
 (defvar url-configuration-directory "~/.url")
@@ -26144,7 +26421,7 @@ of symbols with local bindings.
 ;;;***
 \f
 ;;;### (autoloads (url-register-auth-scheme url-get-authentication)
-;;;;;;  "url-auth" "url/url-auth.el" (16764 51522))
+;;;;;;  "url-auth" "url/url-auth.el" (17087 12565))
 ;;; Generated autoloads from url/url-auth.el
 
 (autoload (quote url-get-authentication) "url-auth" "\
@@ -26186,8 +26463,8 @@ RATING   a rating between 1 and 10 of the strength of the authentication.
 ;;;***
 \f
 ;;;### (autoloads (url-cache-expired url-cache-extract url-is-cached
-;;;;;;  url-store-in-cache) "url-cache" "url/url-cache.el" (16764
-;;;;;;  51522))
+;;;;;;  url-store-in-cache) "url-cache" "url/url-cache.el" (17087
+;;;;;;  12436))
 ;;; Generated autoloads from url/url-cache.el
 
 (autoload (quote url-store-in-cache) "url-cache" "\
@@ -26212,7 +26489,7 @@ Return t iff a cached file has expired.
 
 ;;;***
 \f
-;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (16764 51522))
+;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (17087 12436))
 ;;; Generated autoloads from url/url-cid.el
 
 (autoload (quote url-cid) "url-cid" "\
@@ -26223,8 +26500,9 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (url-cookie-setup-save-timer url-cookie-handle-set-cookie
-;;;;;;  url-cookie-retrieve url-cookie-write-file url-cookie-parse-file)
-;;;;;;  "url-cookie" "url/url-cookie.el" (16746 18215))
+;;;;;;  url-cookie-generate-header-lines url-cookie-retrieve url-cookie-write-file
+;;;;;;  url-cookie-parse-file) "url-cookie" "url/url-cookie.el" (17087
+;;;;;;  12582))
 ;;; Generated autoloads from url/url-cookie.el
 
 (autoload (quote url-cookie-parse-file) "url-cookie" "\
@@ -26242,6 +26520,11 @@ Retrieve all the netscape-style cookies for a specified HOST and PATH.
 
 \(fn HOST PATH &optional SECURE)" nil nil)
 
+(autoload (quote url-cookie-generate-header-lines) "url-cookie" "\
+Not documented
+
+\(fn HOST PATH SECURE)" nil nil)
+
 (autoload (quote url-cookie-handle-set-cookie) "url-cookie" "\
 Not documented
 
@@ -26254,13 +26537,8 @@ Reset the cookie saver timer.
 
 ;;;***
 \f
-;;;### (autoloads (url-dav-vc-registered url-dav-file-name-completion
-;;;;;;  url-dav-file-name-all-completions url-dav-rename-file url-dav-make-directory
-;;;;;;  url-dav-file-directory-p url-dav-directory-files url-dav-delete-file
-;;;;;;  url-dav-delete-directory url-dav-save-resource url-dav-file-attributes
-;;;;;;  url-dav-unlock-resource url-dav-active-locks url-dav-lock-resource
-;;;;;;  url-dav-get-properties url-dav-supported-p) "url-dav" "url/url-dav.el"
-;;;;;;  (16515 33876))
+;;;### (autoloads (url-dav-vc-registered url-dav-supported-p) "url-dav"
+;;;;;;  "url/url-dav.el" (17087 12570))
 ;;; Generated autoloads from url/url-dav.el
 
 (autoload (quote url-dav-supported-p) "url-dav" "\
@@ -26268,102 +26546,6 @@ Not documented
 
 \(fn URL)" nil nil)
 
-(autoload (quote url-dav-get-properties) "url-dav" "\
-Return properties for URL, up to DEPTH levels deep.
-
-Returns an assoc list, where the key is the filename (possibly a full
-URI), and the value is a standard property list of DAV property
-names (ie: DAV:resourcetype).
-
-\(fn URL &optional ATTRIBUTES DEPTH NAMESPACES)" nil nil)
-
-(autoload (quote url-dav-lock-resource) "url-dav" "\
-Request a lock on URL.  If EXCLUSIVE is non-nil, get an exclusive lock.
-Optional 3rd argument DEPTH says how deep the lock should go, default is 0
-\(lock only the resource and none of its children).
-
-Returns a cons-cell of (SUCCESSFUL-RESULTS . FAILURE-RESULTS).
-SUCCESSFUL-RESULTS is a list of (URL STATUS locktoken).
-FAILURE-RESULTS is a list of (URL STATUS).
-
-\(fn URL EXCLUSIVE &optional DEPTH)" nil nil)
-
-(autoload (quote url-dav-active-locks) "url-dav" "\
-Return an assoc list of all active locks on URL.
-
-\(fn URL &optional DEPTH)" nil nil)
-
-(autoload (quote url-dav-unlock-resource) "url-dav" "\
-Release the lock on URL represented by LOCK-TOKEN.
-Returns t iff the lock was successfully released.
-
-\(fn URL LOCK-TOKEN)" nil nil)
-
-(autoload (quote url-dav-file-attributes) "url-dav" "\
-Not documented
-
-\(fn URL &optional ID-FORMAT)" nil nil)
-
-(autoload (quote url-dav-save-resource) "url-dav" "\
-Save OBJ as URL using WebDAV.
-URL must be a fully qualified URL.
-OBJ may be a buffer or a string.
-
-\(fn URL OBJ &optional CONTENT-TYPE LOCK-TOKEN)" nil nil)
-
-(autoload (quote url-dav-delete-directory) "url-dav" "\
-Delete the WebDAV collection URL.
-If optional second argument RECURSIVE is non-nil, then delete all
-files in the collection as well.
-
-\(fn URL &optional RECURSIVE LOCK-TOKEN)" nil nil)
-
-(autoload (quote url-dav-delete-file) "url-dav" "\
-Delete file named URL.
-
-\(fn URL &optional LOCK-TOKEN)" nil nil)
-
-(autoload (quote url-dav-directory-files) "url-dav" "\
-Return a list of names of files in DIRECTORY.
-There are three optional arguments:
-If FULL is non-nil, return absolute file names.  Otherwise return names
- that are relative to the specified directory.
-If MATCH is non-nil, mention only file names that match the regexp MATCH.
-If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
- NOSORT is useful if you plan to sort the result yourself.
-
-\(fn URL &optional FULL MATCH NOSORT FILES-ONLY)" nil nil)
-
-(autoload (quote url-dav-file-directory-p) "url-dav" "\
-Return t if URL names an existing DAV collection.
-
-\(fn URL)" nil nil)
-
-(autoload (quote url-dav-make-directory) "url-dav" "\
-Create the directory DIR and any nonexistent parent dirs.
-
-\(fn URL &optional PARENTS)" nil nil)
-
-(autoload (quote url-dav-rename-file) "url-dav" "\
-Not documented
-
-\(fn OLDNAME NEWNAME &optional OVERWRITE)" nil nil)
-
-(autoload (quote url-dav-file-name-all-completions) "url-dav" "\
-Return a list of all completions of file name FILE in directory DIRECTORY.
-These are all file names in directory DIRECTORY which begin with FILE.
-
-\(fn FILE URL)" nil nil)
-
-(autoload (quote url-dav-file-name-completion) "url-dav" "\
-Complete file name FILE in directory DIRECTORY.
-Returns the longest string
-common to all file names in DIRECTORY that start with FILE.
-If there is only one and FILE matches it exactly, returns t.
-Returns nil if DIR contains no name starting with FILE.
-
-\(fn FILE URL)" nil nil)
-
 (autoload (quote url-dav-vc-registered) "url-dav" "\
 Not documented
 
@@ -26371,8 +26553,8 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (url-file) "url-file" "url/url-file.el" (16746
-;;;;;;  18215))
+;;;### (autoloads (url-file) "url-file" "url/url-file.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from url/url-file.el
 
 (autoload (quote url-file) "url-file" "\
@@ -26383,7 +26565,7 @@ Handle file: and ftp: URLs.
 ;;;***
 \f
 ;;;### (autoloads (url-open-stream url-gateway-nslookup-host) "url-gw"
-;;;;;;  "url/url-gw.el" (16764 51522))
+;;;;;;  "url/url-gw.el" (17087 12578))
 ;;; Generated autoloads from url/url-gw.el
 
 (autoload (quote url-gateway-nslookup-host) "url-gw" "\
@@ -26394,15 +26576,15 @@ Attempt to resolve the given HOST using nslookup if possible.
 (autoload (quote url-open-stream) "url-gw" "\
 Open a stream to HOST, possibly via a gateway.
 Args per `open-network-stream'.
-Will not make a connexion if `url-gateway-unplugged' is non-nil.
+Will not make a connection if `url-gateway-unplugged' is non-nil.
 
 \(fn NAME BUFFER HOST SERVICE)" nil nil)
 
 ;;;***
 \f
 ;;;### (autoloads (url-insert-file-contents url-file-local-copy url-copy-file
-;;;;;;  url-handler-mode) "url-handlers" "url/url-handlers.el" (16829
-;;;;;;  43427))
+;;;;;;  url-handler-mode) "url-handlers" "url/url-handlers.el" (17087
+;;;;;;  12570))
 ;;; Generated autoloads from url/url-handlers.el
 
 (defvar url-handler-mode nil "\
@@ -26446,7 +26628,7 @@ Not documented
 \f
 ;;;### (autoloads (url-history-save-history url-history-parse-history
 ;;;;;;  url-history-setup-save-timer) "url-history" "url/url-history.el"
-;;;;;;  (16930 25655))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from url/url-history.el
 
 (autoload (quote url-history-setup-save-timer) "url-history" "\
@@ -26470,7 +26652,7 @@ user for what type to save as.
 ;;;***
 \f
 ;;;### (autoloads (url-http-options url-http-file-attributes url-http-file-exists-p
-;;;;;;  url-http) "url-http" "url/url-http.el" (16912 31025))
+;;;;;;  url-http) "url-http" "url/url-http.el" (17087 12570))
 ;;; Generated autoloads from url/url-http.el
 
 (autoload (quote url-http) "url-http" "\
@@ -26523,7 +26705,7 @@ p3p
 
 ;;;***
 \f
-;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (16775 26718))
+;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (17087 12438))
 ;;; Generated autoloads from url/url-irc.el
 
 (autoload (quote url-irc) "url-irc" "\
@@ -26533,19 +26715,22 @@ Not documented
 
 ;;;***
 \f
-;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (16747
-;;;;;;  61768))
+;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (17087
+;;;;;;  12531))
 ;;; Generated autoloads from url/url-ldap.el
 
 (autoload (quote url-ldap) "url-ldap" "\
-Not documented
+Perform an LDAP search specified by URL.
+The return value is a buffer displaying the search results in HTML.
+URL can be a URL string, or a URL vector of the type returned by
+`url-generic-parse-url'.
 
 \(fn URL)" nil nil)
 
 ;;;***
 \f
 ;;;### (autoloads (url-mailto url-mail) "url-mailto" "url/url-mailto.el"
-;;;;;;  (16788 34909))
+;;;;;;  (17087 12440))
 ;;; Generated autoloads from url/url-mailto.el
 
 (autoload (quote url-mail) "url-mailto" "\
@@ -26561,7 +26746,7 @@ Handle the mailto: URL syntax.
 ;;;***
 \f
 ;;;### (autoloads (url-data url-generic-emulator-loader url-info
-;;;;;;  url-man) "url-misc" "url/url-misc.el" (16764 51522))
+;;;;;;  url-man) "url-misc" "url/url-misc.el" (17087 12436))
 ;;; Generated autoloads from url/url-misc.el
 
 (autoload (quote url-man) "url-misc" "\
@@ -26593,7 +26778,7 @@ Fetch a data URL (RFC 2397).
 ;;;***
 \f
 ;;;### (autoloads (url-snews url-news) "url-news" "url/url-news.el"
-;;;;;;  (16775 26718))
+;;;;;;  (17087 12438))
 ;;; Generated autoloads from url/url-news.el
 
 (autoload (quote url-news) "url-news" "\
@@ -26610,7 +26795,7 @@ Not documented
 \f
 ;;;### (autoloads (url-ns-user-pref url-ns-prefs isInNet isResolvable
 ;;;;;;  dnsResolve dnsDomainIs isPlainHostName) "url-ns" "url/url-ns.el"
-;;;;;;  (16764 51522))
+;;;;;;  (17087 12565))
 ;;; Generated autoloads from url/url-ns.el
 
 (autoload (quote isPlainHostName) "url-ns" "\
@@ -26651,7 +26836,7 @@ Not documented
 ;;;***
 \f
 ;;;### (autoloads (url-generic-parse-url url-recreate-url) "url-parse"
-;;;;;;  "url/url-parse.el" (16746 18215))
+;;;;;;  "url/url-parse.el" (17087 12565))
 ;;; Generated autoloads from url/url-parse.el
 
 (autoload (quote url-recreate-url) "url-parse" "\
@@ -26669,7 +26854,7 @@ Format is:
 ;;;***
 \f
 ;;;### (autoloads (url-setup-privacy-info) "url-privacy" "url/url-privacy.el"
-;;;;;;  (16764 51522))
+;;;;;;  (17087 12436))
 ;;; Generated autoloads from url/url-privacy.el
 
 (autoload (quote url-setup-privacy-info) "url-privacy" "\
@@ -26685,7 +26870,7 @@ Not documented
 ;;;;;;  url-strip-leading-spaces url-eat-trailing-space url-get-normalized-date
 ;;;;;;  url-lazy-message url-normalize-url url-insert-entities-in-string
 ;;;;;;  url-parse-args url-debug url-debug) "url-util" "url/url-util.el"
-;;;;;;  (16764 51522))
+;;;;;;  (17087 12565))
 ;;; Generated autoloads from url/url-util.el
 
 (defvar url-debug nil "\
@@ -26810,7 +26995,7 @@ This uses `url-current-object', set locally to the buffer.
 ;;;***
 \f
 ;;;### (autoloads (ask-user-about-supersession-threat ask-user-about-lock)
-;;;;;;  "userlock" "userlock.el" (16213 43271))
+;;;;;;  "userlock" "userlock.el" (17087 12380))
 ;;; Generated autoloads from userlock.el
 
 (autoload (quote ask-user-about-lock) "userlock" "\
@@ -26840,7 +27025,7 @@ The buffer in question is current when this function is called.
 \f
 ;;;### (autoloads (uudecode-decode-region uudecode-decode-region-internal
 ;;;;;;  uudecode-decode-region-external) "uudecode" "gnus/uudecode.el"
-;;;;;;  (16908 33362))
+;;;;;;  (17087 12466))
 ;;; Generated autoloads from gnus/uudecode.el
 
 (autoload (quote uudecode-decode-region-external) "uudecode" "\
@@ -26869,8 +27054,8 @@ If FILE-NAME is non-nil, save the result to FILE-NAME.
 ;;;;;;  vc-revert-buffer vc-print-log vc-retrieve-snapshot vc-create-snapshot
 ;;;;;;  vc-directory vc-merge vc-insert-headers vc-version-other-window
 ;;;;;;  vc-diff vc-register vc-next-action vc-do-command edit-vc-file
-;;;;;;  with-vc-file vc-branch-part vc-before-checkin-hook vc-checkin-hook
-;;;;;;  vc-checkout-hook) "vc" "vc.el" (16930 4639))
+;;;;;;  with-vc-file vc-branch-part vc-trunk-p vc-before-checkin-hook
+;;;;;;  vc-checkin-hook vc-checkout-hook) "vc" "vc.el" (17087 12570))
 ;;; Generated autoloads from vc.el
 
 (defvar vc-checkout-hook nil "\
@@ -26891,6 +27076,11 @@ See `run-hooks'.")
 
 (custom-autoload (quote vc-before-checkin-hook) "vc")
 
+(autoload (quote vc-trunk-p) "vc" "\
+Return t if REV is a revision on the trunk.
+
+\(fn REV)" nil nil)
+
 (autoload (quote vc-branch-part) "vc" "\
 Return the branch part of a revision number REV.
 
@@ -27123,12 +27313,12 @@ log entries should be gathered.
 \(fn &rest ARGS)" t nil)
 
 (autoload (quote vc-annotate) "vc" "\
-Display the edit history of the current file using colours.
+Display the edit history of the current file using colors.
 
 This command creates a buffer that shows, for each line of the current
-file, when it was last edited and by whom.  Additionally, colours are
+file, when it was last edited and by whom.  Additionally, colors are
 used to show the age of each line--blue means oldest, red means
-youngest, and intermediate colours indicate intermediate ages.  By
+youngest, and intermediate colors indicate intermediate ages.  By
 default, the time scale stretches back one year into the past;
 everything that is older than that is shown in blue.
 
@@ -27152,7 +27342,7 @@ colors. `vc-annotate-background' specifies the background color.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-arch" "vc-arch.el" (16866 20008))
+;;;### (autoloads nil "vc-arch" "vc-arch.el" (17087 12570))
 ;;; Generated autoloads from vc-arch.el
  (defun vc-arch-registered (file)
   (if (vc-find-root file "{arch}/=tagging-method")
@@ -27162,7 +27352,7 @@ colors. `vc-annotate-background' specifies the background color.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-cvs" "vc-cvs.el" (16908 33361))
+;;;### (autoloads nil "vc-cvs" "vc-cvs.el" (17087 12566))
 ;;; Generated autoloads from vc-cvs.el
  (defun vc-cvs-registered (f)
   (when (file-readable-p (expand-file-name
@@ -27172,7 +27362,7 @@ colors. `vc-annotate-background' specifies the background color.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-mcvs" "vc-mcvs.el" (16908 33361))
+;;;### (autoloads nil "vc-mcvs" "vc-mcvs.el" (17087 12466))
 ;;; Generated autoloads from vc-mcvs.el
  (defun vc-mcvs-registered (file)
   (if (vc-find-root file "MCVS/CVS")
@@ -27183,7 +27373,7 @@ colors. `vc-annotate-background' specifies the background color.
 ;;;***
 \f
 ;;;### (autoloads (vc-rcs-master-templates) "vc-rcs" "vc-rcs.el"
-;;;;;;  (16858 50920))
+;;;;;;  (17087 12451))
 ;;; Generated autoloads from vc-rcs.el
 
 (defvar vc-rcs-master-templates (quote ("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) "\
@@ -27196,7 +27386,7 @@ For a description of possible values, see `vc-check-master-templates'.")
 ;;;***
 \f
 ;;;### (autoloads (vc-sccs-master-templates) "vc-sccs" "vc-sccs.el"
-;;;;;;  (16701 32674))
+;;;;;;  (17087 12416))
 ;;; Generated autoloads from vc-sccs.el
 
 (defvar vc-sccs-master-templates (quote ("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) "\
@@ -27213,7 +27403,7 @@ find any project directory." (let ((project-dir (getenv "PROJECTDIR")) dirs dir)
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-svn" "vc-svn.el" (16908 33361))
+;;;### (autoloads nil "vc-svn" "vc-svn.el" (17087 12466))
 ;;; Generated autoloads from vc-svn.el
  (defun vc-svn-registered (f)
   (when (file-readable-p (expand-file-name
@@ -27226,7 +27416,7 @@ find any project directory." (let ((project-dir (getenv "PROJECTDIR")) dirs dir)
 ;;;***
 \f
 ;;;### (autoloads (vhdl-mode) "vhdl-mode" "progmodes/vhdl-mode.el"
-;;;;;;  (16858 50937))
+;;;;;;  (17087 12575))
 ;;; Generated autoloads from progmodes/vhdl-mode.el
 
 (autoload (quote vhdl-mode) "vhdl-mode" "\
@@ -27751,7 +27941,7 @@ Key bindings:
 
 ;;;***
 \f
-;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (16423 23570))
+;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (17087 12569))
 ;;; Generated autoloads from emulation/vi.el
 
 (autoload (quote vi-mode) "vi" "\
@@ -27806,7 +27996,7 @@ Syntax table and abbrevs while in vi mode remain as they were in Emacs.
 ;;;### (autoloads (viqr-pre-write-conversion viqr-post-read-conversion
 ;;;;;;  viet-encode-viqr-buffer viet-encode-viqr-region viet-decode-viqr-buffer
 ;;;;;;  viet-decode-viqr-region viet-encode-viscii-char) "viet-util"
-;;;;;;  "language/viet-util.el" (16213 43280))
+;;;;;;  "language/viet-util.el" (17087 12566))
 ;;; Generated autoloads from language/viet-util.el
 
 (autoload (quote viet-encode-viscii-char) "viet-util" "\
@@ -27852,8 +28042,8 @@ Not documented
 \f
 ;;;### (autoloads (View-exit-and-edit view-mode-enter view-mode view-buffer-other-frame
 ;;;;;;  view-buffer-other-window view-buffer view-file-other-frame
-;;;;;;  view-file-other-window view-file) "view" "view.el" (16764
-;;;;;;  51519))
+;;;;;;  view-file-other-window view-file) "view" "view.el" (17087
+;;;;;;  12435))
 ;;; Generated autoloads from view.el
 
 (defvar view-mode nil "\
@@ -28060,8 +28250,8 @@ Exit View mode and make the current buffer editable.
 
 ;;;***
 \f
-;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (16213
-;;;;;;  43273))
+;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (17087
+;;;;;;  12574))
 ;;; Generated autoloads from emulation/vip.el
 
 (autoload (quote vip-setup) "vip" "\
@@ -28077,7 +28267,7 @@ Turn on VIP emulation of VI.
 ;;;***
 \f
 ;;;### (autoloads (viper-mode toggle-viper-mode) "viper" "emulation/viper.el"
-;;;;;;  (16923 3621))
+;;;;;;  (17087 12569))
 ;;; Generated autoloads from emulation/viper.el
 
 (autoload (quote toggle-viper-mode) "viper" "\
@@ -28094,7 +28284,7 @@ Turn on Viper emulation of Vi.
 ;;;***
 \f
 ;;;### (autoloads (warn lwarn display-warning) "warnings" "emacs-lisp/warnings.el"
-;;;;;;  (16908 33361))
+;;;;;;  (17087 12574))
 ;;; Generated autoloads from emacs-lisp/warnings.el
 
 (defvar warning-prefix-function nil "\
@@ -28130,7 +28320,9 @@ or a list of symbols whose first element is a custom group name.
 \(The rest of the symbols represent subcategories, for warning purposes
 only, and you can use whatever symbols you like.)
 
-LEVEL should be either :warning, :error, or :emergency.
+LEVEL should be either :debug, :warning, :error, or :emergency
+\(but see `warning-minimum-level' and `warning-minimum-log-level').
+
 :emergency -- a problem that will seriously impair Emacs operation soon
              if you do not attend to it promptly.
 :error     -- data or circumstances that are inherently wrong.
@@ -28158,11 +28350,14 @@ or a list of symbols whose first element is a custom group name.
 \(The rest of the symbols represent subcategories and
 can be whatever you like.)
 
-LEVEL should be either :warning, :error, or :emergency.
+LEVEL should be either :debug, :warning, :error, or :emergency
+\(but see `warning-minimum-level' and `warning-minimum-log-level').
+
 :emergency -- a problem that will seriously impair Emacs operation soon
              if you do not attend to it promptly.
 :error     -- invalid data or circumstances.
 :warning   -- suspicious data or circumstances.
+:debug     -- info for debugging only.
 
 \(fn TYPE LEVEL MESSAGE &rest ARGS)" nil nil)
 
@@ -28177,13 +28372,15 @@ this is equivalent to `display-warning', using
 ;;;***
 \f
 ;;;### (autoloads (wdired-change-to-wdired-mode) "wdired" "wdired.el"
-;;;;;;  (16923 3610))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from wdired.el
 
 (autoload (quote wdired-change-to-wdired-mode) "wdired" "\
 Put a dired buffer in a mode in which filenames are editable.
-In this mode the names of the files can be changed, and after
-typing C-c C-c the files and directories in disk are renamed.
+\\<wdired-mode-map>
+This mode allows the user to change the names of the files, and after
+typing \\[wdired-finish-edit] Emacs renames the files and directories
+in disk.
 
 See `wdired-mode'.
 
@@ -28191,7 +28388,7 @@ See `wdired-mode'.
 
 ;;;***
 \f
-;;;### (autoloads (webjump) "webjump" "net/webjump.el" (16423 23573))
+;;;### (autoloads (webjump) "webjump" "net/webjump.el" (17087 12564))
 ;;; Generated autoloads from net/webjump.el
 
 (autoload (quote webjump) "webjump" "\
@@ -28208,7 +28405,7 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke
 ;;;***
 \f
 ;;;### (autoloads (which-function-mode) "which-func" "progmodes/which-func.el"
-;;;;;;  (16820 16328))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from progmodes/which-func.el
  (put 'which-func-format 'risky-local-variable t)
  (put 'which-func-current 'risky-local-variable t)
@@ -28240,7 +28437,7 @@ and off otherwise.
 ;;;;;;  whitespace-buffer whitespace-toggle-ateol-check whitespace-toggle-spacetab-check
 ;;;;;;  whitespace-toggle-indent-check whitespace-toggle-trailing-check
 ;;;;;;  whitespace-toggle-leading-check) "whitespace" "whitespace.el"
-;;;;;;  (16764 51519))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from whitespace.el
 
 (autoload (quote whitespace-toggle-leading-check) "whitespace" "\
@@ -28330,7 +28527,7 @@ This is meant to be added buffer-locally to `write-file-functions'.
 ;;;***
 \f
 ;;;### (autoloads (widget-minor-mode widget-browse-other-window widget-browse
-;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (16213 43272))
+;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (17087 12566))
 ;;; Generated autoloads from wid-browse.el
 
 (autoload (quote widget-browse-at) "wid-browse" "\
@@ -28357,8 +28554,8 @@ With arg, turn widget mode on if and only if arg is positive.
 ;;;***
 \f
 ;;;### (autoloads (widget-setup widget-insert widget-delete widget-create
-;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (16894
-;;;;;;  3340))
+;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (17087
+;;;;;;  12589))
 ;;; Generated autoloads from wid-edit.el
 
 (autoload (quote widgetp) "wid-edit" "\
@@ -28400,8 +28597,8 @@ Setup current buffer so editing string widgets works.
 ;;;***
 \f
 ;;;### (autoloads (windmove-default-keybindings windmove-down windmove-right
-;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (16710
-;;;;;;  51039))
+;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (17087
+;;;;;;  12423))
 ;;; Generated autoloads from windmove.el
 
 (autoload (quote windmove-left) "windmove" "\
@@ -28454,7 +28651,7 @@ Default MODIFIER is 'shift.
 ;;;***
 \f
 ;;;### (autoloads (winner-mode winner-mode) "winner" "winner.el"
-;;;;;;  (16792 36614))
+;;;;;;  (17087 12441))
 ;;; Generated autoloads from winner.el
 
 (defvar winner-mode nil "\
@@ -28473,7 +28670,7 @@ With arg, turn Winner mode on if and only if arg is positive.
 ;;;***
 \f
 ;;;### (autoloads (woman-find-file woman-dired-find-file woman) "woman"
-;;;;;;  "woman.el" (16875 35928))
+;;;;;;  "woman.el" (17087 12575))
 ;;; Generated autoloads from woman.el
 
 (autoload (quote woman) "woman" "\
@@ -28509,7 +28706,7 @@ decompress the file if appropriate.  See the documentation for the
 ;;;***
 \f
 ;;;### (autoloads (wordstar-mode) "ws-mode" "emulation/ws-mode.el"
-;;;;;;  (16213 43273))
+;;;;;;  (17087 12566))
 ;;; Generated autoloads from emulation/ws-mode.el
 
 (autoload (quote wordstar-mode) "ws-mode" "\
@@ -28622,7 +28819,7 @@ The key bindings are:
 ;;;***
 \f
 ;;;### (autoloads (xml-parse-region xml-parse-file) "xml" "xml.el"
-;;;;;;  (16830 50347))
+;;;;;;  (17087 12570))
 ;;; Generated autoloads from xml.el
 
 (autoload (quote xml-parse-file) "xml" "\
@@ -28647,8 +28844,8 @@ If PARSE-NS is non-nil, then QNAMES are expanded.
 
 ;;;***
 \f
-;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (16875
-;;;;;;  35928))
+;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (17087
+;;;;;;  12533))
 ;;; Generated autoloads from xt-mouse.el
 
 (defvar xterm-mouse-mode nil "\
@@ -28663,14 +28860,19 @@ use either \\[customize] or the function `xterm-mouse-mode'.")
 Toggle XTerm mouse mode.
 With prefix arg, turn XTerm mouse mode on iff arg is positive.
 
-Turn it on to use emacs mouse commands, and off to use xterm mouse commands.
+Turn it on to use Emacs mouse commands, and off to use xterm mouse commands.
+This works in terminal emulators compatible with xterm.  It only
+works for simple uses of the mouse.  Basically, only non-modified
+single clicks are supported.  When turned on, the normal xterm
+mouse functionality for such clicks is still available by holding
+down the SHIFT key while pressing the mouse button.
 
 \(fn &optional ARG)" t nil)
 
 ;;;***
 \f
 ;;;### (autoloads (yenc-extract-filename yenc-decode-region) "yenc"
-;;;;;;  "gnus/yenc.el" (16697 49031))
+;;;;;;  "gnus/yenc.el" (17087 12415))
 ;;; Generated autoloads from gnus/yenc.el
 
 (autoload (quote yenc-decode-region) "yenc" "\
@@ -28686,7 +28888,7 @@ Extract file name from an yenc header.
 ;;;***
 \f
 ;;;### (autoloads (psychoanalyze-pinhead apropos-zippy insert-zippyism
-;;;;;;  yow) "yow" "play/yow.el" (16213 43281))
+;;;;;;  yow) "yow" "play/yow.el" (17087 12380))
 ;;; Generated autoloads from play/yow.el
 
 (autoload (quote yow) "yow" "\
@@ -28712,7 +28914,7 @@ Zippy goes to the analyst.
 
 ;;;***
 \f
-;;;### (autoloads (zone) "zone" "play/zone.el" (16858 50933))
+;;;### (autoloads (zone) "zone" "play/zone.el" (17087 12558))
 ;;; Generated autoloads from play/zone.el
 
 (autoload (quote zone) "zone" "\
@@ -28723,7 +28925,7 @@ Zone out, completely.
 ;;;***
 \f
 ;;;### (autoloads (zone-mode zone-mode-update-serial-hook) "zone-mode"
-;;;;;;  "net/zone-mode.el" (16377 12872))
+;;;;;;  "net/zone-mode.el" (17087 12575))
 ;;; Generated autoloads from net/zone-mode.el
 
 (autoload (quote zone-mode-update-serial-hook) "zone-mode" "\
@@ -28790,25 +28992,24 @@ Zone-mode does two things:
 ;;;;;;  "eshell/esh-cmd.el" "eshell/esh-ext.el" "eshell/esh-io.el"
 ;;;;;;  "eshell/esh-maint.el" "eshell/esh-module.el" "eshell/esh-opt.el"
 ;;;;;;  "eshell/esh-proc.el" "eshell/esh-util.el" "eshell/esh-var.el"
-;;;;;;  "faces.el" "files.el" "filesets.el" "foldout.el" "font-core.el"
-;;;;;;  "format.el" "forms-d2.el" "forms-pass.el" "frame.el" "generic-x.el"
-;;;;;;  "gnus/compface.el" "gnus/dig.el" "gnus/dns.el" "gnus/format-spec.el"
-;;;;;;  "gnus/gnus-async.el" "gnus/gnus-bcklg.el" "gnus/gnus-cite.el"
-;;;;;;  "gnus/gnus-cus.el" "gnus/gnus-demon.el" "gnus/gnus-diary.el"
-;;;;;;  "gnus/gnus-dup.el" "gnus/gnus-eform.el" "gnus/gnus-ems.el"
-;;;;;;  "gnus/gnus-gl.el" "gnus/gnus-int.el" "gnus/gnus-logic.el"
-;;;;;;  "gnus/gnus-mh.el" "gnus/gnus-nocem.el" "gnus/gnus-salt.el"
-;;;;;;  "gnus/gnus-score.el" "gnus/gnus-setup.el" "gnus/gnus-srvr.el"
-;;;;;;  "gnus/gnus-sum.el" "gnus/gnus-topic.el" "gnus/gnus-undo.el"
-;;;;;;  "gnus/gnus-util.el" "gnus/gnus-uu.el" "gnus/gnus-vm.el" "gnus/hex-util.el"
-;;;;;;  "gnus/ietf-drums.el" "gnus/imap.el" "gnus/legacy-gnus-agent.el"
-;;;;;;  "gnus/mail-parse.el" "gnus/mail-prsvr.el" "gnus/mail-source.el"
-;;;;;;  "gnus/mailcap.el" "gnus/messcompat.el" "gnus/mm-bodies.el"
-;;;;;;  "gnus/mm-decode.el" "gnus/mm-encode.el" "gnus/mm-util.el"
-;;;;;;  "gnus/mm-view.el" "gnus/mml-sec.el" "gnus/mml-smime.el" "gnus/mml.el"
-;;;;;;  "gnus/nnagent.el" "gnus/nnbabyl.el" "gnus/nndb.el" "gnus/nndir.el"
-;;;;;;  "gnus/nndraft.el" "gnus/nneething.el" "gnus/nngateway.el"
-;;;;;;  "gnus/nnheader.el" "gnus/nnimap.el" "gnus/nnlistserv.el"
+;;;;;;  "faces.el" "files.el" "foldout.el" "font-core.el" "format.el"
+;;;;;;  "forms-d2.el" "forms-pass.el" "frame.el" "generic-x.el" "gnus/compface.el"
+;;;;;;  "gnus/dig.el" "gnus/dns.el" "gnus/format-spec.el" "gnus/gnus-async.el"
+;;;;;;  "gnus/gnus-bcklg.el" "gnus/gnus-cite.el" "gnus/gnus-cus.el"
+;;;;;;  "gnus/gnus-demon.el" "gnus/gnus-diary.el" "gnus/gnus-dup.el"
+;;;;;;  "gnus/gnus-eform.el" "gnus/gnus-ems.el" "gnus/gnus-gl.el"
+;;;;;;  "gnus/gnus-int.el" "gnus/gnus-logic.el" "gnus/gnus-mh.el"
+;;;;;;  "gnus/gnus-nocem.el" "gnus/gnus-salt.el" "gnus/gnus-score.el"
+;;;;;;  "gnus/gnus-setup.el" "gnus/gnus-srvr.el" "gnus/gnus-sum.el"
+;;;;;;  "gnus/gnus-topic.el" "gnus/gnus-undo.el" "gnus/gnus-util.el"
+;;;;;;  "gnus/gnus-uu.el" "gnus/gnus-vm.el" "gnus/hex-util.el" "gnus/ietf-drums.el"
+;;;;;;  "gnus/imap.el" "gnus/legacy-gnus-agent.el" "gnus/mail-parse.el"
+;;;;;;  "gnus/mail-prsvr.el" "gnus/mail-source.el" "gnus/mailcap.el"
+;;;;;;  "gnus/messcompat.el" "gnus/mm-bodies.el" "gnus/mm-decode.el"
+;;;;;;  "gnus/mm-encode.el" "gnus/mm-util.el" "gnus/mm-view.el" "gnus/mml-sec.el"
+;;;;;;  "gnus/mml-smime.el" "gnus/mml.el" "gnus/nnagent.el" "gnus/nnbabyl.el"
+;;;;;;  "gnus/nndb.el" "gnus/nndir.el" "gnus/nndraft.el" "gnus/nneething.el"
+;;;;;;  "gnus/nngateway.el" "gnus/nnheader.el" "gnus/nnimap.el" "gnus/nnlistserv.el"
 ;;;;;;  "gnus/nnmail.el" "gnus/nnmaildir.el" "gnus/nnmbox.el" "gnus/nnmh.el"
 ;;;;;;  "gnus/nnnil.el" "gnus/nnoo.el" "gnus/nnrss.el" "gnus/nnslashdot.el"
 ;;;;;;  "gnus/nnspool.el" "gnus/nntp.el" "gnus/nnultimate.el" "gnus/nnvirtual.el"
@@ -28816,10 +29017,9 @@ Zone-mode does two things:
 ;;;;;;  "gnus/pgg-gpg.el" "gnus/pgg-parse.el" "gnus/pgg-pgp.el" "gnus/pgg-pgp5.el"
 ;;;;;;  "gnus/pop3.el" "gnus/rfc1843.el" "gnus/rfc2045.el" "gnus/rfc2047.el"
 ;;;;;;  "gnus/rfc2104.el" "gnus/rfc2231.el" "gnus/sieve-manage.el"
-;;;;;;  "gnus/smime.el" "gnus/spam-report.el" "gnus/spam-stat.el"
-;;;;;;  "gnus/starttls.el" "gnus/utf7.el" "gnus/webmail.el" "help.el"
-;;;;;;  "indent.el" "international/characters.el" "international/fontset.el"
-;;;;;;  "international/iso-ascii.el" "international/iso-insert.el"
+;;;;;;  "gnus/smime.el" "gnus/spam-stat.el" "gnus/starttls.el" "gnus/utf7.el"
+;;;;;;  "gnus/webmail.el" "help.el" "indent.el" "international/characters.el"
+;;;;;;  "international/fontset.el" "international/iso-ascii.el" "international/iso-insert.el"
 ;;;;;;  "international/iso-swed.el" "international/ja-dic-cnv.el"
 ;;;;;;  "international/ja-dic-utl.el" "international/latin-1.el"
 ;;;;;;  "international/latin-2.el" "international/latin-3.el" "international/latin-4.el"
@@ -28829,26 +29029,26 @@ Zone-mode does two things:
 ;;;;;;  "international/subst-gb2312.el" "international/subst-jis.el"
 ;;;;;;  "international/subst-ksc.el" "international/swedish.el" "international/ucs-tables.el"
 ;;;;;;  "international/utf-16.el" "international/utf-7.el" "international/utf-8.el"
-;;;;;;  "isearch.el" "kermit.el" "language/chinese.el" "language/cyrillic.el"
-;;;;;;  "language/czech.el" "language/devanagari.el" "language/english.el"
-;;;;;;  "language/ethiopic.el" "language/european.el" "language/georgian.el"
-;;;;;;  "language/greek.el" "language/hebrew.el" "language/indian.el"
-;;;;;;  "language/japanese.el" "language/kannada.el" "language/korean.el"
-;;;;;;  "language/lao.el" "language/malayalam.el" "language/misc-lang.el"
-;;;;;;  "language/romanian.el" "language/slovak.el" "language/tamil.el"
-;;;;;;  "language/thai-word.el" "language/thai.el" "language/tibetan.el"
-;;;;;;  "language/utf-8-lang.el" "language/vietnamese.el" "ldefs-boot.el"
-;;;;;;  "loadup.el" "mail/blessmail.el" "mail/mailheader.el" "mail/mailpost.el"
-;;;;;;  "mail/mspools.el" "mail/rfc2368.el" "mail/rfc822.el" "mail/rmail-spam-filter.el"
-;;;;;;  "mail/uce.el" "mail/vms-pmail.el" "mh-e/mh-acros.el" "mh-e/mh-alias.el"
-;;;;;;  "mh-e/mh-customize.el" "mh-e/mh-funcs.el" "mh-e/mh-gnus.el"
-;;;;;;  "mh-e/mh-identity.el" "mh-e/mh-inc.el" "mh-e/mh-index.el"
-;;;;;;  "mh-e/mh-junk.el" "mh-e/mh-loaddefs.el" "mh-e/mh-mime.el"
-;;;;;;  "mh-e/mh-pick.el" "mh-e/mh-print.el" "mh-e/mh-seq.el" "mh-e/mh-speed.el"
-;;;;;;  "mh-e/mh-utils.el" "misc.el" "mouse-copy.el" "mouse-drag.el"
-;;;;;;  "mouse.el" "net/eudc-vars.el" "net/eudcb-bbdb.el" "net/eudcb-ldap.el"
-;;;;;;  "net/eudcb-ph.el" "net/ldap.el" "net/netrc.el" "net/tls.el"
-;;;;;;  "net/tramp-ftp.el" "net/tramp-smb.el" "net/tramp-util.el"
+;;;;;;  "isearch.el" "jka-cmpr-hook.el" "kermit.el" "language/chinese.el"
+;;;;;;  "language/cyrillic.el" "language/czech.el" "language/devanagari.el"
+;;;;;;  "language/english.el" "language/ethiopic.el" "language/european.el"
+;;;;;;  "language/georgian.el" "language/greek.el" "language/hebrew.el"
+;;;;;;  "language/indian.el" "language/japanese.el" "language/kannada.el"
+;;;;;;  "language/korean.el" "language/lao.el" "language/malayalam.el"
+;;;;;;  "language/misc-lang.el" "language/romanian.el" "language/slovak.el"
+;;;;;;  "language/tamil.el" "language/thai-word.el" "language/thai.el"
+;;;;;;  "language/tibetan.el" "language/utf-8-lang.el" "language/vietnamese.el"
+;;;;;;  "ldefs-boot.el" "loadup.el" "mail/blessmail.el" "mail/mailheader.el"
+;;;;;;  "mail/mailpost.el" "mail/mspools.el" "mail/rfc2368.el" "mail/rfc822.el"
+;;;;;;  "mail/rmail-spam-filter.el" "mail/uce.el" "mail/vms-pmail.el"
+;;;;;;  "mh-e/mh-acros.el" "mh-e/mh-alias.el" "mh-e/mh-customize.el"
+;;;;;;  "mh-e/mh-funcs.el" "mh-e/mh-gnus.el" "mh-e/mh-identity.el"
+;;;;;;  "mh-e/mh-inc.el" "mh-e/mh-index.el" "mh-e/mh-junk.el" "mh-e/mh-loaddefs.el"
+;;;;;;  "mh-e/mh-mime.el" "mh-e/mh-pick.el" "mh-e/mh-print.el" "mh-e/mh-seq.el"
+;;;;;;  "mh-e/mh-speed.el" "mh-e/mh-utils.el" "misc.el" "mouse-copy.el"
+;;;;;;  "mouse-drag.el" "mouse.el" "net/eudc-vars.el" "net/eudcb-bbdb.el"
+;;;;;;  "net/eudcb-ldap.el" "net/eudcb-ph.el" "net/ldap.el" "net/netrc.el"
+;;;;;;  "net/tls.el" "net/tramp-ftp.el" "net/tramp-smb.el" "net/tramp-util.el"
 ;;;;;;  "net/tramp-uu.el" "net/tramp-vc.el" "net/trampver.el" "obsolete/awk-mode.el"
 ;;;;;;  "obsolete/float.el" "obsolete/hilit19.el" "obsolete/keyswap.el"
 ;;;;;;  "obsolete/mlsupport.el" "obsolete/ooutline.el" "obsolete/profile.el"
@@ -28886,7 +29086,7 @@ Zone-mode does two things:
 ;;;;;;  "url/url-vars.el" "url/vc-dav.el" "vc-hooks.el" "vcursor.el"
 ;;;;;;  "version.el" "vms-patch.el" "vmsproc.el" "vt-control.el"
 ;;;;;;  "vt100-led.el" "w32-fns.el" "w32-vars.el" "widget.el" "window.el"
-;;;;;;  "x-dnd.el") (16960 18483 123965))
+;;;;;;  "x-dnd.el") (17087 12870 740741))
 
 ;;;***
 \f
index 26070965994cfee93829ac005f744dd71e3a7396..36ed511f5846c9629bccaaed826d30628abfc379 100644 (file)
@@ -68,6 +68,8 @@
 (setq load-source-file-function 'load-with-code-conversion)
 (load "files")
 
+(load "startup")
+
 (load "cus-face")
 (load "faces")  ; after here, `defface' may be used.
 
 (message "%s" (garbage-collect))
 (load "menu-bar")
 (load "paths.el")  ;Don't get confused if someone compiled paths by mistake.
-(load "startup")
 (load "emacs-lisp/lisp")
 (load "textmodes/page")
 (load "register")
       (load "vmsproc")))
 (load "abbrev")
 (load "buff-menu")
+(load "server") ; server-getenv is used throughout the terminal initialization code
 (if (eq system-type 'vax-vms)
     (progn
       (load "vms-patch")))
       (load "emacs-lisp/float-sup")))
 (message "%s" (garbage-collect))
 
+;; Load auxiliary settings for X displays if we support them.
+(when (fboundp 'x-create-frame)
+  (load "mouse")
+  (load "international/fontset")
+  (load "dnd")
+  (load "x-dnd")
+  (load "term/x-win"))
+
+(message "%s" (garbage-collect))
+
 (load "vc-hooks")
 (load "jka-cmpr-hook")
 (load "ediff-hook")
index 279548b81d633a7517e0ffb856054c393cfbd110..97e14aabde690c184fa3a8e36ebdc3d910707519 100644 (file)
@@ -395,15 +395,15 @@ It selects the customization based on the specifications in the
          (setq table (cdr table)))
       (setq iso-language language
            iso-accents-list table)
-      (if key-translation-map
+      (if global-key-translation-map
          (substitute-key-definition
-          'iso-accents-accent-key nil key-translation-map)
-       (setq key-translation-map (make-sparse-keymap)))
+          'iso-accents-accent-key nil global-key-translation-map)
+       (setq global-key-translation-map (make-sparse-keymap)))
       ;; Set up translations for all the characters that are used as
       ;; accent prefixes in this language.
       (setq tail iso-accents-list)
       (while tail
-       (define-key key-translation-map (vector (car (car tail)))
+       (define-key global-key-translation-map (vector (car (car tail)))
          'iso-accents-accent-key)
        (setq tail (cdr tail))))))
 
index 73878d8435ba66db8c63491c5df51651f08161a2..6da8527f4e5ee3b7728b4309f15b0976f494c5cd 100644 (file)
@@ -8,6 +8,7 @@
 ;; Keywords: processes
 
 ;; Changes by peck@sun.com and by rms.
+;; Overhaul by Karoly Lorentey <lorentey@elte.hu> for multi-tty support.
 
 ;; This file is part of GNU Emacs.
 
@@ -41,7 +42,7 @@
 ;; This program transmits the file names to Emacs through
 ;; the server subprocess, and Emacs visits them and lets you edit them.
 
-;; Note that any number of clients may dispatch files to emacs to be edited.
+;; Note that any number of clients may dispatch files to Emacs to be edited.
 
 ;; When you finish editing a Server buffer, again call server-edit
 ;; to mark that buffer as done for the client and switch to the next
 
 (defvar server-clients nil
   "List of current server clients.
-Each element is (CLIENTID BUFFERS...) where CLIENTID is a string
-that can be given to the server process to identify a client.
-When a buffer is marked as \"done\", it is removed from this list.")
+Each element is (PROC PROPERTIES...) where PROC is a process object,
+and PROPERTIES is an association list of client properties.")
 
 (defvar server-buffer-clients nil
   "List of client ids for clients requesting editing of current buffer.")
@@ -161,57 +161,184 @@ are done with it in the server.")
 
 (defvar server-name "server")
 
-(defvar server-socket-dir
-  (format "/tmp/emacs%d" (user-uid)))
+(defvar server-socket-dir nil
+  "The directory in which to place the server socket.
+Initialized by `server-start'.")
+
+(defun server-client (proc)
+  "Return the Emacs client corresponding to PROC.
+PROC must be a process object.
+The car of the result is PROC; the cdr is an association list.
+See `server-client-get' and `server-client-set'."
+  (assq proc server-clients))
+
+(defun server-client-get (client property)
+  "Get the value of PROPERTY in CLIENT.
+CLIENT may be a process object, or a client returned by `server-client'.
+Return nil if CLIENT has no such property."
+  (or (listp client) (setq client (server-client client)))
+  (cdr (assq property (cdr client))))
+
+(defun server-client-set (client property value)
+  "Set the PROPERTY to VALUE in CLIENT, and return VALUE.
+CLIENT may be a process object, or a client returned by `server-client'."
+  (let (p proc)
+    (if (listp client)
+       (setq proc (car client))
+      (setq proc client
+           client (server-client client)))
+    (setq p (assq property client))
+    (cond
+     (p (setcdr p value))
+     (client (setcdr client (cons (cons property value) (cdr client))))
+     (t (setq server-clients
+             `((,proc (,property . ,value)) . ,server-clients))))
+    value))
+
+(defun server-clients-with (property value)
+  "Return a list of clients with PROPERTY set to VALUE."
+  (let (result)
+    (dolist (client server-clients result)
+      (when (equal value (server-client-get client property))
+       (setq result (cons (car client) result))))))
+
+(defun server-add-client (proc)
+  "Create a client for process PROC, if it doesn't already have one.
+New clients have no properties."
+  (unless (server-client proc)
+    (setq server-clients (cons (cons proc nil)
+                              server-clients))))
+
+;;;###autoload
+(defun server-getenv (variable &optional frame)
+  "Get the value of VARIABLE in the client environment of frame FRAME.
+VARIABLE should be a string.  Value is nil if VARIABLE is undefined in
+the environment.  Otherwise, value is a string.
+
+If FRAME is an emacsclient frame, then the variable is looked up
+in the environment of the emacsclient process; otherwise the
+function consults the environment of the Emacs process.
+
+If FRAME is nil or missing, then the selected frame is used."
+  (when (not frame) (setq frame (selected-frame)))
+  (let ((client (frame-parameter frame 'client)) env)
+    (if (null client)
+       (getenv variable)
+      (setq env (server-client-get client 'environment))
+      (if (null env)
+         (getenv variable)
+       (cdr (assoc variable env))))))
+
+(defmacro server-with-client-environment (client vars &rest body)
+  "Evaluate BODY with environment variables VARS set to those of CLIENT.
+The environment variables are then restored to their previous values.
+
+VARS should be a list of strings."
+  (declare (indent 2))
+  (let ((oldvalues (make-symbol "oldvalues"))
+       (var (make-symbol "var"))
+       (value (make-symbol "value"))
+       (pair (make-symbol "pair")))
+    `(let (,oldvalues)
+       (dolist (,var (quote ,vars))
+        (let ((,value (cdr (assoc ,var (server-client-get ,client 'environment)))))
+          (setq ,oldvalues (cons (cons ,var (getenv ,var)) ,oldvalues))
+          (setenv ,var ,value)))
+       (unwind-protect
+          (progn ,@body)
+        (dolist (,pair ,oldvalues)
+          (setenv (car ,pair) (cdr ,pair)))))))
+
+(defun server-delete-client (client &optional noframe)
+  "Delete CLIENT, including its buffers, displays and frames.
+If NOFRAME is non-nil, let the frames live.  (To be used from
+`delete-frame-functions'."
+  ;; Force a new lookup of client (prevents infinite recursion).
+  (setq client (server-client
+               (if (listp client) (car client) client)))
+  (let ((proc (car client))
+       (buffers (server-client-get client 'buffers)))
+    (when client
+      (setq server-clients (delq client server-clients))
+
+      (dolist (buf buffers)
+       (when (buffer-live-p buf)
+         (with-current-buffer buf
+           ;; Remove PROC from the clients of each buffer.
+           (setq server-buffer-clients (delq proc server-buffer-clients))
+           ;; Kill the buffer if necessary.
+           (when (and (null server-buffer-clients)
+                      (or (and server-kill-new-buffers
+                               (not server-existing-buffer))
+                          (server-temp-file-p)))
+             (kill-buffer (current-buffer))))))
+
+      ;; Delete the client's tty.
+      (let ((display-id (server-client-get client 'display)))
+       (when (eq (display-live-p display-id) t)
+         (delete-display display-id)))
+
+      ;; Delete the client's frames.
+      (unless noframe
+       (dolist (frame (frame-list))
+         (if (and (frame-live-p frame)
+                  (equal (car client) (frame-parameter frame 'client)))
+             (delete-frame frame))))
+
+      ;; Delete the client's process.
+      (if (eq (process-status (car client)) 'open)
+         (delete-process (car client)))
+
+      (server-log "Deleted" proc))))
 
 (defun server-log (string &optional client)
-  "If a *server* buffer exists, write STRING to it for logging purposes."
+  "If a *server* buffer exists, write STRING to it for logging purposes.
+If CLIENT is non-nil, add a description of it to the logged
+message."
   (if (get-buffer "*server*")
       (with-current-buffer "*server*"
        (goto-char (point-max))
        (insert (current-time-string)
-               (if client (format " %s:" client) " ")
+               (cond
+                ((null client) " ")
+                ((listp client) (format " %s: " (car client)))
+                (t (format " %s: " client)))
                string)
        (or (bolp) (newline)))))
 
 (defun server-sentinel (proc msg)
-  (let ((client (assq proc server-clients)))
-    ;; Remove PROC from the list of clients.
-    (when client
-      (setq server-clients (delq client server-clients))
-      (dolist (buf (cdr client))
-       (with-current-buffer buf
-         ;; Remove PROC from the clients of each buffer.
-         (setq server-buffer-clients (delq proc server-buffer-clients))
-         ;; Kill the buffer if necessary.
-         (when (and (null server-buffer-clients)
-                    (or (and server-kill-new-buffers
-                             (not server-existing-buffer))
-                        (server-temp-file-p)))
-           (kill-buffer (current-buffer)))))))
-  (server-log (format "Status changed to %s" (process-status proc)) proc))
-
-(defun server-select-display (display)
-  ;; If the current frame is on `display' we're all set.
-  (unless (equal (frame-parameter (selected-frame) 'display) display)
-    ;; Otherwise, look for an existing frame there and select it.
-    (dolist (frame (frame-list))
-      (when (equal (frame-parameter frame 'display) display)
-       (select-frame frame)))
-    ;; If there's no frame on that display yet, create a dummy one
-    ;; and select it.
-    (unless (equal (frame-parameter (selected-frame) 'display) display)
-      (select-frame
-       (make-frame-on-display
-       display
-       ;; This frame is only there in place of an actual "current display"
-       ;; setting, so we want it to be as unobtrusive as possible.  That's
-       ;; what the invisibility is for.  The minibuffer setting is so that
-       ;; we don't end up displaying a buffer in it (which noone would
-       ;; notice).
-       '((visibility . nil) (minibuffer . only)))))))
+  "The process sentinel for Emacs server connections."
+  (server-log (format "Status changed to %s: %s" (process-status proc) msg) proc)
+  (server-delete-client proc))
+
+(defun server-handle-delete-frame (frame)
+  "Delete the client connection when the emacsclient frame is deleted."
+  (let ((proc (frame-parameter frame 'client)))
+    (when (and proc
+              (or (window-system frame)
+                  ;; A terminal display must not yet be deleted if
+                  ;; there are other frames on it.
+                  (< 0 (let ((frame-num 0))
+                         (mapc (lambda (f)
+                                 (when (eq (frame-display f)
+                                           (frame-display frame))
+                                   (setq frame-num (1+ frame-num))))
+                               (frame-list))
+                         frame-num))))
+      (server-log (format "server-handle-delete-frame, frame %s" frame) proc)
+      (server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later.
+
+(defun server-handle-suspend-tty (display)
+  "Notify the emacsclient process to suspend itself when its tty device is suspended."
+  (dolist (proc (server-clients-with 'display display))
+    (server-log (format "server-handle-suspend-tty, display %s" display) proc)
+    (condition-case err
+       (server-send-string proc "-suspend \n")
+      (file-error (condition-case nil (server-delete-client proc) (error nil))))))
 
 (defun server-unquote-arg (arg)
+  "Remove &-quotation from ARG.
+See `server-quote-arg' and `server-process-filter'."
   (replace-regexp-in-string
    "&." (lambda (s)
          (case (aref s 1)
@@ -221,6 +348,26 @@ are done with it in the server.")
            (t " ")))
    arg t t))
 
+(defun server-quote-arg (arg)
+  "In ARG, insert a & before each &, each space, each newline, and -.
+Change spaces to underscores, too, so that the return value never
+contains a space.
+
+See `server-unquote-arg' and `server-process-filter'."
+  (replace-regexp-in-string
+   "[-&\n ]" (lambda (s)
+              (case (aref s 0)
+                (?& "&&")
+                (?- "&-")
+                (?\n "&n")
+                (?\s "&_")))
+   arg t t))
+
+(defun server-send-string (proc string)
+  "A wrapper around `proc-send-string' for logging."
+  (server-log (concat "Sent " string) proc)
+  (process-send-string proc string))
+
 (defun server-ensure-safe-dir (dir)
   "Make sure DIR is a directory with no race-condition issues.
 Creates the directory if necessary and makes sure:
@@ -241,38 +388,53 @@ Creates the directory if necessary and makes sure:
 (defun server-start (&optional leave-dead)
   "Allow this Emacs process to be a server for client processes.
 This starts a server communications subprocess through which
-client \"editors\" can send your editing commands to this Emacs job.
-To use the server, set up the program `emacsclient' in the
+client \"editors\" can send your editing commands to this Emacs
+job.  To use the server, set up the program `emacsclient' in the
 Emacs distribution as your standard \"editor\".
 
-Prefix arg means just kill any existing server communications subprocess."
+Prefix arg LEAVE-DEAD means just kill any existing server
+communications subprocess."
   (interactive "P")
-  ;; Make sure there is a safe directory in which to place the socket.
-  (server-ensure-safe-dir server-socket-dir)
-  ;; kill it dead!
-  (if server-process
-      (condition-case () (delete-process server-process) (error nil)))
-  ;; Delete the socket files made by previous server invocations.
-  (condition-case ()
-      (delete-file (expand-file-name server-name server-socket-dir))
-    (error nil))
-  ;; If this Emacs already had a server, clear out associated status.
-  (while server-clients
-    (let ((buffer (nth 1 (car server-clients))))
-      (server-buffer-done buffer)))
-  (unless leave-dead
+  (when (or
+        (not server-clients)
+        (yes-or-no-p
+         "The current server still has clients; delete them? "))
+    ;; It is safe to get the user id now.
+    (setq server-socket-dir (or server-socket-dir
+                               (format "/tmp/emacs%d" (user-uid))))
+    ;; Make sure there is a safe directory in which to place the socket.
+    (server-ensure-safe-dir server-socket-dir)
+    ;; kill it dead!
     (if server-process
-       (server-log (message "Restarting server")))
-    (letf (((default-file-modes) ?\700))
-      (setq server-process
-           (make-network-process
-            :name "server" :family 'local :server t :noquery t
-            :service (expand-file-name server-name server-socket-dir)
-            :sentinel 'server-sentinel :filter 'server-process-filter
-            ;; We must receive file names without being decoded.
-            ;; Those are decoded by server-process-filter according
-            ;; to file-name-coding-system.
-            :coding 'raw-text)))))
+       (condition-case () (delete-process server-process) (error nil)))
+    ;; Delete the socket files made by previous server invocations.
+    (condition-case ()
+       (delete-file (expand-file-name server-name server-socket-dir))
+      (error nil))
+    ;; If this Emacs already had a server, clear out associated status.
+    (while server-clients
+      (server-delete-client (car server-clients)))
+    (if leave-dead
+       (progn
+         (server-log (message "Server stopped"))
+         (setq server-process nil))
+      (if server-process
+         (server-log (message "Restarting server"))
+       (server-log (message "Starting server")))
+      (letf (((default-file-modes) ?\700))
+       (add-hook 'suspend-tty-functions 'server-handle-suspend-tty)
+       (add-hook 'delete-frame-functions 'server-handle-delete-frame)
+       (add-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)
+       (add-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
+       (setq server-process
+             (make-network-process
+              :name "server" :family 'local :server t :noquery t
+              :service (expand-file-name server-name server-socket-dir)
+              :sentinel 'server-sentinel :filter 'server-process-filter
+              ;; We must receive file names without being decoded.
+              ;; Those are decoded by server-process-filter according
+              ;; to file-name-coding-system.
+              :coding 'raw-text))))))
 
 ;;;###autoload
 (define-minor-mode server-mode
@@ -289,105 +451,334 @@ Server mode runs a process that accepts commands from the
 \f
 (defun server-process-filter (proc string)
   "Process a request from the server to edit some files.
-PROC is the server process.  Format of STRING is \"PATH PATH PATH... \\n\"."
-  (server-log string proc)
+PROC is the server process.  STRING consists of a sequence of
+commands prefixed by a dash.  Some commands have arguments; these
+are &-quoted and need to be decoded by `server-unquote-arg'.  The
+filter parses and executes these commands.
+
+To illustrate the protocol, here is an example command that
+emacsclient sends to create a new X frame (note that the whole
+sequence is sent on a single line):
+
+       -version 21.3.50 xterm
+       -env HOME /home/lorentey
+       -env DISPLAY :0.0
+       ... lots of other -env commands
+       -display :0.0
+       -window-system
+
+The server normally sends back the single command `-good-version'
+as a response.
+
+The following commands are accepted by the server:
+
+`-version CLIENT-VERSION'
+  Check version numbers between server and client, and signal an
+  error if there is a mismatch.  The server replies with
+  `-good-version' to confirm the match.
+
+`-env NAME VALUE'
+  An environment variable on the client side.
+
+`-nowait'
+  Request that the next frame created should not be
+  associated with this client.
+
+`-display DISPLAY'
+  Set the display name to open X frames on.
+
+`-position LINE[:COLUMN]'
+  Go to the given line and column number
+  in the next file opened.
+
+`-file FILENAME'
+  Load the given file in the current frame.
+
+`-eval EXPR'
+  Evaluate EXPR as a Lisp expression and return the
+  result in -print commands.
+
+`-window-system'
+  Open a new X frame.
+
+`-tty DEVICENAME TYPE'
+  Open a new tty frame at the client.
+
+`-resume'
+  Resume this tty frame. The client sends this string when it
+  gets the SIGCONT signal and it is the foreground process on its
+  controlling tty.
+
+`-suspend'
+  Suspend this tty frame.  The client sends this string in
+  response to SIGTSTP and SIGTTOU.  The server must cease all I/O
+  on this tty until it gets a -resume command.
+
+`-ignore COMMENT'
+  Do nothing, but put the comment in the server
+  log.  Useful for debugging.
+
+
+The following commands are accepted by the client:
+
+`-good-version'
+  Signals a version match between the client and the server.
+
+`-emacs-pid PID'
+  Describes the process id of the Emacs process;
+  used to forward window change signals to it.
+
+`-window-system-unsupported'
+  Signals that the server does not
+  support creating X frames; the client must try again with a tty
+  frame.
+
+`-print STRING'
+  Print STRING on stdout.  Used to send values
+  returned by -eval.
+
+`-error DESCRIPTION'
+  Signal an error (but continue processing).
+
+`-suspend'
+  Suspend this terminal, i.e., stop the client process.  Sent
+  when the user presses C-z."
+  (server-log (concat "Received " string) proc)
   (let ((prev (process-get proc 'previous-string)))
     (when prev
       (setq string (concat prev string))
       (process-put proc 'previous-string nil)))
-  ;; If the input is multiple lines,
-  ;; process each line individually.
-  (while (string-match "\n" string)
-    (let ((request (substring string 0 (match-beginning 0)))
-         (coding-system (and default-enable-multibyte-characters
-                             (or file-name-coding-system
-                                 default-file-name-coding-system)))
-         client nowait eval
-         (files nil)
-         (lineno 1)
-         (tmp-frame nil) ; Sometimes used to embody the selected display.
-         (columnno 0))
-      ;; Remove this line from STRING.
-      (setq string (substring string (match-end 0)))
-      (setq client (cons proc nil))
-      (while (string-match "[^ ]* " request)
-       (let ((arg (substring request (match-beginning 0) (1- (match-end 0)))))
-         (setq request (substring request (match-end 0)))
-         (cond
-          ((equal "-nowait" arg) (setq nowait t))
-          ((equal "-eval" arg) (setq eval t))
-          ((and (equal "-display" arg) (string-match "\\([^ ]*\\) " request))
-           (let ((display (server-unquote-arg (match-string 1 request))))
-             (setq request (substring request (match-end 0)))
-             (condition-case err
-                 (setq tmp-frame (server-select-display display))
-               (error (process-send-string proc (nth 1 err))
-                      (setq request "")))))
-          ;; ARG is a line number option.
-          ((string-match "\\`\\+[0-9]+\\'" arg)
-           (setq lineno (string-to-number (substring arg 1))))
-          ;; ARG is line number:column option.
-          ((string-match "\\`+\\([0-9]+\\):\\([0-9]+\\)\\'" arg)
-           (setq lineno (string-to-number (match-string 1 arg))
-                 columnno (string-to-number (match-string 2 arg))))
-          (t
-           ;; Undo the quoting that emacsclient does
-           ;; for certain special characters.
-           (setq arg (server-unquote-arg arg))
-           ;; Now decode the file name if necessary.
-           (if coding-system
-               (setq arg (decode-coding-string arg coding-system)))
-           (if eval
-               (let ((v (eval (car (read-from-string arg)))))
-                 (when v
-                   (with-temp-buffer
-                     (let ((standard-output (current-buffer)))
-                       (pp v)
-                       ;; Suppress the error rose when the pipe to PROC is closed.
-                       (condition-case err
-                           (process-send-region proc (point-min) (point-max))
-                         (file-error nil)
-                         (error nil))
-                       ))))
-             ;; ARG is a file name.
-             ;; Collapse multiple slashes to single slashes.
-             (setq arg (command-line-normalize-file-name arg))
-             (push (list arg lineno columnno) files))
-           (setq lineno 1)
-           (setq columnno 0)))))
-      (when files
-       (run-hooks 'pre-command-hook)
-       (server-visit-files files client nowait)
-       (run-hooks 'post-command-hook))
-      ;; CLIENT is now a list (CLIENTNUM BUFFERS...)
-      (if (null (cdr client))
-         ;; This client is empty; get rid of it immediately.
-         (progn
-           (delete-process proc)
-           (server-log "Close empty client" proc))
-       ;; We visited some buffer for this client.
-       (or nowait (push client server-clients))
-       (unless (or isearch-mode (minibufferp))
-         (server-switch-buffer (nth 1 client))
-         (run-hooks 'server-switch-hook)
-         (unless nowait
-           (message (substitute-command-keys
-                     "When done with a buffer, type \\[server-edit]")))))
-      ;; Avoid preserving the connection after the last real frame is deleted.
-      (if tmp-frame (delete-frame tmp-frame))))
-  ;; Save for later any partial line that remains.
-  (when (> (length string) 0)
-    (process-put proc 'previous-string string)))
+  (condition-case err
+      (progn
+       (server-add-client proc)
+       ;; If the input is multiple lines,
+       ;; process each line individually.
+       (while (string-match "\n" string)
+         (let ((request (substring string 0 (match-beginning 0)))
+               (coding-system (and default-enable-multibyte-characters
+                                   (or file-name-coding-system
+                                       default-file-name-coding-system)))
+               (client (server-client proc))
+               nowait ; t if emacsclient does not want to wait for us.
+               frame ; The frame that was opened for the client (if any).
+               display ; Open the frame on this display.
+               dontkill       ; t if the client should not be killed.
+               (files nil)
+               (lineno 1)
+               (columnno 0))
+           ;; Remove this line from STRING.
+           (setq string (substring string (match-end 0)))
+           (while (string-match " *[^ ]* " request)
+             (let ((arg (substring request (match-beginning 0) (1- (match-end 0)))))
+               (setq request (substring request (match-end 0)))
+               (cond
+                ;; -version CLIENT-VERSION:
+                ;; Check version numbers, signal an error if there is a mismatch.
+                ((and (equal "-version" arg)
+                      (string-match "\\([0-9.]+\\) " request))
+                 (let* ((client-version (match-string 1 request))
+                        (truncated-emacs-version
+                         (substring emacs-version 0 (length client-version))))
+                   (setq request (substring request (match-end 0)))
+                   (if (equal client-version truncated-emacs-version)
+                       (progn
+                         (server-send-string proc "-good-version \n")
+                         (server-client-set client 'version client-version))
+                     (error (concat "Version mismatch: Emacs is "
+                                    truncated-emacs-version
+                                    ", emacsclient is " client-version)))))
+
+                ;; -nowait:  Emacsclient won't wait for a result.
+                ((equal "-nowait" arg) (setq nowait t))
+
+                ;; -display DISPLAY:
+                ;; Open X frames on the given instead of the default.
+                ((and (equal "-display" arg) (string-match "\\([^ ]*\\) " request))
+                 (setq display (match-string 1 request)
+                       request (substring request (match-end 0))))
+
+                ;; -window-system:  Open a new X frame.
+                ((equal "-window-system" arg)
+                 (unless (server-client-get client 'version)
+                   (error "Protocol error; make sure to use the correct version of emacsclient"))
+                 (if (fboundp 'x-create-frame)
+                     (progn
+                       (setq frame (make-frame-on-display
+                                    (or display
+                                        (frame-parameter nil 'display)
+                                        (getenv "DISPLAY")
+                                        (error "Please specify display"))
+                                    (list (cons 'client proc))))
+                       ;; XXX We need to ensure the client parameter is
+                       ;; really set because Emacs forgets initialization
+                       ;; parameters for X frames at the moment.
+                       (modify-frame-parameters frame (list (cons 'client proc)))
+                       (select-frame frame)
+                       (server-client-set client 'frame frame)
+                       (server-client-set client 'display (frame-display frame))
+                       (setq dontkill t))
+                   ;; This emacs does not support X.
+                   (server-log "Window system unsupported" proc)
+                   (server-send-string proc "-window-system-unsupported \n")
+                   (setq dontkill t)))
+
+                ;; -resume:  Resume a suspended tty frame.
+                ((equal "-resume" arg)
+                 (let ((display-id (server-client-get client 'display)))
+                   (setq dontkill t)
+                   (when (eq (display-live-p display-id) t)
+                     (resume-tty display-id))))
+
+                ;; -suspend:  Suspend the client's frame.  (In case we
+                ;; get out of sync, and a C-z sends a SIGTSTP to
+                ;; emacsclient.)
+                ((equal "-suspend" arg)
+                 (let ((display-id (server-client-get client 'display)))
+                   (setq dontkill t)
+                   (when (eq (display-live-p display-id) t)
+                     (suspend-tty display-id))))
+
+                ;; -ignore COMMENT:  Noop; useful for debugging emacsclient.
+                ;; (The given comment appears in the server log.)
+                ((and (equal "-ignore" arg) (string-match "\\([^ ]*\\) " request))
+                 (setq dontkill t
+                       request (substring request (match-end 0))))
+
+                ;; -tty DEVICE-NAME TYPE:  Open a new tty frame at the client.
+                ((and (equal "-tty" arg) (string-match "\\([^ ]*\\) \\([^ ]*\\) " request))
+                 (let ((tty (server-unquote-arg (match-string 1 request)))
+                       (type (server-unquote-arg (match-string 2 request))))
+                   (setq request (substring request (match-end 0)))
+                   (unless (server-client-get client 'version)
+                     (error "Protocol error; make sure you use the correct version of emacsclient"))
+                   (server-with-client-environment proc
+                       ("LANG" "LC_CTYPE" "LC_ALL"
+                        ;; For tgetent(3); list according to ncurses(3).
+                        "BAUDRATE" "COLUMNS" "ESCDELAY" "HOME" "LINES"
+                        "NCURSES_ASSUMED_COLORS" "NCURSES_NO_PADDING"
+                        "NCURSES_NO_SETBUF" "TERM" "TERMCAP" "TERMINFO"
+                        "TERMINFO_DIRS" "TERMPATH")
+                     (setq frame (make-frame-on-tty tty type
+                                                    `((client . ,proc)))))
+                   (select-frame frame)
+                   (server-client-set client 'frame frame)
+                   (server-client-set client 'tty (display-name frame))
+                   (server-client-set client 'display (frame-display frame))
+
+                   ;; Reply with our pid.
+                   (server-send-string proc (concat "-emacs-pid " (number-to-string (emacs-pid)) "\n"))
+                   (setq dontkill t)))
+
+                ;; -position LINE:  Go to the given line in the next file.
+                ((and (equal "-position" arg) (string-match "\\(\\+[0-9]+\\) " request))
+                 (setq request (substring request (match-end 0))
+                       lineno (string-to-number (substring (match-string 1 request) 1))))
+
+                ;; -position LINE:COLUMN:  Set point to the given position in the next file.
+                ((and (equal "-position" arg) (string-match "\\+\\([0-9]+\\):\\([0-9]+\\) " request))
+                 (setq lineno (string-to-number (match-string 1 request))
+                       columnno (string-to-number (match-string 2 request))
+                       request (substring request (match-end 0))))
+
+                ;; -file FILENAME:  Load the given file.
+                ((and (equal "-file" arg) (string-match "\\([^ ]+\\) " request))
+                 (let ((file (server-unquote-arg (match-string 1 request))))
+                   (setq request (substring request (match-end 0)))
+                   (if coding-system
+                       (setq file (decode-coding-string file coding-system)))
+                   (setq file (command-line-normalize-file-name file))
+                   (push (list file lineno columnno) files))
+                 (setq lineno 1
+                       columnno 0))
+
+                ;; -eval EXPR:  Evaluate a Lisp expression.
+                ((and (equal "-eval" arg) (string-match "\\([^ ]+\\) " request))
+                 (let ((expr (server-unquote-arg (match-string 1 request))))
+                   (setq request (substring request (match-end 0)))
+                   (if coding-system
+                       (setq expr (decode-coding-string expr coding-system)))
+                   (let ((v (eval (car (read-from-string expr)))))
+                     (when (and (not frame) v)
+                       (with-temp-buffer
+                         (let ((standard-output (current-buffer)))
+                           (pp v)
+                           (server-send-string
+                            proc (format "-print %s\n"
+                                         (server-quote-arg
+                                          (buffer-substring-no-properties (point-min)
+                                                                          (point-max)))))))))
+                   (setq lineno 1
+                         columnno 0)))
+
+                ;; -env NAME VALUE:  An environment variable.
+                ((and (equal "-env" arg) (string-match "\\([^ ]+\\) \\([^ ]+\\) " request))
+                 (let ((name (server-unquote-arg (match-string 1 request)))
+                       (value (server-unquote-arg (match-string 2 request))))
+                   (when coding-system
+                       (setq name (decode-coding-string name coding-system))
+                       (setq value (decode-coding-string value coding-system)))
+                   (setq request (substring request (match-end 0)))
+                   (server-client-set
+                    client 'environment
+                    (cons (cons name value)
+                          (server-client-get client 'environment)))))
+
+                ;; Unknown command.
+                (t (error "Unknown command: %s" arg)))))
+
+           (let (buffers)
+             (when files
+               (run-hooks 'pre-command-hook)
+               (setq buffers (server-visit-files files client nowait))
+               (run-hooks 'post-command-hook))
+
+             ;; Delete the client if necessary.
+             (cond
+              (nowait
+               ;; Client requested nowait; return immediately.
+               (server-log "Close nowait client" proc)
+               (server-delete-client proc))
+              ((and (not dontkill) (null buffers))
+               ;; This client is empty; get rid of it immediately.
+               (server-log "Close empty client" proc)
+               (server-delete-client proc)))
+             (cond
+              ((or isearch-mode (minibufferp))
+               nil)
+              ((and frame (null buffers))
+               (message (substitute-command-keys
+                         "When done with this frame, type \\[delete-frame]")))
+              ((not (null buffers))
+               (server-switch-buffer (car buffers))
+               (run-hooks 'server-switch-hook)
+               (unless nowait
+                 (message (substitute-command-keys
+                           "When done with a buffer, type \\[server-edit]"))))))))
+
+       ;; Save for later any partial line that remains.
+       (when (> (length string) 0)
+         (process-put proc 'previous-string string)))
+    ;; condition-case
+    (error (ignore-errors
+            (server-send-string
+             proc (concat "-error " (server-quote-arg (error-message-string err))))
+            (setq string "")
+            (server-log (error-message-string err) proc)
+            (delete-process proc)))))
 
 (defun server-goto-line-column (file-line-col)
+  "Move point to the position indicated in FILE-LINE-COL.
+FILE-LINE-COL should be a three-element list as described in
+`server-visit-files'."
   (goto-line (nth 1 file-line-col))
   (let ((column-number (nth 2 file-line-col)))
     (if (> column-number 0)
        (move-to-column (1- column-number)))))
 
 (defun server-visit-files (files client &optional nowait)
-  "Find FILES and return the list CLIENT with the buffers nconc'd.
+  "Find FILES and return a list of buffers created.
 FILES is an alist whose elements are (FILENAME LINENUMBER COLUMNNUMBER).
+CLIENT is the client that requested this operation.
 NOWAIT non-nil means this client is not waiting for the results,
 so don't mark these buffers specially, just visit them normally."
   ;; Bind last-nonmenu-event to force use of keyboard, not mouse, for queries.
@@ -410,8 +801,7 @@ so don't mark these buffers specially, just visit them normally."
                           (revert-buffer t nil)))
                      (t
                       (if (y-or-n-p
-                           (concat "File no longer exists: "
-                                   filen
+                           (concat "File no longer exists: " filen
                                    ", write buffer to file? "))
                           (write-file filen))))
                (setq server-existing-buffer t)
@@ -424,7 +814,11 @@ so don't mark these buffers specially, just visit them normally."
          (add-hook 'kill-buffer-hook 'server-kill-buffer nil t)
          (push (car client) server-buffer-clients))
        (push (current-buffer) client-record)))
-    (nconc client client-record)))
+    (unless nowait
+      (server-client-set
+       client 'buffers
+       (nconc (server-client-get client 'buffers) client-record)))
+    client-record))
 \f
 (defun server-buffer-done (buffer &optional for-killing)
   "Mark BUFFER as \"done\" for its client(s).
@@ -434,27 +828,24 @@ or nil.  KILLED is t if we killed BUFFER (typically, because it was visiting
 a temp file).
 FOR-KILLING if non-nil indicates that we are called from `kill-buffer'."
   (let ((next-buffer nil)
-       (killed nil)
-       (old-clients server-clients))
-    (while old-clients
-      (let ((client (car old-clients)))
+       (killed nil))
+    (dolist (client server-clients)
+      (let ((buffers (server-client-get client 'buffers)))
        (or next-buffer
-           (setq next-buffer (nth 1 (memq buffer client))))
-       (delq buffer client)
-       ;; Delete all dead buffers from CLIENT.
-       (let ((tail client))
-         (while tail
-           (and (bufferp (car tail))
-                (null (buffer-name (car tail)))
-                (delq (car tail) client))
-           (setq tail (cdr tail))))
-       ;; If client now has no pending buffers,
-       ;; tell it that it is done, and forget it entirely.
-       (unless (cdr client)
-         (delete-process (car client))
-         (server-log "Close" (car client))
-         (setq server-clients (delq client server-clients))))
-      (setq old-clients (cdr old-clients)))
+           (setq next-buffer (nth 1 (memq buffer buffers))))
+       (when buffers                   ; Ignore bufferless clients.
+         (setq buffers (delq buffer buffers))
+         ;; Delete all dead buffers from CLIENT.
+         (dolist (b buffers)
+           (and (bufferp b)
+                (not (buffer-live-p b))
+                (setq buffers (delq b buffers))))
+         (server-client-set client 'buffers buffers)
+         ;; If client now has no pending buffers,
+         ;; tell it that it is done, and forget it entirely.
+         (unless buffers
+           (server-log "Close" client)
+           (server-delete-client client)))))
     (if (and (bufferp buffer) (buffer-name buffer))
        ;; We may or may not kill this buffer;
        ;; if we do, do not call server-buffer-done recursively
@@ -519,30 +910,32 @@ specifically for the clients and did not exist before their request for it."
 ;; but I think that is dangerous--the client would proceed
 ;; using whatever is on disk in that file. -- rms.
 (defun server-kill-buffer-query-function ()
+  "Ask before killing a server buffer."
   (or (not server-buffer-clients)
+      (let ((res t))
+       (dolist (proc server-buffer-clients res)
+         (let ((client (server-client proc)))
+           (when (and client (eq (process-status proc) 'open))
+             (setq res nil)))))
       (yes-or-no-p (format "Buffer `%s' still has clients; kill it? "
                           (buffer-name (current-buffer))))))
 
-(add-hook 'kill-buffer-query-functions
-         'server-kill-buffer-query-function)
-
 (defun server-kill-emacs-query-function ()
-  (let (live-client
-       (tail server-clients))
-    ;; See if any clients have any buffers that are still alive.
-    (while tail
-      (if (memq t (mapcar 'stringp (mapcar 'buffer-name (cdr (car tail)))))
-         (setq live-client t))
-      (setq tail (cdr tail)))
-    (or (not live-client)
-       (yes-or-no-p "Server buffers still have clients; exit anyway? "))))
-
-(add-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
+  "Ask before exiting Emacs it has live clients."
+  (or (not server-clients)
+      (let (live-client)
+       (dolist (client server-clients live-client)
+         (if (memq t (mapcar 'buffer-live-p (server-client-get
+                                             client 'buffers)))
+             (setq live-client t))))
+      (yes-or-no-p "This Emacs session has clients; exit anyway? ")))
 
 (defvar server-kill-buffer-running nil
   "Non-nil while `server-kill-buffer' or `server-buffer-done' is running.")
 
 (defun server-kill-buffer ()
+  "Remove the current buffer from its clients' buffer list.
+Designed to be added to `kill-buffer-hook'."
   ;; Prevent infinite recursion if user has made server-done-hook
   ;; call kill-buffer.
   (or server-kill-buffer-running
@@ -574,18 +967,26 @@ starts server process and that is all.  Invoked by \\[server-edit]."
 
 (defun server-switch-buffer (&optional next-buffer killed-one)
   "Switch to another buffer, preferably one that has a client.
-Arg NEXT-BUFFER is a suggestion; if it is a live buffer, use it."
-  ;; KILLED-ONE is t in a recursive call
-  ;; if we have already killed one temp-file server buffer.
-  ;; This means we should avoid the final "switch to some other buffer"
-  ;; since we've already effectively done that.
+Arg NEXT-BUFFER is a suggestion; if it is a live buffer, use it.
+
+KILLED-ONE is t in a recursive call if we have already killed one
+temp-file server buffer.  This means we should avoid the final
+\"switch to some other buffer\" since we've already effectively
+done that."
   (if (null next-buffer)
-      (if server-clients
-         (server-switch-buffer (nth 1 (car server-clients)) killed-one)
-       (unless (or killed-one (window-dedicated-p (selected-window)))
-         (switch-to-buffer (other-buffer))
+      (progn
+       (let ((rest server-clients))
+         (while (and rest (not next-buffer))
+           (let ((client (car rest)))
+             ;; Only look at frameless clients.
+             (when (not (server-client-get client 'frame))
+               (setq next-buffer (car (server-client-get client 'buffers))))
+             (setq rest (cdr rest)))))
+       (and next-buffer (server-switch-buffer next-buffer killed-one))
+       (unless (or next-buffer killed-one (window-dedicated-p (selected-window)))
+         ;; (switch-to-buffer (other-buffer))
          (message "No server buffers remain to edit")))
-    (if (not (buffer-name next-buffer))
+    (if (not (buffer-live-p next-buffer))
        ;; If NEXT-BUFFER is a dead buffer, remove the server records for it
        ;; and try the next surviving server buffer.
        (apply 'server-switch-buffer (server-buffer-done next-buffer))
@@ -625,10 +1026,35 @@ Arg NEXT-BUFFER is a suggestion; if it is a live buffer, use it."
              ;; a minibuffer/dedicated-window (if there's no other).
              (error (pop-to-buffer next-buffer)))))))))
 
+(defun server-save-buffers-kill-display (&optional arg)
+  "Offer to save each buffer, then kill the current connection.
+If the current frame has no client, kill Emacs itself.
+
+With prefix arg, silently save all file-visiting buffers, then kill.
+
+If emacsclient was started with a list of filenames to edit, then
+only these files will be asked to be saved."
+  (interactive "P")
+  (let ((proc (frame-parameter (selected-frame) 'client)))
+    (if proc
+       (let ((buffers (server-client-get proc 'buffers)))
+         ;; If client is bufferless, emulate a normal Emacs session
+         ;; exit and offer to save all buffers.  Otherwise, offer to
+         ;; save only the buffers belonging to the client.
+         (save-some-buffers arg
+                            (if buffers
+                                (lambda () (memq (current-buffer) buffers))
+                              t))
+         (server-delete-client proc))
+      (save-buffers-kill-emacs))))
+
 (global-set-key "\C-x#" 'server-edit)
 
 (defun server-unload-hook ()
+  "Unload the server library."
   (server-start t)
+  (remove-hook 'suspend-tty-functions 'server-handle-suspend-tty)
+  (remove-hook 'delete-frame-functions 'server-handle-delete-frame)
   (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)
   (remove-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
   (remove-hook 'kill-buffer-hook 'server-kill-buffer))
index b5e7d188695d1cb9be55c9ea8c885d462d9305d6..865ae05fb75ec1931a743919a1a1997e7b215a0f 100644 (file)
@@ -2281,6 +2281,8 @@ the text which should be made available.
 The second, optional, argument PUSH, has the same meaning as the
 similar argument to `x-set-cut-buffer', which see.")
 
+(make-variable-frame-local 'interprogram-cut-function)
+
 (defvar interprogram-paste-function nil
   "Function to call to get text cut from other programs.
 
@@ -2301,6 +2303,8 @@ most recent string, the function should return nil.  If it is
 difficult to tell whether Emacs or some other program provided the
 current string, it is probably good enough to return nil if the string
 is equal (according to `string=') to the last text Emacs provided.")
+
+(make-variable-frame-local 'interprogram-paste-function)
 \f
 
 
@@ -5180,14 +5184,14 @@ the front of the list of recently selected ones."
 (defcustom normal-erase-is-backspace
   (and (not noninteractive)
        (or (memq system-type '(ms-dos windows-nt))
-          (eq window-system 'mac)
-          (and (memq window-system '(x))
+          (eq initial-window-system 'mac)
+          (and (memq initial-window-system '(x))
                (fboundp 'x-backspace-delete-keys-p)
                (x-backspace-delete-keys-p))
           ;; If the terminal Emacs is running on has erase char
           ;; set to ^H, use the Backspace key for deleting
           ;; backward and, and the Delete key for deleting forward.
-          (and (null window-system)
+          (and (null initial-window-system)
                (eq tty-erase-char ?\^H))))
   "If non-nil, Delete key deletes forward and Backspace key deletes backward.
 
index 83b8729e2022c07287cff1475aee6f8d45bc2242..2340711a98b224887368f64564c3d2bb622674e9 100644 (file)
 (defvar command-line-processed nil
   "Non-nil once command line has been processed.")
 
+(defvar window-system initial-window-system
+  "Name of window system the selected frame is displaying through.
+The value is a symbol--for instance, `x' for X windows.
+The value is nil if the selected frame is on a text-only-terminal.")
+
+(make-variable-frame-local 'window-system)
+
 (defgroup initialization nil
   "Emacs start-up procedure."
   :group 'internal)
@@ -434,36 +441,19 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
        ;; for instance due to a dense colormap.
        (when (or frame-initial-frame
                  ;; If frame-initial-frame has no meaning, do this anyway.
-                 (not (and window-system
+                 (not (and initial-window-system
                            (not noninteractive)
-                           (not (eq window-system 'pc)))))
+                           (not (eq initial-window-system 'pc)))))
          ;; Modify the initial frame based on what .emacs puts into
          ;; ...-frame-alist.
          (if (fboundp 'frame-notice-user-settings)
              (frame-notice-user-settings))
+         ;; Set the faces for the initial background mode even if
+         ;; frame-notice-user-settings didn't (such as on a tty).
+         ;; frame-set-background-mode is idempotent, so it won't
+         ;; cause any harm if it's already been done.
          (if (fboundp 'frame-set-background-mode)
-             ;; Set the faces for the initial background mode even if
-             ;; frame-notice-user-settings didn't (such as on a tty).
-             ;; frame-set-background-mode is idempotent, so it won't
-             ;; cause any harm if it's already been done.
-             (let ((frame (selected-frame))
-                   term)
-               (when (and (null window-system)
-                          ;; Don't override default set by files in lisp/term.
-                          (null default-frame-background-mode)
-                          (let ((bg (frame-parameter frame 'background-color)))
-                            (or (null bg)
-                                (member bg '(unspecified "unspecified-bg"
-                                                         "unspecified-fg")))))
-
-                 (setq term (getenv "TERM"))
-                 ;; Some files in lisp/term do a better job with the
-                 ;; background mode, but we leave this here anyway, in
-                 ;; case they remove those files.
-                 (if (string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)"
-                                   term)
-                     (setq default-frame-background-mode 'light)))
-               (frame-set-background-mode (selected-frame)))))
+             (frame-set-background-mode (selected-frame))))
 
        ;; Now we know the user's default font, so add it to the menu.
        (if (fboundp 'font-menu-add-default)
@@ -504,6 +494,20 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
 (defvar tool-bar-originally-present nil
   "Non-nil if tool-bars are present before user and site init files are read.")
 
+(defvar handle-args-function-alist '((nil . tty-handle-args))
+  "Functions for processing window-system dependent command-line arguments.
+Window system startup files should add their own function to this
+alist, which should parse the command line arguments.  Those
+pertaining to the window system should be processed and removed
+from the returned command line.")
+
+(defvar window-system-initialization-alist '((nil . ignore))
+  "Alist of window-system initialization functions.
+Window-system startup files should add their own initialization
+function to this list.  The function should take no arguments,
+and initialize the window system environment to prepare for
+opening the first frame (e.g. open a connection to an X server).")
+
 ;; Handle the X-like command-line arguments "-fg", "-bg", "-name", etc.
 (defun tty-handle-args (args)
   (let (rest)
@@ -608,16 +612,22 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
     (setq eol-mnemonic-dos  "(DOS)"
           eol-mnemonic-mac  "(Mac)")))
 
-  ;; Read window system's init file if using a window system.
+  ;; Make sure window system's init file was loaded in loadup.el if using a window system.
   (condition-case error
-      (if (and window-system (not noninteractive))
-         (load (concat term-file-prefix
-                       (symbol-name window-system)
-                       "-win")
-               ;; Every window system should have a startup file;
-               ;; barf if we can't find it.
-               nil t))
-    ;; If we can't read it, print the error message and exit.
+    (unless noninteractive
+      (if (and initial-window-system
+              (not (featurep
+                    (intern (concat (symbol-name initial-window-system) "-win")))))
+         (error "Unsupported window system `%s'" initial-window-system))
+      ;; Process window-system specific command line parameters.
+      (setq command-line-args
+           (funcall (or (cdr (assq initial-window-system handle-args-function-alist))
+                        (error "Unsupported window system `%s'" initial-window-system))
+                    command-line-args))
+      ;; Initialize the window system. (Open connection, etc.)
+      (funcall (or (cdr (assq initial-window-system window-system-initialization-alist))
+                  (error "Unsupported window system `%s'" initial-window-system))))
+    ;; If there was an error, print the error message and exit.
     (error
      (princ
       (if (eq (car error) 'error)
@@ -633,13 +643,9 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
                              (cdr error) ", "))))
       'external-debugging-output)
      (terpri 'external-debugging-output)
-     (setq window-system nil)
+     (setq initial-window-system nil)
      (kill-emacs)))
 
-  ;; Windowed displays do this inside their *-win.el.
-  (unless (or (display-graphic-p) noninteractive)
-    (setq command-line-args (tty-handle-args command-line-args)))
-
   (set-locale-environment nil)
 
   ;; Convert the arguments to Emacs internal representation.
@@ -737,7 +743,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
   ;; If frame was created with a menu bar, set menu-bar-mode on.
   (unless (or noninteractive
              emacs-basic-display
-              (and (memq window-system '(x w32))
+              (and (memq initial-window-system '(x w32))
                    (<= (frame-parameter nil 'menu-bar-lines) 0)))
     (menu-bar-mode 1))
 
@@ -764,11 +770,10 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
 
   ;; Register default TTY colors for the case the terminal hasn't a
   ;; terminal init file.
-  (unless (memq window-system '(x w32))
-    ;; We do this regardles of whether the terminal supports colors
-    ;; or not, since they can switch that support on or off in
-    ;; mid-session by setting the tty-color-mode frame parameter.
-    (tty-register-default-colors))
+  ;; We do this regardles of whether the terminal supports colors
+  ;; or not, since they can switch that support on or off in
+  ;; mid-session by setting the tty-color-mode frame parameter.
+  (tty-register-default-colors)
 
   ;; Record whether the tool-bar is present before the user and site
   ;; init files are processed.  frame-notice-user-settings uses this
@@ -982,7 +987,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
   ;; Load library for our terminal type.
   ;; User init file can set term-file-prefix to nil to prevent this.
   (unless (or noninteractive
-              window-system
+              initial-window-system
               (null term-file-prefix))
     (let ((term (getenv "TERM"))
           hyphend)
index c0405f46011a3571c6233579ffc2dfad3e01e316..1072545b41df9b976937b5176d133ac241c7a8a7 100644 (file)
@@ -1752,6 +1752,18 @@ See also `with-temp-buffer'."
         (if (window-live-p save-selected-window-window)
             (select-window save-selected-window-window 'norecord))))))
 
+(defmacro with-selected-frame (frame &rest body)
+  "Execute the forms in BODY with FRAME as the selected frame.
+The value returned is the value of the last form in BODY.
+See also `with-temp-buffer'."
+  (declare (indent 1) (debug t))
+  `(let ((save-selected-frame (selected-frame)))
+     (unwind-protect
+        (progn (select-frame ,frame)
+               ,@body)
+       (if (frame-live-p save-selected-frame)
+          (select-frame save-selected-frame)))))
+
 (defmacro with-temp-file (file &rest body)
   "Create a new buffer, evaluate BODY there, and write the buffer to FILE.
 The value returned is the value of the last form in BODY.
index d2436e59ff2c389d6ed62b2c20e28b70a1221200..771beff68258322644c4b5c7ebf25374a27808c2 100644 (file)
@@ -45,17 +45,44 @@ Each element has the form (DISPLAY FRAME BUFFER).")
   ;; Add the new buffers to all talk frames.
   (talk-update-buffers))
 
-(defun talk-add-display (display)
-  (let* ((elt (assoc display talk-display-alist))
-        (name (concat "*talk-" display "*"))
-        buffer frame)
-    (if (not (and elt (frame-live-p (setq frame (nth 1 elt)))))
-       (setq frame (make-frame-on-display display (list (cons 'name name)))))
+;;;###autoload
+(defun talk ()
+  "Connect to the Emacs talk group from the current X display or tty frame."
+  (interactive)
+  (let ((type (frame-live-p (selected-frame)))
+       (display (frame-display (selected-frame))))
+    (cond
+     ((eq type t)
+      (talk-add-display (selected-frame)))
+     ((eq type 'x)
+      (talk-add-display (frame-display (selected-frame))))
+     (t
+      (error "Unknown frame type"))))
+  (talk-update-buffers))
+
+(defun talk-add-display (frame)
+  (let* ((display (if (frame-live-p frame)
+                     (frame-display frame)
+                   frame))
+        (elt (assoc display talk-display-alist))
+        (name (concat "*talk-" (display-name display) "*"))
+        buffer)
+    (unless (frame-live-p frame)
+      (setq frame (make-frame-on-display display (list (cons 'name name)))))
+    (if (and elt (frame-live-p (nth 1 elt)))
+       (setq frame (nth 1 elt)))
     (if (not (and elt (buffer-name (get-buffer (setq buffer (nth 2 elt))))))
        (setq buffer (get-buffer-create name)))
+    (add-to-list 'delete-frame-functions 'talk-handle-delete-frame)
     (setq talk-display-alist
          (cons (list display frame buffer) (delq elt talk-display-alist)))))
 
+(defun talk-handle-delete-frame (frame)
+  (dolist (d talk-display-alist)
+    (when (eq (nth 1 d) frame)
+      (setq talk-display-alist (delq d talk-display-alist))
+      (talk-update-buffers))))
+
 (defun talk-disconnect ()
   "Disconnect this display from the Emacs talk group."
   (interactive)
index 8b239a706efeee772805e48f0b3bc9d0e7c9ccc2..6ab8cd9dea9885197dc777fe127ec9509cb63f18 100644 (file)
@@ -31,7 +31,7 @@
 (if (boundp 'AT386-keypad-map)
     nil
   ;; The terminal initialization should already have set up some keys
-  (setq AT386-keypad-map (lookup-key function-key-map "\e["))
+  (setq AT386-keypad-map (lookup-key (terminal-local-value 'function-key-map nil) "\e["))
   (if (not (keymapp AT386-keypad-map))
       (error "What?  Your AT386 termcap/terminfo has no keycaps in it"))
 
@@ -54,7 +54,7 @@
   (define-key AT386-keypad-map "T" [kp-add])
 
   ;; Arrange for the ALT key to be equivalent to ESC
-  (define-key function-key-map "\eN" [27]) ; ALT map
+  (define-key (terminal-local-value 'function-key-map nil) "\eN" [27]) ; ALT map
   )
 
 ;;; arch-tag: abec1b03-582f-49f8-b8cb-e2fd52ea4bd7
index 17c3fc919931c3011bd8c7eafa0f9c4016431e80..76a375cf74d3fd5b5b297e5b5419cf01e260867e 100644 (file)
 ;; ---------------------------------------------------------------------------
 ;; keyboard setup -- that's simple!
 (set-input-mode nil nil 0)
-(define-key function-key-map [backspace] "\177") ; Normal behaviour for BS
-(define-key function-key-map [delete] "\C-d")    ; ... and Delete
-(define-key function-key-map [tab] [?\t])
-(define-key function-key-map [linefeed] [?\n])
-(define-key function-key-map [clear] [11])
-(define-key function-key-map [return] [13])
-(define-key function-key-map [escape] [?\e])
-(define-key function-key-map [M-backspace] [?\M-\d])
-(define-key function-key-map [M-delete] [?\M-d])
-(define-key function-key-map [M-tab] [?\M-\t])
-(define-key function-key-map [M-linefeed] [?\M-\n])
-(define-key function-key-map [M-clear] [?\M-\013])
-(define-key function-key-map [M-return] [?\M-\015])
-(define-key function-key-map [M-escape] [?\M-\e])
+(let (m (terminal-local-value 'function-key-map nil))
+  (define-key m [backspace] "\177") ; Normal behaviour for BS
+  (define-key m [delete] "\C-d")    ; ... and Delete
+  (define-key m [tab] [?\t])
+  (define-key m [linefeed] [?\n])
+  (define-key m [clear] [11])
+  (define-key m [return] [13])
+  (define-key m [escape] [?\e])
+  (define-key m [M-backspace] [?\M-\d])
+  (define-key m [M-delete] [?\M-d])
+  (define-key m [M-tab] [?\M-\t])
+  (define-key m [M-linefeed] [?\M-\n])
+  (define-key m [M-clear] [?\M-\013])
+  (define-key m [M-return] [?\M-\015])
+  (define-key m [M-escape] [?\M-\e]))
 (put 'backspace 'ascii-character 127)
 (put 'delete 'ascii-character 127)
 (put 'tab 'ascii-character ?\t)
index eae2f41937816533af72f79e8c10da2902416b1a..bf9b23bdf6f89b5525ae6f5886b34031feb9fcf8 100644 (file)
 
 ;;; Code:
 
-(define-key function-key-map "\e[120q" [S-escape])
-(define-key function-key-map "\e[121q" [C-escape])
+(defvar iris-function-map nil
+  "Function key definitions for SGI xwsh and winterm apps.")
 
-(define-key function-key-map "\e[001q" [f1])
-(define-key function-key-map "\e[013q" [S-f1])
-(define-key function-key-map "\e[025q" [C-f1])
+;; Make reloads faster.
+(unless iris-function-map
+  (setq iris-function-map (make-sparse-keymap))
 
+  (define-key iris-function-map "\e[120q" [S-escape])
+  (define-key iris-function-map "\e[121q" [C-escape])
 
-(define-key function-key-map "\e[002q" [f2])
-(define-key function-key-map "\e[014q" [S-f2])
-(define-key function-key-map "\e[026q" [C-f2])
-(define-key function-key-map "\e[038q" [M-f2])
+  (define-key iris-function-map "\e[001q" [f1])
+  (define-key iris-function-map "\e[013q" [S-f1])
+  (define-key iris-function-map "\e[025q" [C-f1])
 
-(define-key function-key-map "\e[003q" [f3])
-(define-key function-key-map "\e[015q" [S-f3])
-(define-key function-key-map "\e[027q" [C-f3])
 
+  (define-key iris-function-map "\e[002q" [f2])
+  (define-key iris-function-map "\e[014q" [S-f2])
+  (define-key iris-function-map "\e[026q" [C-f2])
+  (define-key iris-function-map "\e[038q" [M-f2])
 
-(define-key function-key-map "\e[004q" [f4])
-(define-key function-key-map "\e[016q" [S-f4])
-(define-key function-key-map "\e[028q" [C-f4])
+  (define-key iris-function-map "\e[003q" [f3])
+  (define-key iris-function-map "\e[015q" [S-f3])
+  (define-key iris-function-map "\e[027q" [C-f3])
 
 
-(define-key function-key-map "\e[005q" [f5])
-(define-key function-key-map "\e[017q" [S-f5])
-(define-key function-key-map "\e[029q" [C-f5])
+  (define-key iris-function-map "\e[004q" [f4])
+  (define-key iris-function-map "\e[016q" [S-f4])
+  (define-key iris-function-map "\e[028q" [C-f4])
 
 
-(define-key function-key-map "\e[006q" [f6])
-(define-key function-key-map "\e[018q" [S-f6])
-(define-key function-key-map "\e[030q" [C-f6])
+  (define-key iris-function-map "\e[005q" [f5])
+  (define-key iris-function-map "\e[017q" [S-f5])
+  (define-key iris-function-map "\e[029q" [C-f5])
 
 
-(define-key function-key-map "\e[007q" [f7])
-(define-key function-key-map "\e[019q" [S-f7])
-(define-key function-key-map "\e[031q" [C-f7])
+  (define-key iris-function-map "\e[006q" [f6])
+  (define-key iris-function-map "\e[018q" [S-f6])
+  (define-key iris-function-map "\e[030q" [C-f6])
 
 
-(define-key function-key-map "\e[008q" [f8])
-(define-key function-key-map "\e[020q" [S-f8])
-(define-key function-key-map "\e[032q" [C-f8])
+  (define-key iris-function-map "\e[007q" [f7])
+  (define-key iris-function-map "\e[019q" [S-f7])
+  (define-key iris-function-map "\e[031q" [C-f7])
 
 
-(define-key function-key-map "\e[009q" [f9])
-(define-key function-key-map "\e[021q" [S-f9])
-(define-key function-key-map "\e[033q" [C-f9])
+  (define-key iris-function-map "\e[008q" [f8])
+  (define-key iris-function-map "\e[020q" [S-f8])
+  (define-key iris-function-map "\e[032q" [C-f8])
 
 
-(define-key function-key-map "\e[010q" [f10])
-(define-key function-key-map "\e[022q" [S-f10])
-(define-key function-key-map "\e[034q" [C-f10])
+  (define-key iris-function-map "\e[009q" [f9])
+  (define-key iris-function-map "\e[021q" [S-f9])
+  (define-key iris-function-map "\e[033q" [C-f9])
 
 
-(define-key function-key-map "\e[011q" [f11])
-(define-key function-key-map "\e[023q" [S-f11])
-(define-key function-key-map "\e[035q" [C-f11])
-(define-key function-key-map "\e[047q" [M-f11])
+  (define-key iris-function-map "\e[010q" [f10])
+  (define-key iris-function-map "\e[022q" [S-f10])
+  (define-key iris-function-map "\e[034q" [C-f10])
 
-(define-key function-key-map "\e[012q" [f12])
-(define-key function-key-map "\e[024q" [S-f12])
-(define-key function-key-map "\e[036q" [C-f12])
-(define-key function-key-map "\e[048q" [M-f12])
 
+  (define-key iris-function-map "\e[011q" [f11])
+  (define-key iris-function-map "\e[023q" [S-f11])
+  (define-key iris-function-map "\e[035q" [C-f11])
+  (define-key iris-function-map "\e[047q" [M-f11])
 
-(define-key function-key-map "\e[057q" [C-`])
-(define-key function-key-map "\e[115q" [M-`])
+  (define-key iris-function-map "\e[012q" [f12])
+  (define-key iris-function-map "\e[024q" [S-f12])
+  (define-key iris-function-map "\e[036q" [C-f12])
+  (define-key iris-function-map "\e[048q" [M-f12])
 
-(define-key function-key-map "\e[049q" [?\C-1])
-(define-key function-key-map "\e[058q" [?\M-1])
 
+  (define-key iris-function-map "\e[057q" [C-`])
+  (define-key iris-function-map "\e[115q" [M-`])
 
-(define-key function-key-map "\e[059q" [?\M-2])
+  (define-key iris-function-map "\e[049q" [?\C-1])
+  (define-key iris-function-map "\e[058q" [?\M-1])
 
-(define-key function-key-map "\e[050q" [?\C-3])
-(define-key function-key-map "\e[060q" [?\M-3])
 
-(define-key function-key-map "\e[051q" [?\C-4])
-(define-key function-key-map "\e[061q" [?\M-4])
+  (define-key iris-function-map "\e[059q" [?\M-2])
 
-(define-key function-key-map "\e[052q" [?\C-5])
-(define-key function-key-map "\e[062q" [?\M-5])
+  (define-key iris-function-map "\e[050q" [?\C-3])
+  (define-key iris-function-map "\e[060q" [?\M-3])
 
+  (define-key iris-function-map "\e[051q" [?\C-4])
+  (define-key iris-function-map "\e[061q" [?\M-4])
 
-(define-key function-key-map "\e[063q" [?\M-6])
+  (define-key iris-function-map "\e[052q" [?\C-5])
+  (define-key iris-function-map "\e[062q" [?\M-5])
 
-(define-key function-key-map "\e[053q" [?\C-7])
-(define-key function-key-map "\e[064q" [?\M-7])
 
-(define-key function-key-map "\e[054q" [?\C-8])
-(define-key function-key-map "\e[065q" [?\M-8])
+  (define-key iris-function-map "\e[063q" [?\M-6])
 
-(define-key function-key-map "\e[055q" [?\C-9])
-(define-key function-key-map "\e[066q" [?\M-9])
+  (define-key iris-function-map "\e[053q" [?\C-7])
+  (define-key iris-function-map "\e[064q" [?\M-7])
 
-(define-key function-key-map "\e[056q" [?\C-0])
-(define-key function-key-map "\e[067q" [?\M-0])
+  (define-key iris-function-map "\e[054q" [?\C-8])
+  (define-key iris-function-map "\e[065q" [?\M-8])
 
-(define-key function-key-map "\e[068q" [?\M--])
+  (define-key iris-function-map "\e[055q" [?\C-9])
+  (define-key iris-function-map "\e[066q" [?\M-9])
 
-(define-key function-key-map "\e[069q" [?\C-=])
-(define-key function-key-map "\e[070q" [?\M-=])
+  (define-key iris-function-map "\e[056q" [?\C-0])
+  (define-key iris-function-map "\e[067q" [?\M-0])
 
-;; I don't know what to do with those.
-;(define-key function-key-map "^H" [<del>])
-;(define-key function-key-map "^H" [S-<del>])
-;(define-key function-key-map "\177" [C-<del>])
-;(define-key function-key-map "\e[071q" [M-<del>])
+  (define-key iris-function-map "\e[068q" [?\M--])
 
-(define-key function-key-map "\e[Z" [?\S-\t])
-(define-key function-key-map "\e[072q" [?\C-\t])
-;; This only works if you remove the M-TAB keybing from the system.4Dwmrc
-;; our your ~/.4Dwmrc, if you use the 4Dwm window manager.
-(define-key function-key-map "\e[073q" [?\M-\t])
+  (define-key iris-function-map "\e[069q" [?\C-=])
+  (define-key iris-function-map "\e[070q" [?\M-=])
 
-(define-key function-key-map "\e[074q" [?\M-q])
+  ;; I don't know what to do with those.
+  ;(define-key iris-function-map "^H" [<del>])
+  ;(define-key iris-function-map "^H" [S-<del>])
+  ;(define-key iris-function-map "\177" [C-<del>])
+  ;(define-key iris-function-map "\e[071q" [M-<del>])
 
-(define-key function-key-map "\e[075q" [?\M-w])
+  (define-key iris-function-map "\e[Z" [?\S-\t])
+  (define-key iris-function-map "\e[072q" [?\C-\t])
+  ;; This only works if you remove the M-TAB keybing from the system.4Dwmrc
+  ;; our your ~/.4Dwmrc, if you use the 4Dwm window manager.
+  (define-key iris-function-map "\e[073q" [?\M-\t])
 
-(define-key function-key-map "\e[076q" [?\M-e])
+  (define-key iris-function-map "\e[074q" [?\M-q])
 
-(define-key function-key-map "\e[077q" [?\M-r])
+  (define-key iris-function-map "\e[075q" [?\M-w])
 
-(define-key function-key-map "\e[078q" [?\M-t])
+  (define-key iris-function-map "\e[076q" [?\M-e])
 
-(define-key function-key-map "\e[079q" [?\M-y])
+  (define-key iris-function-map "\e[077q" [?\M-r])
 
-(define-key function-key-map "\e[080q" [?\M-u])
+  (define-key iris-function-map "\e[078q" [?\M-t])
 
-(define-key function-key-map "\e[081q" [?\M-i])
+  (define-key iris-function-map "\e[079q" [?\M-y])
 
-(define-key function-key-map "\e[082q" [?\M-o])
+  (define-key iris-function-map "\e[080q" [?\M-u])
 
-(define-key function-key-map "\e[083q" [?\M-p])
+  (define-key iris-function-map "\e[081q" [?\M-i])
 
-(define-key function-key-map "\e[084q" [?\M-\[])
+  (define-key iris-function-map "\e[082q" [?\M-o])
 
-(define-key function-key-map "\e[085q" [?\M-\]])
+  (define-key iris-function-map "\e[083q" [?\M-p])
 
-(define-key function-key-map "\e[086q" [?\M-\\])
+  (define-key iris-function-map "\e[084q" [?\M-\[])
 
-(define-key function-key-map "\e[087q" [?\M-a])
+  (define-key iris-function-map "\e[085q" [?\M-\]])
 
-(define-key function-key-map "\e[088q" [?\M-s])
+  (define-key iris-function-map "\e[086q" [?\M-\\])
 
-(define-key function-key-map "\e[089q" [?\M-d])
+  (define-key iris-function-map "\e[087q" [?\M-a])
 
-(define-key function-key-map "\e[090q" [?\M-f])
+  (define-key iris-function-map "\e[088q" [?\M-s])
 
-(define-key function-key-map "\e[091q" [?\M-g])
+  (define-key iris-function-map "\e[089q" [?\M-d])
 
-(define-key function-key-map "\e[092q" [?\M-h])
+  (define-key iris-function-map "\e[090q" [?\M-f])
 
-(define-key function-key-map "\e[093q" [?\M-j])
+  (define-key iris-function-map "\e[091q" [?\M-g])
 
-(define-key function-key-map "\e[094q" [?\M-k])
+  (define-key iris-function-map "\e[092q" [?\M-h])
 
-(define-key function-key-map "\e[095q" [?\M-l])
+  (define-key iris-function-map "\e[093q" [?\M-j])
 
-(define-key function-key-map "\e[096q" [?\C-\;])
-(define-key function-key-map "\e[097q" [?\M-:]) ;; we are cheating
-                                               ;; here, this is realy
-                                               ;; M-;, but M-:
-                                               ;; generates the same
-                                               ;; string and is more
-                                               ;; usefull.
+  (define-key iris-function-map "\e[094q" [?\M-k])
 
-(define-key function-key-map "\e[098q" [?\C-'])
-(define-key function-key-map "\e[099q" [?\M-'])
+  (define-key iris-function-map "\e[095q" [?\M-l])
 
-(define-key function-key-map "\e[100q" [?\M-\n])
+  (define-key iris-function-map "\e[096q" [?\C-\;])
+  (define-key iris-function-map "\e[097q" [?\M-:]) ;; we are cheating
+                                                 ;; here, this is realy
+                                                 ;; M-;, but M-:
+                                                 ;; generates the same
+                                                 ;; string and is more
+                                                 ;; usefull.
 
-(define-key function-key-map "\e[101q" [?\M-z])
+  (define-key iris-function-map "\e[098q" [?\C-'])
+  (define-key iris-function-map "\e[099q" [?\M-'])
 
-(define-key function-key-map "\e[102q" [?\M-x])
+  (define-key iris-function-map "\e[100q" [?\M-\n])
 
-(define-key function-key-map "\e[103q" [?\M-c])
+  (define-key iris-function-map "\e[101q" [?\M-z])
 
-(define-key function-key-map "\e[104q" [?\M-v])
+  (define-key iris-function-map "\e[102q" [?\M-x])
 
-(define-key function-key-map "\e[105q" [?\M-b])
+  (define-key iris-function-map "\e[103q" [?\M-c])
 
-(define-key function-key-map "\e[106q" [M-n])
+  (define-key iris-function-map "\e[104q" [?\M-v])
 
-(define-key function-key-map "\e[107q" [M-m])
+  (define-key iris-function-map "\e[105q" [?\M-b])
 
-(define-key function-key-map "\e[108q" [?\C-,])
-(define-key function-key-map "\e[109q" [?\M-,])
+  (define-key iris-function-map "\e[106q" [M-n])
 
-(define-key function-key-map "\e[110q" [?\C-.])
-(define-key function-key-map "\e[111q" [?\M-.])
+  (define-key iris-function-map "\e[107q" [M-m])
 
-(define-key function-key-map "\e[112q" [?\C-/])
-(define-key function-key-map "\e[113q" [?\M-/])
+  (define-key iris-function-map "\e[108q" [?\C-,])
+  (define-key iris-function-map "\e[109q" [?\M-,])
 
-(define-key function-key-map "\e[139q" [insert])
-(define-key function-key-map "\e[139q" [S-insert])
-(define-key function-key-map "\e[140q" [C-insert])
-(define-key function-key-map "\e[141q" [M-insert])
+  (define-key iris-function-map "\e[110q" [?\C-.])
+  (define-key iris-function-map "\e[111q" [?\M-.])
 
-(define-key function-key-map "\e[H" [home])
-(define-key function-key-map "\e[143q" [S-home])
-(define-key function-key-map "\e[144q" [C-home])
+  (define-key iris-function-map "\e[112q" [?\C-/])
+  (define-key iris-function-map "\e[113q" [?\M-/])
 
+  (define-key iris-function-map "\e[139q" [insert])
+  (define-key iris-function-map "\e[139q" [S-insert])
+  (define-key iris-function-map "\e[140q" [C-insert])
+  (define-key iris-function-map "\e[141q" [M-insert])
 
-(define-key function-key-map "\e[150q" [prior])
-(define-key function-key-map "\e[151q" [S-prior]) ;; those don't seem
-                                                 ;; to generate
-                                                 ;; anything
-(define-key function-key-map "\e[152q" [C-prior])
+  (define-key iris-function-map "\e[H" [home])
+  (define-key iris-function-map "\e[143q" [S-home])
+  (define-key iris-function-map "\e[144q" [C-home])
 
 
-;; (define-key function-key-map "^?" [delete]) ?? something else seems to take care of this.
-(define-key function-key-map "\e[P" [S-delete])
-(define-key function-key-map "\e[142q" [C-delete])
-(define-key function-key-map "\e[M" [M-delete])
+  (define-key iris-function-map "\e[150q" [prior])
+  (define-key iris-function-map "\e[151q" [S-prior]) ;; those don't seem
+                                                   ;; to generate
+                                                   ;; anything
+  (define-key iris-function-map "\e[152q" [C-prior])
 
-(define-key function-key-map "\e[146q" [end])
-(define-key function-key-map "\e[147q" [S-end]) ;; those don't seem to
-                                               ;; generate anything
-(define-key function-key-map "\e[148q" [C-end])
 
-(define-key function-key-map "\e[154q" [next])
-(define-key function-key-map "\e[155q" [S-next])
-(define-key function-key-map "\e[156q" [C-next])
+  ;; (define-key iris-function-map "^?" [delete]) ?? something else seems to take care of this.
+  (define-key iris-function-map "\e[P" [S-delete])
+  (define-key iris-function-map "\e[142q" [C-delete])
+  (define-key iris-function-map "\e[M" [M-delete])
 
+  (define-key iris-function-map "\e[146q" [end])
+  (define-key iris-function-map "\e[147q" [S-end]) ;; those don't seem to
+                                                 ;; generate anything
+  (define-key iris-function-map "\e[148q" [C-end])
 
-(define-key function-key-map "\e[161q" [S-up])
-(define-key function-key-map "\e[162q" [C-up])
-(define-key function-key-map "\e[163q" [M-up])
+  (define-key iris-function-map "\e[154q" [next])
+  (define-key iris-function-map "\e[155q" [S-next])
+  (define-key iris-function-map "\e[156q" [C-next])
 
-(define-key function-key-map "\e[158q" [S-left])
-(define-key function-key-map "\e[159q" [C-left])
-(define-key function-key-map "\e[160q" [M-left])
 
-(define-key function-key-map "\e[164q" [S-down])
-(define-key function-key-map "\e[165q" [C-down])
-(define-key function-key-map "\e[166q" [M-down])
+  (define-key iris-function-map "\e[161q" [S-up])
+  (define-key iris-function-map "\e[162q" [C-up])
+  (define-key iris-function-map "\e[163q" [M-up])
 
-(define-key function-key-map "\e[167q" [S-right])
-(define-key function-key-map "\e[168q" [C-right])
-(define-key function-key-map "\e[169q" [M-right])
+  (define-key iris-function-map "\e[158q" [S-left])
+  (define-key iris-function-map "\e[159q" [C-left])
+  (define-key iris-function-map "\e[160q" [M-left])
 
-;; Keypad functions, most of those are untested.
-(define-key function-key-map "\e[179q" [?\C-/])
-(define-key function-key-map "\e[180q" [?\M-/])
+  (define-key iris-function-map "\e[164q" [S-down])
+  (define-key iris-function-map "\e[165q" [C-down])
+  (define-key iris-function-map "\e[166q" [M-down])
 
-(define-key function-key-map "\e[187q" [?\C-*])
-(define-key function-key-map "\e[188q" [?\M-*])
+  (define-key iris-function-map "\e[167q" [S-right])
+  (define-key iris-function-map "\e[168q" [C-right])
+  (define-key iris-function-map "\e[169q" [M-right])
 
-(define-key function-key-map "\e[198q" [?\C--])
-(define-key function-key-map "\e[199q" [?\M--])
+  ;; Keypad functions, most of those are untested.
+  (define-key iris-function-map "\e[179q" [?\C-/])
+  (define-key iris-function-map "\e[180q" [?\M-/])
 
-;; Something else takes care of home, up, prior, down, left, right, next
-;(define-key function-key-map "\e[H" [home])
-(define-key function-key-map "\e[172q" [C-home])
+  (define-key iris-function-map "\e[187q" [?\C-*])
+  (define-key iris-function-map "\e[188q" [?\M-*])
 
-;(define-key function-key-map "\e[A" [up])
-(define-key function-key-map "\e[182q" [C-up])
+  (define-key iris-function-map "\e[198q" [?\C--])
+  (define-key iris-function-map "\e[199q" [?\M--])
 
+  ;; Something else takes care of home, up, prior, down, left, right, next
+  ;(define-key iris-function-map "\e[H" [home])
+  (define-key iris-function-map "\e[172q" [C-home])
 
-;(define-key function-key-map "\e[150q" [prior])
-(define-key function-key-map "\e[190q" [C-prior])
+  ;(define-key iris-function-map "\e[A" [up])
+  (define-key iris-function-map "\e[182q" [C-up])
 
 
-(define-key function-key-map "\e[200q" [?\C-+])
-(define-key function-key-map "\e[201q" [?\M-+])
+  ;(define-key iris-function-map "\e[150q" [prior])
+  (define-key iris-function-map "\e[190q" [C-prior])
 
-;(define-key function-key-map "\e[D" [left])
-(define-key function-key-map "\e[174q" [C-left])
 
+  (define-key iris-function-map "\e[200q" [?\C-+])
+  (define-key iris-function-map "\e[201q" [?\M-+])
 
-(define-key function-key-map "\e[000q" [begin])
-(define-key function-key-map "\e[184q" [C-begin])
+  ;(define-key iris-function-map "\e[D" [left])
+  (define-key iris-function-map "\e[174q" [C-left])
 
 
-;(define-key function-key-map "\e[C" [right])
-(define-key function-key-map "\e[192q" [C-right])
+  (define-key iris-function-map "\e[000q" [begin])
+  (define-key iris-function-map "\e[184q" [C-begin])
 
-;(define-key function-key-map "\e[146q" [end])
-(define-key function-key-map "\e[176q" [C-end])
 
-;(define-key function-key-map "\e[B" [down])
-(define-key function-key-map "\e[186q" [C-down])
+  ;(define-key iris-function-map "\e[C" [right])
+  (define-key iris-function-map "\e[192q" [C-right])
 
-;(define-key function-key-map "\e[154q" [next])
-(define-key function-key-map "\e[194q" [C-next])
+  ;(define-key iris-function-map "\e[146q" [end])
+  (define-key iris-function-map "\e[176q" [C-end])
 
+  ;(define-key iris-function-map "\e[B" [down])
+  (define-key iris-function-map "\e[186q" [C-down])
 
-(define-key function-key-map "\e[100q" [M-enter])
+  ;(define-key iris-function-map "\e[154q" [next])
+  (define-key iris-function-map "\e[194q" [C-next])
 
-(define-key function-key-map "\e[139q" [insert])
-(define-key function-key-map "\e[178q" [C-inset])
 
-(define-key function-key-map "\e[P" [delete])
-(define-key function-key-map "\e[196q" [C-delete])
-(define-key function-key-map "\e[197q" [M-delete])
+  (define-key iris-function-map "\e[100q" [M-enter])
+
+  (define-key iris-function-map "\e[139q" [insert])
+  (define-key iris-function-map "\e[178q" [C-inset])
+
+  (define-key iris-function-map "\e[P" [delete])
+  (define-key iris-function-map "\e[196q" [C-delete])
+  (define-key iris-function-map "\e[197q" [M-delete]))
+
+;; Use inheritance to let the main keymap override these defaults.
+;; This way we don't override terminfo-derived settings or settings
+;; made in the .emacs file.
+(let ((m (copy-keymap iris-function-map)))
+  (set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil)))
+  (set-keymap-parent (terminal-local-value 'function-key-map nil) m))
 
 ;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
 ;;; iris-ansi.el ends here
index 1f8d9ca77a34b5ecbcd78b59242257791763804f..8e40a25070cecd9e3d445260db7aab394c502be1 100644 (file)
@@ -1,72 +1,86 @@
 ;; -*- no-byte-compile: t -*-
 ;; Define function key sequences for DEC terminals.
 
-;; Termcap or terminfo should set these.
-;; (define-key function-key-map "\e[A" [up])
-;; (define-key function-key-map "\e[B" [down])
-;; (define-key function-key-map "\e[C" [right])
-;; (define-key function-key-map "\e[D" [left])
+(defvar lk201-function-map nil
+  "Function key definitions for DEC terminals.")
 
-(define-key function-key-map "\e[1~" [find])
-(define-key function-key-map "\e[2~" [insert])
-(define-key function-key-map "\e[3~" [delete])
-(define-key function-key-map "\e[4~" [select])
-(define-key function-key-map "\e[5~" [prior])
-(define-key function-key-map "\e[6~" [next])
-(define-key function-key-map "\e[11~" [f1])
-(define-key function-key-map "\e[12~" [f2])
-(define-key function-key-map "\e[13~" [f3])
-(define-key function-key-map "\e[14~" [f4])
-(define-key function-key-map "\e[15~" [f5])
-(define-key function-key-map "\e[17~" [f6])
-(define-key function-key-map "\e[18~" [f7])
-(define-key function-key-map "\e[19~" [f8])
-(define-key function-key-map "\e[20~" [f9])
-(define-key function-key-map "\e[21~" [f10])
-;; Customarily F11 is used as the ESC key.
-;; The file that includes this one, takes care of that.
-(define-key function-key-map "\e[23~" [f11])
-(define-key function-key-map "\e[24~" [f12])
-(define-key function-key-map "\e[25~" [f13])
-(define-key function-key-map "\e[26~" [f14])
-(define-key function-key-map "\e[28~" [help])
-(define-key function-key-map "\e[29~" [menu])
-(define-key function-key-map "\e[31~" [f17])
-(define-key function-key-map "\e[32~" [f18])
-(define-key function-key-map "\e[33~" [f19])
-(define-key function-key-map "\e[34~" [f20])
+;; Make reloads faster.
+(unless lk201-function-map
+  (setq lk201-function-map (make-sparse-keymap))
 
-;; Termcap or terminfo should set these.
-;; (define-key function-key-map "\eOA" [up])
-;; (define-key function-key-map "\eOB" [down])
-;; (define-key function-key-map "\eOC" [right])
-;; (define-key function-key-map "\eOD" [left])
+  ;; Termcap or terminfo should set these.
+  ;; (define-key lk201-function-map "\e[A" [up])
+  ;; (define-key lk201-function-map "\e[B" [down])
+  ;; (define-key lk201-function-map "\e[C" [right])
+  ;; (define-key lk201-function-map "\e[D" [left])
 
-;; Termcap or terminfo should set these, but doesn't properly.
-;; Termcap sets these to k1-k4, which get mapped to f1-f4 in term.c
-(define-key function-key-map "\eOP" [kp-f1])
-(define-key function-key-map "\eOQ" [kp-f2])
-(define-key function-key-map "\eOR" [kp-f3])
-(define-key function-key-map "\eOS" [kp-f4])
+  (define-key lk201-function-map "\e[1~" [find])
+  (define-key lk201-function-map "\e[2~" [insert])
+  (define-key lk201-function-map "\e[3~" [delete])
+  (define-key lk201-function-map "\e[4~" [select])
+  (define-key lk201-function-map "\e[5~" [prior])
+  (define-key lk201-function-map "\e[6~" [next])
+  (define-key lk201-function-map "\e[11~" [f1])
+  (define-key lk201-function-map "\e[12~" [f2])
+  (define-key lk201-function-map "\e[13~" [f3])
+  (define-key lk201-function-map "\e[14~" [f4])
+  (define-key lk201-function-map "\e[15~" [f5])
+  (define-key lk201-function-map "\e[17~" [f6])
+  (define-key lk201-function-map "\e[18~" [f7])
+  (define-key lk201-function-map "\e[19~" [f8])
+  (define-key lk201-function-map "\e[20~" [f9])
+  (define-key lk201-function-map "\e[21~" [f10])
+  ;; Customarily F11 is used as the ESC key.
+  ;; The file that includes this one, takes care of that.
+  (define-key lk201-function-map "\e[23~" [f11])
+  (define-key lk201-function-map "\e[24~" [f12])
+  (define-key lk201-function-map "\e[25~" [f13])
+  (define-key lk201-function-map "\e[26~" [f14])
+  (define-key lk201-function-map "\e[28~" [help])
+  (define-key lk201-function-map "\e[29~" [menu])
+  (define-key lk201-function-map "\e[31~" [f17])
+  (define-key lk201-function-map "\e[32~" [f18])
+  (define-key lk201-function-map "\e[33~" [f19])
+  (define-key lk201-function-map "\e[34~" [f20])
 
-(define-key function-key-map "\eOI" [kp-tab])
-(define-key function-key-map "\eOj" [kp-multiply])
-(define-key function-key-map "\eOk" [kp-add])
-(define-key function-key-map "\eOl" [kp-separator])
-(define-key function-key-map "\eOM" [kp-enter])
-(define-key function-key-map "\eOm" [kp-subtract])
-(define-key function-key-map "\eOn" [kp-decimal])
-(define-key function-key-map "\eOo" [kp-divide])
-(define-key function-key-map "\eOp" [kp-0])
-(define-key function-key-map "\eOq" [kp-1])
-(define-key function-key-map "\eOr" [kp-2])
-(define-key function-key-map "\eOs" [kp-3])
-(define-key function-key-map "\eOt" [kp-4])
-(define-key function-key-map "\eOu" [kp-5])
-(define-key function-key-map "\eOv" [kp-6])
-(define-key function-key-map "\eOw" [kp-7])
-(define-key function-key-map "\eOx" [kp-8])
-(define-key function-key-map "\eOy" [kp-9])
+  ;; Termcap or terminfo should set these.
+  ;; (define-key lk201-function-map "\eOA" [up])
+  ;; (define-key lk201-function-map "\eOB" [down])
+  ;; (define-key lk201-function-map "\eOC" [right])
+  ;; (define-key lk201-function-map "\eOD" [left])
+
+  ;; Termcap or terminfo should set these, but doesn't properly.
+  ;; Termcap sets these to k1-k4, which get mapped to f1-f4 in term.c
+  (define-key lk201-function-map "\eOP" [kp-f1])
+  (define-key lk201-function-map "\eOQ" [kp-f2])
+  (define-key lk201-function-map "\eOR" [kp-f3])
+  (define-key lk201-function-map "\eOS" [kp-f4])
+
+  (define-key lk201-function-map "\eOI" [kp-tab])
+  (define-key lk201-function-map "\eOj" [kp-multiply])
+  (define-key lk201-function-map "\eOk" [kp-add])
+  (define-key lk201-function-map "\eOl" [kp-separator])
+  (define-key lk201-function-map "\eOM" [kp-enter])
+  (define-key lk201-function-map "\eOm" [kp-subtract])
+  (define-key lk201-function-map "\eOn" [kp-decimal])
+  (define-key lk201-function-map "\eOo" [kp-divide])
+  (define-key lk201-function-map "\eOp" [kp-0])
+  (define-key lk201-function-map "\eOq" [kp-1])
+  (define-key lk201-function-map "\eOr" [kp-2])
+  (define-key lk201-function-map "\eOs" [kp-3])
+  (define-key lk201-function-map "\eOt" [kp-4])
+  (define-key lk201-function-map "\eOu" [kp-5])
+  (define-key lk201-function-map "\eOv" [kp-6])
+  (define-key lk201-function-map "\eOw" [kp-7])
+  (define-key lk201-function-map "\eOx" [kp-8])
+  (define-key lk201-function-map "\eOy" [kp-9]))
+
+;; Use inheritance to let the main keymap override these defaults.
+;; This way we don't override terminfo-derived settings or settings
+;; made in the .emacs file.
+(let ((m (copy-keymap lk201-function-map)))
+  (set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil)))
+  (set-keymap-parent (terminal-local-value 'function-key-map nil) m))
 
 ;;; arch-tag: 7ffb4444-6a23-43e1-b457-43cf4f673c0d
 ;;; lk201.el ends here
index 22bd55e5943b6d71053c2695714eaf724a35771a..03971a95db60c06512e4d31bb6c48ce1a83bfea3 100644 (file)
@@ -1059,20 +1059,21 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
 
 ;; Map certain keypad keys into ASCII characters
 ;; that people usually expect.
-(define-key function-key-map [backspace] [?\d])
-(define-key function-key-map [delete] [?\d])
-(define-key function-key-map [tab] [?\t])
-(define-key function-key-map [linefeed] [?\n])
-(define-key function-key-map [clear] [?\C-l])
-(define-key function-key-map [return] [?\C-m])
-(define-key function-key-map [escape] [?\e])
-(define-key function-key-map [M-backspace] [?\M-\d])
-(define-key function-key-map [M-delete] [?\M-\d])
-(define-key function-key-map [M-tab] [?\M-\t])
-(define-key function-key-map [M-linefeed] [?\M-\n])
-(define-key function-key-map [M-clear] [?\M-\C-l])
-(define-key function-key-map [M-return] [?\M-\C-m])
-(define-key function-key-map [M-escape] [?\M-\e])
+(let ((m (terminal-local-value 'function-key-map nil)))
+  (define-key m [backspace] [?\d])
+  (define-key m [delete] [?\d])
+  (define-key m [tab] [?\t])
+  (define-key m [linefeed] [?\n])
+  (define-key m [clear] [?\C-l])
+  (define-key m [return] [?\C-m])
+  (define-key m [escape] [?\e])
+  (define-key m [M-backspace] [?\M-\d])
+  (define-key m [M-delete] [?\M-\d])
+  (define-key m [M-tab] [?\M-\t])
+  (define-key m [M-linefeed] [?\M-\n])
+  (define-key m [M-clear] [?\M-\C-l])
+  (define-key m [M-return] [?\M-\C-m])
+  (define-key m [M-escape] [?\M-\e]))
 
 ;; These tell read-char how to convert
 ;; these special chars to ASCII.
@@ -1139,7 +1140,7 @@ correspoinding TextEncodingBase value."
     (set-keyboard-coding-system (or coding-system 'mac-roman))
     ;; MacJapanese maps reverse solidus to ?\x80.
     (if (eq coding-system 'japanese-shift-jis)
-       (define-key key-translation-map [?\x80] "\\"))))
+       (define-key global-key-translation-map [?\x80] "\\"))))
 
 (define-key special-event-map [language-change] 'mac-handle-language-change)
 \f
index 7a24eaf5a0c000d91d7cdfe07160f3b707565c9a..6bd6861133c9db5a83cb3300a2ad35a63085adb0 100644 (file)
@@ -31,7 +31,7 @@
 (if (boundp 'news-fkey-prefix)
     nil
   ;; The terminal initialization should already have set up some keys
-  (setq news-fkey-prefix (lookup-key function-key-map "\eO"))
+  (setq news-fkey-prefix (lookup-key (terminal-local-value 'function-key-map nil) "\eO"))
   (if (not (keymapp news-fkey-prefix))
       (error "What?  Your news termcap/terminfo has no keycaps in it"))
 
index 8dcd1826e0a936cdb18efb71fec11c5927e56ad0..9a1acf0d1a204ec063cdee848afd070084b8b05f 100644 (file)
 
 ;;; Code:
 
-;; Set up function-key-map entries that termcap and terminfo don't know.
-(let ((map (make-sparse-keymap)))
-  (define-key map "\e[A" [up])
-  (define-key map "\e[B" [down])
-  (define-key map "\e[C" [right])
-  (define-key map "\e[D" [left])
-  (define-key map "\e[7~" [home])
-  (define-key map "\e[2~" [insert])
-  (define-key map "\e[3~" [delete])
-  (define-key map "\e[4~" [select])
-  (define-key map "\e[5~" [prior])
-  (define-key map "\e[6~" [next])
-  (define-key map "\e[11~" [f1])
-  (define-key map "\e[12~" [f2])
-  (define-key map "\e[13~" [f3])
-  (define-key map "\e[14~" [f4])
-  (define-key map "\e[15~" [f5])
-  (define-key map "\e[17~" [f6])
-  (define-key map "\e[18~" [f7])
-  (define-key map "\e[19~" [f8])
-  (define-key map "\e[20~" [f9])
-  (define-key map "\e[21~" [f10])
-  (define-key map "\e[23~" [f11])
-  (define-key map "\e[24~" [f12])
-  (define-key map "\e[29~" [print])
-
-  (define-key map "\e[11^" [C-f1])
-  (define-key map "\e[12^" [C-f2])
-  (define-key map "\e[13^" [C-f3])
-  (define-key map "\e[14^" [C-f4])
-  (define-key map "\e[15^" [C-f5])
-  (define-key map "\e[17^" [C-f6])
-  (define-key map "\e[18^" [C-f7])
-  (define-key map "\e[19^" [C-f8])
-  (define-key map "\e[20^" [C-f9])
-  (define-key map "\e[21^" [C-f10])
-  (define-key map "\e[23^" [C-f11])
-  (define-key map "\e[24^" [C-f12])
-
-  (define-key map "\e[29~" [print])
-
-  (define-key map "\e[2;2~" [S-insert])
-  (define-key map "\e[3$" [S-delete])
-
-  (define-key map "\e[2^" [C-insert])
-  (define-key map "\e[3^" [C-delete])
-  (define-key map "\e[5^" [C-prior])
-  (define-key map "\e[6^" [C-next])
-  (define-key map "\eOd" [C-left])
-  (define-key map "\eOc" [C-right])
-  (define-key map "\eOa" [C-up])
-  (define-key map "\eOb" [C-down])
-
-  (define-key map "\e[5$" [S-prior])
-  (define-key map "\e[6$" [S-next])
-  (define-key map "\e[8$" [S-end])
-  (define-key map "\e[7$" [S-home])
-  (define-key map "\e[d" [S-left])
-  (define-key map "\e[c" [S-right])
-  (define-key map "\e[a" [S-up])
-  (define-key map "\e[b" [S-down])
-
-  ;; Use inheritance to let the main keymap override those defaults.
-  ;; This way we don't override terminfo-derived settings or settings
-  ;; made in the .emacs file.
-  (set-keymap-parent map (keymap-parent function-key-map))
-  (set-keymap-parent function-key-map map))
+(require 'server)
+
+(defvar rxvt-function-map nil
+  "Function key overrides for rxvt.")
+
+;; Protect against reloads.
+(unless rxvt-function-map
+  (setq rxvt-function-map (make-sparse-keymap))
+
+  ;; Set up function-key-map entries that termcap and terminfo don't know.
+  (define-key rxvt-function-map "\e[A" [up])
+  (define-key rxvt-function-map "\e[B" [down])
+  (define-key rxvt-function-map "\e[C" [right])
+  (define-key rxvt-function-map "\e[D" [left])
+  (define-key rxvt-function-map "\e[7~" [home])
+  (define-key rxvt-function-map "\e[2~" [insert])
+  (define-key rxvt-function-map "\e[3~" [delete])
+  (define-key rxvt-function-map "\e[4~" [select])
+  (define-key rxvt-function-map "\e[5~" [prior])
+  (define-key rxvt-function-map "\e[6~" [next])
+  (define-key rxvt-function-map "\e[11~" [f1])
+  (define-key rxvt-function-map "\e[12~" [f2])
+  (define-key rxvt-function-map "\e[13~" [f3])
+  (define-key rxvt-function-map "\e[14~" [f4])
+  (define-key rxvt-function-map "\e[15~" [f5])
+  (define-key rxvt-function-map "\e[17~" [f6])
+  (define-key rxvt-function-map "\e[18~" [f7])
+  (define-key rxvt-function-map "\e[19~" [f8])
+  (define-key rxvt-function-map "\e[20~" [f9])
+  (define-key rxvt-function-map "\e[21~" [f10])
+  (define-key rxvt-function-map "\e[23~" [f11])
+  (define-key rxvt-function-map "\e[24~" [f12])
+  (define-key rxvt-function-map "\e[29~" [print])
+
+  (define-key rxvt-function-map "\e[11^" [C-f1])
+  (define-key rxvt-function-map "\e[12^" [C-f2])
+  (define-key rxvt-function-map "\e[13^" [C-f3])
+  (define-key rxvt-function-map "\e[14^" [C-f4])
+  (define-key rxvt-function-map "\e[15^" [C-f5])
+  (define-key rxvt-function-map "\e[17^" [C-f6])
+  (define-key rxvt-function-map "\e[18^" [C-f7])
+  (define-key rxvt-function-map "\e[19^" [C-f8])
+  (define-key rxvt-function-map "\e[20^" [C-f9])
+  (define-key rxvt-function-map "\e[21^" [C-f10])
+  (define-key rxvt-function-map "\e[23^" [C-f11])
+  (define-key rxvt-function-map "\e[24^" [C-f12])
+
+  (define-key rxvt-function-map "\e[29~" [print])
+
+  (define-key rxvt-function-map "\e[2;2~" [S-insert])
+  (define-key rxvt-function-map "\e[3$" [S-delete])
+
+  (define-key rxvt-function-map "\e[2^" [C-insert])
+  (define-key rxvt-function-map "\e[3^" [C-delete])
+  (define-key rxvt-function-map "\e[5^" [C-prior])
+  (define-key rxvt-function-map "\e[6^" [C-next])
+  (define-key rxvt-function-map "\eOd" [C-left])
+  (define-key rxvt-function-map "\eOc" [C-right])
+  (define-key rxvt-function-map "\eOa" [C-up])
+  (define-key rxvt-function-map "\eOb" [C-down])
+
+  (define-key rxvt-function-map "\e[5$" [S-prior])
+  (define-key rxvt-function-map "\e[6$" [S-next])
+  (define-key rxvt-function-map "\e[8$" [S-end])
+  (define-key rxvt-function-map "\e[7$" [S-home])
+  (define-key rxvt-function-map "\e[d" [S-left])
+  (define-key rxvt-function-map "\e[c" [S-right])
+  (define-key rxvt-function-map "\e[a" [S-up])
+  (define-key rxvt-function-map "\e[b" [S-down]))
+
+;; Use inheritance to let the main keymap override those defaults.
+;; This way we don't override terminfo-derived settings or settings
+;; made in the .emacs file.
+(let ((m (copy-keymap rxvt-function-map)))
+  (set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil)))
+  (set-keymap-parent (terminal-local-value 'function-key-map nil) m))
+
 
 ;; Set up colors, for those versions of rxvt that support it.
 (defvar rxvt-standard-colors
@@ -148,7 +158,7 @@ for the currently selected frame."
 ;; intelligent way than the default guesswork in startup.el.
 (defun rxvt-set-background-mode ()
   "Set background mode as appropriate for the default rxvt colors."
-  (let ((fgbg (getenv "COLORFGBG"))
+  (let ((fgbg (server-getenv "COLORFGBG"))
        bg rgb)
     (setq default-frame-background-mode 'light)
     (when (and fgbg
index 18010e0b343170a0212b6ea8ee4e5b766dad316c..85ee3b4386f38ab146c32dae5e2ebf4ea3629a6c 100644 (file)
@@ -93,7 +93,7 @@
 ;;
 
 (defvar sun-raw-prefix (make-sparse-keymap))
-(define-key function-key-map "\e[" sun-raw-prefix)
+(define-key (terminal-local-value 'function-key-map nil) "\e[" sun-raw-prefix)
 
 (define-key sun-raw-prefix "210z" [r3])
 (define-key sun-raw-prefix "213z" [r6])
index c24464fbbd5972ded706c43e246c9c7a0169d335..54b1b6bc3a6ff03f2cfc95588a239ab8a9736ce1 100644 (file)
 
 ;;; Code:
 
-(or (lookup-key function-key-map "\e[")
-    (define-key function-key-map "\e[" (make-keymap)))
-;; (or (lookup-key function-key-map "\eO")
-;;    (define-key function-key-map "\eO" (make-keymap)))
+(or (lookup-key (terminal-local-value 'function-key-map nil) "\e[")
+    (define-key (terminal-local-value 'function-key-map nil) "\e[" (make-keymap)))
+;; (or (lookup-key (terminal-local-value 'function-key-map nil) "\eO")
+;;    (define-key (terminal-local-value 'function-key-map nil) "\eO" (make-keymap)))
 
 ;; Miscellaneous keys
 (mapcar (function (lambda (key-binding)
-                   (define-key function-key-map
+                   (define-key (terminal-local-value 'function-key-map nil)
                      (car key-binding) (nth 1 key-binding))))
        '(
          ;; These are set up by termcap or terminfo
 ;; The numeric keypad keys.
 (let ((i 0))
   (while (< i 10)
-    (define-key function-key-map
+    (define-key (terminal-local-value 'function-key-map nil)
       (format "\eO%c" (+ i ?p))
       (vector (intern (format "kp-%d" i))))
     (setq i (1+ i))))
 ;; The numbered function keys.
 (let ((i 0))
   (while (< i 16)
-    (define-key function-key-map
+    (define-key (terminal-local-value 'function-key-map nil)
       (format "\e?%c" (+ i ?a))
       (vector (intern (format "f%d" (1+ i)))))
-    (define-key function-key-map
+    (define-key (terminal-local-value 'function-key-map nil)
       (format "\e?%c" (+ i ?A))
       (vector (intern (format "S-f%d" (1+ i)))))
     (setq i (1+ i))))
index 562f5c728c01fe525a951fd19bf28b3b015f76c8..32c667ce7cebbbe56a05f710b859bafd5e051081 100644 (file)
@@ -37,9 +37,9 @@
 
 ;;; Code:
 
-(define-key function-key-map "\C-a" (make-keymap))
+(define-key (terminal-local-value 'function-key-map nil) "\C-a" (make-keymap))
 (mapcar (function (lambda (key-definition)
-                   (define-key function-key-map
+                   (define-key (terminal-local-value 'function-key-map nil)
                      (car key-definition) (nth 1 key-definition))))
        '(
          ;; These might be set up by termcap and terminfo
index 7a61a3a70fbdadc7a2063e7cf9b7fc0b2e4e648d..8a354b15fea5dbeb5367e21dc74f34a8e02e9588 100644 (file)
 
 ;;; Commentary:
 
-;; X-win.el:  this file is loaded from ../lisp/startup.el when it recognizes
-;; that X windows are to be used.  Command line switches are parsed and those
-;; pertaining to X are processed and removed from the command line.  The
-;; X display is opened and hooks are set for popping up the initial window.
+;; X-win.el: this file defines functions to initialize the X window
+;; system and process X-specific command line parameters before
+;; creating the first X frame.
+
+;; Note that contrary to previous Emacs versions, the act of loading
+;; this file should not have the side effect of initializing the
+;; window system or processing command line arguments (this file is
+;; now loaded in loadup.el).  See the variables
+;; `handle-args-function-alist' and
+;; `window-system-initialization-alist' for more details.
 
 ;; startup.el will then examine startup files, and eventually call the hooks
 ;; which create the first window(s).
@@ -66,7 +72,7 @@
 ;; An alist of X options and the function which handles them.  See
 ;; ../startup.el.
 
-(if (not (eq window-system 'x))
+(if (not (fboundp 'x-create-frame))
     (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
 
 (require 'frame)
@@ -77,6 +83,7 @@
 (require 'menu-bar)
 (require 'fontset)
 (require 'x-dnd)
+(require 'server)
 
 (defvar x-invocation-args)
 
@@ -1160,27 +1167,26 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
 \f
 ;;;; Function keys
 
-(substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
-                          global-map)
-
-;; Map certain keypad keys into ASCII characters
-;; that people usually expect.
-(define-key function-key-map [backspace] [127])
-(define-key function-key-map [delete] [127])
-(define-key function-key-map [tab] [?\t])
-(define-key function-key-map [linefeed] [?\n])
-(define-key function-key-map [clear] [?\C-l])
-(define-key function-key-map [return] [?\C-m])
-(define-key function-key-map [escape] [?\e])
-(define-key function-key-map [M-backspace] [?\M-\d])
-(define-key function-key-map [M-delete] [?\M-\d])
-(define-key function-key-map [M-tab] [?\M-\t])
-(define-key function-key-map [M-linefeed] [?\M-\n])
-(define-key function-key-map [M-clear] [?\M-\C-l])
-(define-key function-key-map [M-return] [?\M-\C-m])
-(define-key function-key-map [M-escape] [?\M-\e])
-(define-key function-key-map [iso-lefttab] [backtab])
-(define-key function-key-map [S-iso-lefttab] [backtab])
+(defun x-setup-function-keys (frame)
+  "Set up `function-key-map' on FRAME for the X window system."
+  ;; Map certain keypad keys into ASCII characters that people usually expect.
+  (let ((m (terminal-local-value 'function-key-map frame)))
+    (define-key m [backspace] [127])
+    (define-key m [delete] [127])
+    (define-key m [tab] [?\t])
+    (define-key m [linefeed] [?\n])
+    (define-key m [clear] [?\C-l])
+    (define-key m [return] [?\C-m])
+    (define-key m [escape] [?\e])
+    (define-key m [M-backspace] [?\M-\d])
+    (define-key m [M-delete] [?\M-\d])
+    (define-key m [M-tab] [?\M-\t])
+    (define-key m [M-linefeed] [?\M-\n])
+    (define-key m [M-clear] [?\M-\C-l])
+    (define-key m [M-return] [?\M-\C-m])
+    (define-key m [M-escape] [?\M-\e])
+    (define-key m [iso-lefttab] [backtab])
+    (define-key m [S-iso-lefttab] [backtab])))
 
 ;; These tell read-char how to convert
 ;; these special chars to ASCII.
@@ -2242,7 +2248,7 @@ order until succeed.")
     (if text
        (remove-text-properties 0 (length text) '(foreign-selection nil) text))
     text))
-      
+
 ;;; Return the value of the current X selection.
 ;;; Consult the selection, and the cut buffer.  Treat empty strings
 ;;; as if they were unset.
@@ -2339,146 +2345,149 @@ order until succeed.")
     (or clip-text primary-text cut-text)
     ))
 
-\f
-;;; Do the actual X Windows setup here; the above code just defines
-;;; functions and variables that we use now.
-
-(setq command-line-args (x-handle-args command-line-args))
-
-;;; Make sure we have a valid resource name.
-(or (stringp x-resource-name)
-    (let (i)
-      (setq x-resource-name (invocation-name))
-
-      ;; Change any . or * characters in x-resource-name to hyphens,
-      ;; so as not to choke when we use it in X resource queries.
-      (while (setq i (string-match "[.*]" x-resource-name))
-       (aset x-resource-name i ?-))))
-
-(x-open-connection (or x-display-name
-                      (setq x-display-name (getenv "DISPLAY")))
-                  x-command-line-resources
-                  ;; Exit Emacs with fatal error if this fails.
-                  t)
-
-(setq frame-creation-function 'x-create-frame-with-faces)
-
-(setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
-                           x-cut-buffer-max))
-
-;; Setup the default fontset.
-(setup-default-fontset)
-
-;; Create the standard fontset.
-(create-fontset-from-fontset-spec standard-fontset-spec t)
-
-;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
-(create-fontset-from-x-resource)
-
-;; Try to create a fontset from a font specification which comes
-;; from initial-frame-alist, default-frame-alist, or X resource.
-;; A font specification in command line argument (i.e. -fn XXXX)
-;; should be already in default-frame-alist as a `font'
-;; parameter.  However, any font specifications in site-start
-;; library, user's init file (.emacs), and default.el are not
-;; yet handled here.
-
-(let ((font (or (cdr (assq 'font initial-frame-alist))
-               (cdr (assq 'font default-frame-alist))
-               (x-get-resource "font" "Font")))
-      xlfd-fields resolved-name)
-  (if (and font
-          (not (query-fontset font))
-          (setq resolved-name (x-resolve-font-name font))
-          (setq xlfd-fields (x-decompose-font-name font)))
-      (if (string= "fontset" (aref xlfd-fields xlfd-regexp-registry-subnum))
-         (new-fontset font (x-complement-fontset-spec xlfd-fields nil))
-       ;; Create a fontset from FONT.  The fontset name is
-       ;; generated from FONT.
-       (create-fontset-from-ascii-font font resolved-name "startup"))))
-
-;; Apply a geometry resource to the initial frame.  Put it at the end
-;; of the alist, so that anything specified on the command line takes
-;; precedence.
-(let* ((res-geometry (x-get-resource "geometry" "Geometry"))
-       parsed)
-  (if res-geometry
-      (progn
-       (setq parsed (x-parse-geometry res-geometry))
-       ;; If the resource specifies a position,
-       ;; call the position and size "user-specified".
-       (if (or (assq 'top parsed) (assq 'left parsed))
-           (setq parsed (cons '(user-position . t)
-                              (cons '(user-size . t) parsed))))
-       ;; All geometry parms apply to the initial frame.
-       (setq initial-frame-alist (append initial-frame-alist parsed))
-       ;; The size parms apply to all frames.
-       (if (assq 'height parsed)
-           (setq default-frame-alist
-                 (cons (cons 'height (cdr (assq 'height parsed)))
-                       default-frame-alist)))
-       (if (assq 'width parsed)
-           (setq default-frame-alist
-                 (cons (cons 'width (cdr (assq 'width parsed)))
-                       default-frame-alist))))))
-
-;; Check the reverseVideo resource.
-(let ((case-fold-search t))
-  (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
-    (if (and rv
-            (string-match "^\\(true\\|yes\\|on\\)$" rv))
-       (setq default-frame-alist
-             (cons '(reverse . t) default-frame-alist)))))
+(defun x-clipboard-yank ()
+  "Insert the clipboard contents, or the last stretch of killed text."
+  (interactive)
+  (let ((clipboard-text (x-selection-value 'CLIPBOARD))
+       (x-select-enable-clipboard t))
+    (if (and clipboard-text (> (length clipboard-text) 0))
+       (kill-new clipboard-text))
+    (yank)))
 
-;; Set x-selection-timeout, measured in milliseconds.
-(let ((res-selection-timeout
-       (x-get-resource "selectionTimeout" "SelectionTimeout")))
-  (setq x-selection-timeout 20000)
-  (if res-selection-timeout
-      (setq x-selection-timeout (string-to-number res-selection-timeout))))
+\f
+;;; Window system initialization.
 
 (defun x-win-suspend-error ()
   (error "Suspending an Emacs running under X makes no sense"))
-(add-hook 'suspend-hook 'x-win-suspend-error)
 
-;;; Arrange for the kill and yank functions to set and check the clipboard.
-(setq interprogram-cut-function 'x-select-text)
-(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
+(defvar x-initialized nil
+  "Non-nil if the X window system has been initialized.")
+
+(defun x-initialize-window-system ()
+  "Initialize Emacs for X frames and open the first connection to an X server."
+  ;; Make sure we have a valid resource name.
+  (or (stringp x-resource-name)
+      (let (i)
+       (setq x-resource-name (invocation-name))
+
+       ;; Change any . or * characters in x-resource-name to hyphens,
+       ;; so as not to choke when we use it in X resource queries.
+       (while (setq i (string-match "[.*]" x-resource-name))
+         (aset x-resource-name i ?-))))
+
+  (x-open-connection (or x-display-name
+                        (setq x-display-name (server-getenv "DISPLAY")))
+                    x-command-line-resources
+                    ;; Exit Emacs with fatal error if this fails and we
+                    ;; are the initial display.
+                    (eq initial-window-system 'x))
+
+  (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
+                             x-cut-buffer-max))
+
+  ;; Setup the default fontset.
+  (setup-default-fontset)
+
+  ;; Create the standard fontset.
+  (create-fontset-from-fontset-spec standard-fontset-spec t)
+
+  ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
+  (create-fontset-from-x-resource)
+
+  ;; Try to create a fontset from a font specification which comes
+  ;; from initial-frame-alist, default-frame-alist, or X resource.
+  ;; A font specification in command line argument (i.e. -fn XXXX)
+  ;; should be already in default-frame-alist as a `font'
+  ;; parameter.  However, any font specifications in site-start
+  ;; library, user's init file (.emacs), and default.el are not
+  ;; yet handled here.
+
+  (let ((font (or (cdr (assq 'font initial-frame-alist))
+                 (cdr (assq 'font default-frame-alist))
+                 (x-get-resource "font" "Font")))
+       xlfd-fields resolved-name)
+    (if (and font
+            (not (query-fontset font))
+            (setq resolved-name (x-resolve-font-name font))
+            (setq xlfd-fields (x-decompose-font-name font)))
+       (if (string= "fontset" (aref xlfd-fields xlfd-regexp-registry-subnum))
+           (new-fontset font (x-complement-fontset-spec xlfd-fields nil))
+         ;; Create a fontset from FONT.  The fontset name is
+         ;; generated from FONT.
+         (create-fontset-from-ascii-font font resolved-name "startup"))))
+
+  ;; Apply a geometry resource to the initial frame.  Put it at the end
+  ;; of the alist, so that anything specified on the command line takes
+  ;; precedence.
+  (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
+        parsed)
+    (if res-geometry
+       (progn
+         (setq parsed (x-parse-geometry res-geometry))
+         ;; If the resource specifies a position,
+         ;; call the position and size "user-specified".
+         (if (or (assq 'top parsed) (assq 'left parsed))
+             (setq parsed (cons '(user-position . t)
+                                (cons '(user-size . t) parsed))))
+         ;; All geometry parms apply to the initial frame.
+         (setq initial-frame-alist (append initial-frame-alist parsed))
+         ;; The size parms apply to all frames.
+         (if (assq 'height parsed)
+             (setq default-frame-alist
+                   (cons (cons 'height (cdr (assq 'height parsed)))
+                         default-frame-alist)))
+         (if (assq 'width parsed)
+             (setq default-frame-alist
+                   (cons (cons 'width (cdr (assq 'width parsed)))
+                         default-frame-alist))))))
+
+  ;; Check the reverseVideo resource.
+  (let ((case-fold-search t))
+    (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
+      (if (and rv
+              (string-match "^\\(true\\|yes\\|on\\)$" rv))
+         (setq default-frame-alist
+               (cons '(reverse . t) default-frame-alist)))))
 
-;;; Turn off window-splitting optimization; X is usually fast enough
-;;; that this is only annoying.
-(setq split-window-keep-point t)
+  ;; Set x-selection-timeout, measured in milliseconds.
+  (let ((res-selection-timeout
+        (x-get-resource "selectionTimeout" "SelectionTimeout")))
+    (setq x-selection-timeout 20000)
+    (if res-selection-timeout
+       (setq x-selection-timeout (string-to-number res-selection-timeout))))
 
-;; Don't show the frame name; that's redundant with X.
-(setq-default mode-line-frame-identification "  ")
+  ;; Don't let Emacs suspend under X.
+  (add-hook 'suspend-hook 'x-win-suspend-error)
 
-;; Motif direct handling of f10 wasn't working right,
-;; So temporarily we've turned it off in lwlib-Xm.c
-;; and turned the Emacs f10 back on.
-;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
-;; (if (featurep 'motif)
-;;     (global-set-key [f10] 'ignore))
+  ;; Turn off window-splitting optimization; X is usually fast enough
+  ;; that this is only annoying.
+  (setq split-window-keep-point t)
 
-;; Turn on support for mouse wheels.
-(mouse-wheel-mode 1)
+  ;; Motif direct handling of f10 wasn't working right,
+  ;; So temporarily we've turned it off in lwlib-Xm.c
+  ;; and turned the Emacs f10 back on.
+  ;; ;; Motif normally handles f10 itself, so don't try to handle it a second time.
+  ;; (if (featurep 'motif)
+  ;;     (global-set-key [f10] 'ignore))
 
+  ;; Turn on support for mouse wheels.
+  (mouse-wheel-mode 1)
 
-;; Enable CLIPBOARD copy/paste through menu bar commands.
-(menu-bar-enable-clipboard)
+  ;; Enable CLIPBOARD copy/paste through menu bar commands.
+  (menu-bar-enable-clipboard)
 
-;; Override Paste so it looks at CLIPBOARD first.
-(defun x-clipboard-yank ()
-  "Insert the clipboard contents, or the last stretch of killed text."
-  (interactive)
-  (let ((clipboard-text (x-selection-value 'CLIPBOARD))
-       (x-select-enable-clipboard t))
-    (if (and clipboard-text (> (length clipboard-text) 0))
-       (kill-new clipboard-text))
-    (yank)))
+  ;; Override Paste so it looks at CLIPBOARD first.
+  (define-key menu-bar-edit-menu [paste]
+    (cons "Paste" (cons "Paste text from clipboard or kill ring"
+                       'x-clipboard-yank)))
+
+  (setq x-initialized t))
+
+(add-to-list 'handle-args-function-alist '(x . x-handle-args))
+(add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces))
+(add-to-list 'window-system-initialization-alist '(x . x-initialize-window-system))
 
-(define-key menu-bar-edit-menu [paste]
-  (cons "Paste" (cons "Paste text from clipboard or kill ring"
-                     'x-clipboard-yank)))
+(provide 'x-win)
 
 ;; Initiate drag and drop
 (add-hook 'after-make-frame-functions 'x-dnd-init-frame)
index 17d7cde0e8ad6deec02f84c22e445a14085f2d1f..b99430da7ccd1bcc4768b82b5ccc43dba4982d8e 100644 (file)
 
 ;;; Code:
 
-;;; The terminal intialization C code file might have initialized
-;;; function keys F13->F60 from the termcap/terminfo information.  On
-;;; a PC-style keyboard these keys correspond to
-;;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-.  The
-;;; code here subsitutes the corresponding defintions in
-;;; function-key-map. This substitution is needed because if a key
-;;; definition if found in function-key-map, there are no further
-;;; lookups in other keymaps.
-(substitute-key-definition [f13] [S-f1] function-key-map) 
-(substitute-key-definition [f14] [S-f2] function-key-map)
-(substitute-key-definition [f15] [S-f3] function-key-map)
-(substitute-key-definition [f16] [S-f4] function-key-map)
-(substitute-key-definition [f17] [S-f5] function-key-map)
-(substitute-key-definition [f18] [S-f6] function-key-map)
-(substitute-key-definition [f19] [S-f7] function-key-map)
-(substitute-key-definition [f20] [S-f8] function-key-map)
-(substitute-key-definition [f21] [S-f9] function-key-map)
-(substitute-key-definition [f22] [S-f10] function-key-map)
-(substitute-key-definition [f23] [S-f11] function-key-map)
-(substitute-key-definition [f24] [S-f12] function-key-map)
-
-(substitute-key-definition [f25] [C-f1] function-key-map) 
-(substitute-key-definition [f26] [C-f2] function-key-map)
-(substitute-key-definition [f27] [C-f3] function-key-map)
-(substitute-key-definition [f28] [C-f4] function-key-map)
-(substitute-key-definition [f29] [C-f5] function-key-map)
-(substitute-key-definition [f30] [C-f6] function-key-map)
-(substitute-key-definition [f31] [C-f7] function-key-map)
-(substitute-key-definition [f32] [C-f8] function-key-map)
-(substitute-key-definition [f33] [C-f9] function-key-map)
-(substitute-key-definition [f34] [C-f10] function-key-map)
-(substitute-key-definition [f35] [C-f11] function-key-map)
-(substitute-key-definition [f36] [C-f12] function-key-map)
-
-(substitute-key-definition [f37] [C-S-f1] function-key-map) 
-(substitute-key-definition [f38] [C-S-f2] function-key-map)
-(substitute-key-definition [f39] [C-S-f3] function-key-map)
-(substitute-key-definition [f40] [C-S-f4] function-key-map)
-(substitute-key-definition [f41] [C-S-f5] function-key-map)
-(substitute-key-definition [f42] [C-S-f6] function-key-map)
-(substitute-key-definition [f43] [C-S-f7] function-key-map)
-(substitute-key-definition [f44] [C-S-f8] function-key-map)
-(substitute-key-definition [f45] [C-S-f9] function-key-map)
-(substitute-key-definition [f46] [C-S-f10] function-key-map)
-(substitute-key-definition [f47] [C-S-f11] function-key-map)
-(substitute-key-definition [f48] [C-S-f12] function-key-map)
-
-(substitute-key-definition [f49] [A-f1] function-key-map) 
-(substitute-key-definition [f50] [A-f2] function-key-map)
-(substitute-key-definition [f51] [A-f3] function-key-map)
-(substitute-key-definition [f52] [A-f4] function-key-map)
-(substitute-key-definition [f53] [A-f5] function-key-map)
-(substitute-key-definition [f54] [A-f6] function-key-map)
-(substitute-key-definition [f55] [A-f7] function-key-map)
-(substitute-key-definition [f56] [A-f8] function-key-map)
-(substitute-key-definition [f57] [A-f9] function-key-map)
-(substitute-key-definition [f58] [A-f10] function-key-map)
-(substitute-key-definition [f59] [A-f11] function-key-map)
-(substitute-key-definition [f60] [A-f12] function-key-map)
-
-(let ((map (make-sparse-keymap)))
-  (define-key map "\e[A" [up])
-  (define-key map "\e[B" [down])
-  (define-key map "\e[C" [right])
-  (define-key map "\e[D" [left])
-  (define-key map "\e[1~" [home])
-  (define-key map "\e[2~" [insert])
-  (define-key map "\e[3~" [delete])
-  (define-key map "\e[4~" [select])
-  (define-key map "\e[5~" [prior])
-  (define-key map "\e[6~" [next])
-  (define-key map "\e[11~" [f1])
-  (define-key map "\e[12~" [f2])
-  (define-key map "\e[13~" [f3])
-  (define-key map "\e[14~" [f4])
-  (define-key map "\e[15~" [f5])
-  (define-key map "\e[17~" [f6])
-  (define-key map "\e[18~" [f7])
-  (define-key map "\e[19~" [f8])
-  (define-key map "\e[20~" [f9])
-  (define-key map "\e[21~" [f10])
-  (define-key map "\e[23~" [f11])
-  (define-key map "\e[24~" [f12])
-  (define-key map "\e[29~" [print])
-
-  (define-key map "\eOP" [f1])
-  (define-key map "\eOQ" [f2])
-  (define-key map "\eOR" [f3])
-  (define-key map "\eOS" [f4])
-
-  (define-key map "\eO2P" [S-f1])
-  (define-key map "\eO2Q" [S-f2])
-  (define-key map "\eO2R" [S-f3])
-  (define-key map "\eO2S" [S-f4])
-  (define-key map "\e[15;2~" [S-f5])
-  (define-key map "\e[17;2~" [S-f6])
-  (define-key map "\e[18;2~" [S-f7])
-  (define-key map "\e[19;2~" [S-f8])
-  (define-key map "\e[20;2~" [S-f9])
-  (define-key map "\e[21;2~" [S-f10])
-  (define-key map "\e[23;2~" [S-f11])
-  (define-key map "\e[24;2~" [S-f12])
-
-  (define-key map "\eO5P" [C-f1])
-  (define-key map "\eO5Q" [C-f2])
-  (define-key map "\eO5R" [C-f3])
-  (define-key map "\eO5S" [C-f4])
-  (define-key map "\e[15;5~" [C-f5])
-  (define-key map "\e[17;5~" [C-f6])
-  (define-key map "\e[18;5~" [C-f7])
-  (define-key map "\e[19;5~" [C-f8])
-  (define-key map "\e[20;5~" [C-f9])
-  (define-key map "\e[21;5~" [C-f10])
-  (define-key map "\e[23;5~" [C-f11])
-  (define-key map "\e[24;5~" [C-f12])
-
-  (define-key map "\eO6P" [C-S-f1])
-  (define-key map "\eO6Q" [C-S-f2])
-  (define-key map "\eO6R" [C-S-f3])
-  (define-key map "\eO6S" [C-S-f4])
-  (define-key map "\e[15;6~" [C-S-f5])
-  (define-key map "\e[17;6~" [C-S-f6])
-  (define-key map "\e[18;6~" [C-S-f7])
-  (define-key map "\e[19;6~" [C-S-f8])
-  (define-key map "\e[20;6~" [C-S-f9])
-  (define-key map "\e[21;6~" [C-S-f10])
-  (define-key map "\e[23;6~" [C-S-f11])
-  (define-key map "\e[24;6~" [C-S-f12])
-
-  (define-key map "\eO3P" [A-f1])
-  (define-key map "\eO3Q" [A-f2])
-  (define-key map "\eO3R" [A-f3])
-  (define-key map "\eO3S" [A-f4])
-  (define-key map "\e[15;3~" [A-f5])
-  (define-key map "\e[17;3~" [A-f6])
-  (define-key map "\e[18;3~" [A-f7])
-  (define-key map "\e[19;3~" [A-f8])
-  (define-key map "\e[20;3~" [A-f9])
-  (define-key map "\e[21;3~" [A-f10])
-  (define-key map "\e[23;3~" [A-f11])
-  (define-key map "\e[24;3~" [A-f12])
-
-  (define-key map "\e[1;2A" [S-up])
-  (define-key map "\e[1;2B" [S-down])
-  (define-key map "\e[1;2C" [S-right])
-  (define-key map "\e[1;2D" [S-left])
-  (define-key map "\e[1;2F" [S-end])
-  (define-key map "\e[1;2H" [S-home])
-
-  (define-key map "\e[1;5A" [C-up])
-  (define-key map "\e[1;5B" [C-down])
-  (define-key map "\e[1;5C" [C-right])
-  (define-key map "\e[1;5D" [C-left])
-  (define-key map "\e[1;5F" [C-end])
-  (define-key map "\e[1;5H" [C-home])
-
-  (define-key map "\e[1;6A" [C-S-up])
-  (define-key map "\e[1;6B" [C-S-down])
-  (define-key map "\e[1;6C" [C-S-right])
-  (define-key map "\e[1;6D" [C-S-left])
-  (define-key map "\e[1;6F" [C-S-end])
-  (define-key map "\e[1;6H" [C-S-home])
-
-  (define-key map "\e[1;3A" [A-up])
-  (define-key map "\e[1;3B" [A-down])
-  (define-key map "\e[1;3C" [A-right])
-  (define-key map "\e[1;3D" [A-left])
-  (define-key map "\e[1;3F" [A-end])
-  (define-key map "\e[1;3H" [A-home])
-
-  (define-key map "\e[2;2~" [S-insert])
-  (define-key map "\e[3;2~" [S-delete])
-  (define-key map "\e[5;2~" [S-prior])
-  (define-key map "\e[6;2~" [S-next])
-
-  (define-key map "\e[2;5~" [C-insert])
-  (define-key map "\e[3;5~" [C-delete])
-  (define-key map "\e[5;5~" [C-prior])
-  (define-key map "\e[6;5~" [C-next])
-
-  (define-key map "\e[2;6~" [C-S-insert])
-  (define-key map "\e[3;6~" [C-S-delete])
-  (define-key map "\e[5;6~" [C-S-prior])
-  (define-key map "\e[6;6~" [C-S-next])
-
-  (define-key map "\e[2;3~" [A-insert])
-  (define-key map "\e[3;3~" [A-delete])
-  (define-key map "\e[5;3~" [A-prior])
-  (define-key map "\e[6;3~" [A-next])
-
-  (define-key map "\eOA" [up])
-  (define-key map "\eOB" [down])
-  (define-key map "\eOC" [right])
-  (define-key map "\eOD" [left])
-  (define-key map "\eOF" [end])
-  (define-key map "\eOH" [home])
-
-  (define-key map "\eO2A" [S-up])
-  (define-key map "\eO2B" [S-down])
-  (define-key map "\eO2C" [S-right])
-  (define-key map "\eO2D" [S-left])
-  (define-key map "\eO2F" [S-end])
-  (define-key map "\eO2H" [S-home])
-
-  (define-key map "\eO5A" [C-up])
-  (define-key map "\eO5B" [C-down])
-  (define-key map "\eO5C" [C-right])
-  (define-key map "\eO5D" [C-left])
-  (define-key map "\eO5F" [C-end])
-  (define-key map "\eO5H" [C-home])
-
-  ;; Use inheritance to let the main keymap override those defaults.
-  ;; This way we don't override terminfo-derived settings or settings
-  ;; made in the .emacs file.
-  (set-keymap-parent map (keymap-parent function-key-map))
-  (set-keymap-parent function-key-map map))
+(require 'server)
+
+(defvar xterm-function-map nil
+  "Function key map overrides for xterm.")
+
+;; The terminal intialization C code file might have initialized
+;; function keys F13->F60 from the termcap/terminfo information.  On
+;; a PC-style keyboard these keys correspond to
+;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-.  The
+;; code here subsitutes the corresponding defintions in
+;; function-key-map. This substitution is needed because if a key
+;; definition if found in function-key-map, there are no further
+;; lookups in other keymaps.
+(let ((m (terminal-local-value 'function-key-map nil)))
+  (substitute-key-definition [f13] [S-f1] m)
+  (substitute-key-definition [f14] [S-f2] m)
+  (substitute-key-definition [f15] [S-f3] m)
+  (substitute-key-definition [f16] [S-f4] m)
+  (substitute-key-definition [f17] [S-f5] m)
+  (substitute-key-definition [f18] [S-f6] m)
+  (substitute-key-definition [f19] [S-f7] m)
+  (substitute-key-definition [f20] [S-f8] m)
+  (substitute-key-definition [f21] [S-f9] m)
+  (substitute-key-definition [f22] [S-f10] m)
+  (substitute-key-definition [f23] [S-f11] m)
+  (substitute-key-definition [f24] [S-f12] m)
+
+  (substitute-key-definition [f25] [C-f1] m)
+  (substitute-key-definition [f26] [C-f2] m)
+  (substitute-key-definition [f27] [C-f3] m)
+  (substitute-key-definition [f28] [C-f4] m)
+  (substitute-key-definition [f29] [C-f5] m)
+  (substitute-key-definition [f30] [C-f6] m)
+  (substitute-key-definition [f31] [C-f7] m)
+  (substitute-key-definition [f32] [C-f8] m)
+  (substitute-key-definition [f33] [C-f9] m)
+  (substitute-key-definition [f34] [C-f10] m)
+  (substitute-key-definition [f35] [C-f11] m)
+  (substitute-key-definition [f36] [C-f12] m)
+
+  (substitute-key-definition [f37] [C-S-f1] m)
+  (substitute-key-definition [f38] [C-S-f2] m)
+  (substitute-key-definition [f39] [C-S-f3] m)
+  (substitute-key-definition [f40] [C-S-f4] m)
+  (substitute-key-definition [f41] [C-S-f5] m)
+  (substitute-key-definition [f42] [C-S-f6] m)
+  (substitute-key-definition [f43] [C-S-f7] m)
+  (substitute-key-definition [f44] [C-S-f8] m)
+  (substitute-key-definition [f45] [C-S-f9] m)
+  (substitute-key-definition [f46] [C-S-f10] m)
+  (substitute-key-definition [f47] [C-S-f11] m)
+  (substitute-key-definition [f48] [C-S-f12] m)
+
+  (substitute-key-definition [f49] [A-f1] m)
+  (substitute-key-definition [f50] [A-f2] m)
+  (substitute-key-definition [f51] [A-f3] m)
+  (substitute-key-definition [f52] [A-f4] m)
+  (substitute-key-definition [f53] [A-f5] m)
+  (substitute-key-definition [f54] [A-f6] m)
+  (substitute-key-definition [f55] [A-f7] m)
+  (substitute-key-definition [f56] [A-f8] m)
+  (substitute-key-definition [f57] [A-f9] m)
+  (substitute-key-definition [f58] [A-f10] m)
+  (substitute-key-definition [f59] [A-f11] m)
+  (substitute-key-definition [f60] [A-f12] m))
+
+;; Make reloads faster.
+(unless xterm-function-map
+  (setq xterm-function-map (make-sparse-keymap))
+
+  (define-key xterm-function-map "\e[A" [up])
+  (define-key xterm-function-map "\e[B" [down])
+  (define-key xterm-function-map "\e[C" [right])
+  (define-key xterm-function-map "\e[D" [left])
+  (define-key xterm-function-map "\e[1~" [home])
+  (define-key xterm-function-map "\e[2~" [insert])
+  (define-key xterm-function-map "\e[3~" [delete])
+  (define-key xterm-function-map "\e[4~" [select])
+  (define-key xterm-function-map "\e[5~" [prior])
+  (define-key xterm-function-map "\e[6~" [next])
+  (define-key xterm-function-map "\e[11~" [f1])
+  (define-key xterm-function-map "\e[12~" [f2])
+  (define-key xterm-function-map "\e[13~" [f3])
+  (define-key xterm-function-map "\e[14~" [f4])
+  (define-key xterm-function-map "\e[15~" [f5])
+  (define-key xterm-function-map "\e[17~" [f6])
+  (define-key xterm-function-map "\e[18~" [f7])
+  (define-key xterm-function-map "\e[19~" [f8])
+  (define-key xterm-function-map "\e[20~" [f9])
+  (define-key xterm-function-map "\e[21~" [f10])
+  (define-key xterm-function-map "\e[23~" [f11])
+  (define-key xterm-function-map "\e[24~" [f12])
+  (define-key xterm-function-map "\e[29~" [print])
+
+  (define-key xterm-function-map "\eOP" [f1])
+  (define-key xterm-function-map "\eOQ" [f2])
+  (define-key xterm-function-map "\eOR" [f3])
+  (define-key xterm-function-map "\eOS" [f4])
+
+  (define-key xterm-function-map "\eO2P" [S-f1])
+  (define-key xterm-function-map "\eO2Q" [S-f2])
+  (define-key xterm-function-map "\eO2R" [S-f3])
+  (define-key xterm-function-map "\eO2S" [S-f4])
+  (define-key xterm-function-map "\e[15;2~" [S-f5])
+  (define-key xterm-function-map "\e[17;2~" [S-f6])
+  (define-key xterm-function-map "\e[18;2~" [S-f7])
+  (define-key xterm-function-map "\e[19;2~" [S-f8])
+  (define-key xterm-function-map "\e[20;2~" [S-f9])
+  (define-key xterm-function-map "\e[21;2~" [S-f10])
+  (define-key xterm-function-map "\e[23;2~" [S-f11])
+  (define-key xterm-function-map "\e[24;2~" [S-f12])
+
+  (define-key xterm-function-map "\eO5P" [C-f1])
+  (define-key xterm-function-map "\eO5Q" [C-f2])
+  (define-key xterm-function-map "\eO5R" [C-f3])
+  (define-key xterm-function-map "\eO5S" [C-f4])
+  (define-key xterm-function-map "\e[15;5~" [C-f5])
+  (define-key xterm-function-map "\e[17;5~" [C-f6])
+  (define-key xterm-function-map "\e[18;5~" [C-f7])
+  (define-key xterm-function-map "\e[19;5~" [C-f8])
+  (define-key xterm-function-map "\e[20;5~" [C-f9])
+  (define-key xterm-function-map "\e[21;5~" [C-f10])
+  (define-key xterm-function-map "\e[23;5~" [C-f11])
+  (define-key xterm-function-map "\e[24;5~" [C-f12])
+
+  (define-key xterm-function-map "\eO6P" [C-S-f1])
+  (define-key xterm-function-map "\eO6Q" [C-S-f2])
+  (define-key xterm-function-map "\eO6R" [C-S-f3])
+  (define-key xterm-function-map "\eO6S" [C-S-f4])
+  (define-key xterm-function-map "\e[15;6~" [C-S-f5])
+  (define-key xterm-function-map "\e[17;6~" [C-S-f6])
+  (define-key xterm-function-map "\e[18;6~" [C-S-f7])
+  (define-key xterm-function-map "\e[19;6~" [C-S-f8])
+  (define-key xterm-function-map "\e[20;6~" [C-S-f9])
+  (define-key xterm-function-map "\e[21;6~" [C-S-f10])
+  (define-key xterm-function-map "\e[23;6~" [C-S-f11])
+  (define-key xterm-function-map "\e[24;6~" [C-S-f12])
+
+  (define-key xterm-function-map "\eO3P" [A-f1])
+  (define-key xterm-function-map "\eO3Q" [A-f2])
+  (define-key xterm-function-map "\eO3R" [A-f3])
+  (define-key xterm-function-map "\eO3S" [A-f4])
+  (define-key xterm-function-map "\e[15;3~" [A-f5])
+  (define-key xterm-function-map "\e[17;3~" [A-f6])
+  (define-key xterm-function-map "\e[18;3~" [A-f7])
+  (define-key xterm-function-map "\e[19;3~" [A-f8])
+  (define-key xterm-function-map "\e[20;3~" [A-f9])
+  (define-key xterm-function-map "\e[21;3~" [A-f10])
+  (define-key xterm-function-map "\e[23;3~" [A-f11])
+  (define-key xterm-function-map "\e[24;3~" [A-f12])
+
+  (define-key xterm-function-map "\e[1;2A" [S-up])
+  (define-key xterm-function-map "\e[1;2B" [S-down])
+  (define-key xterm-function-map "\e[1;2C" [S-right])
+  (define-key xterm-function-map "\e[1;2D" [S-left])
+  (define-key xterm-function-map "\e[1;2F" [S-end])
+  (define-key xterm-function-map "\e[1;2H" [S-home])
+
+  (define-key xterm-function-map "\e[1;5A" [C-up])
+  (define-key xterm-function-map "\e[1;5B" [C-down])
+  (define-key xterm-function-map "\e[1;5C" [C-right])
+  (define-key xterm-function-map "\e[1;5D" [C-left])
+  (define-key xterm-function-map "\e[1;5F" [C-end])
+  (define-key xterm-function-map "\e[1;5H" [C-home])
+
+  (define-key xterm-function-map "\e[1;6A" [C-S-up])
+  (define-key xterm-function-map "\e[1;6B" [C-S-down])
+  (define-key xterm-function-map "\e[1;6C" [C-S-right])
+  (define-key xterm-function-map "\e[1;6D" [C-S-left])
+  (define-key xterm-function-map "\e[1;6F" [C-S-end])
+  (define-key xterm-function-map "\e[1;6H" [C-S-home])
+
+  (define-key xterm-function-map "\e[1;3A" [A-up])
+  (define-key xterm-function-map "\e[1;3B" [A-down])
+  (define-key xterm-function-map "\e[1;3C" [A-right])
+  (define-key xterm-function-map "\e[1;3D" [A-left])
+  (define-key xterm-function-map "\e[1;3F" [A-end])
+  (define-key xterm-function-map "\e[1;3H" [A-home])
+
+  (define-key xterm-function-map "\e[2;2~" [S-insert])
+  (define-key xterm-function-map "\e[3;2~" [S-delete])
+  (define-key xterm-function-map "\e[5;2~" [S-prior])
+  (define-key xterm-function-map "\e[6;2~" [S-next])
+
+  (define-key xterm-function-map "\e[2;5~" [C-insert])
+  (define-key xterm-function-map "\e[3;5~" [C-delete])
+  (define-key xterm-function-map "\e[5;5~" [C-prior])
+  (define-key xterm-function-map "\e[6;5~" [C-next])
+
+  (define-key xterm-function-map "\e[2;6~" [C-S-insert])
+  (define-key xterm-function-map "\e[3;6~" [C-S-delete])
+  (define-key xterm-function-map "\e[5;6~" [C-S-prior])
+  (define-key xterm-function-map "\e[6;6~" [C-S-next])
+
+  (define-key xterm-function-map "\e[2;3~" [A-insert])
+  (define-key xterm-function-map "\e[3;3~" [A-delete])
+  (define-key xterm-function-map "\e[5;3~" [A-prior])
+  (define-key xterm-function-map "\e[6;3~" [A-next])
+
+  (define-key xterm-function-map "\eOA" [up])
+  (define-key xterm-function-map "\eOB" [down])
+  (define-key xterm-function-map "\eOC" [right])
+  (define-key xterm-function-map "\eOD" [left])
+  (define-key xterm-function-map "\eOF" [end])
+  (define-key xterm-function-map "\eOH" [home])
+
+  (define-key xterm-function-map "\eO2A" [S-up])
+  (define-key xterm-function-map "\eO2B" [S-down])
+  (define-key xterm-function-map "\eO2C" [S-right])
+  (define-key xterm-function-map "\eO2D" [S-left])
+  (define-key xterm-function-map "\eO2F" [S-end])
+  (define-key xterm-function-map "\eO2H" [S-home])
+
+  (define-key xterm-function-map "\eO5A" [C-up])
+  (define-key xterm-function-map "\eO5B" [C-down])
+  (define-key xterm-function-map "\eO5C" [C-right])
+  (define-key xterm-function-map "\eO5D" [C-left])
+  (define-key xterm-function-map "\eO5F" [C-end])
+  (define-key xterm-function-map "\eO5H" [C-home]))
+
+;; Use inheritance to let the main keymap override those defaults.
+;; This way we don't override terminfo-derived settings or settings
+;; made in the .emacs file.
+(let ((m (copy-keymap xterm-function-map)))
+  (set-keymap-parent m (keymap-parent (terminal-local-value 'function-key-map nil)))
+  (set-keymap-parent (terminal-local-value 'function-key-map nil) m))
 
 ;; Set up colors, for those versions of xterm that support it.
 (defvar xterm-standard-colors
@@ -278,7 +288,7 @@ for the currently selected frame.  The first 16 colors are taken from
 `xterm-standard-colors', which see, while the rest are computed assuming
 either the 88- or 256-color standard color scheme supported by latest
 versions of xterm."
-  (let* ((ncolors (display-color-cells))
+  (let* ((ncolors (display-color-cells (selected-frame)))
         (colors xterm-standard-colors)
         (color (car colors)))
     (if (> ncolors 0)
@@ -364,7 +374,7 @@ versions of xterm."
 ;; intelligent way than the default guesswork in startup.el.
 (defun xterm-rxvt-set-background-mode ()
   "Set background mode as appropriate for the default rxvt colors."
-  (let ((fgbg (getenv "COLORFGBG"))
+  (let ((fgbg (server-getenv "COLORFGBG"))
        bg rgb)
     (setq default-frame-background-mode 'light)
     (when (and fgbg
@@ -386,8 +396,8 @@ versions of xterm."
 (xterm-register-default-colors)
 ;; If this xterm is actually a disguised rxvt, be more intelligent about
 ;; determining the background mode.
-(and (getenv "COLORTERM")
-     (string-match "\\`rxvt" (getenv "COLORTERM"))
+(and (server-getenv "COLORTERM")
+     (string-match "\\`rxvt" (server-getenv "COLORTERM"))
      (xterm-rxvt-set-background-mode))
 ;; This recomputes all the default faces given the colors we've just set up.
 (tty-set-up-initial-frame-faces)
index 05fdde95221a96ec5a2f5430d2378f48bef876d9..d52e1e944c84ac24ab5b83659fe21cd35c9bb9a8 100644 (file)
@@ -55,8 +55,8 @@ to the system configuration; look at `system-configuration' instead."
   (interactive "P")
   (let ((version-string
          (format (if (not (interactive-p))
-                    "GNU Emacs %s (%s%s%s)\n of %s on %s"
-                  "GNU Emacs %s (%s%s%s) of %s on %s")
+                    "GNU Emacs %s (%s%s%s%s)\n of %s on %s"
+                  "GNU Emacs %s (%s%s%s%s) of %s on %s")
                  emacs-version
                 system-configuration
                 (cond ((featurep 'motif)
@@ -70,6 +70,7 @@ to the system configuration; look at `system-configuration' instead."
                     (format ", %s scroll bars"
                             (capitalize (symbol-name x-toolkit-scroll-bars)))
                   "")
+                (if (featurep 'multi-tty) ", multi-tty" "")
                 (format-time-string "%Y-%m-%d" emacs-build-time)
                  emacs-build-system)))
     (if here
index 0a4017a7b7c572d9fdf019e1cf7a6730b003365f..1e1291a5b5fcf6fde42b3dcbc441f0b7f65d7b30 100644 (file)
@@ -122,8 +122,9 @@ any protocol specific data.")
 
 (defun x-dnd-init-frame (&optional frame)
   "Setup drag and drop for FRAME (i.e. create appropriate properties)."
-  (x-dnd-init-xdnd-for-frame frame)
-  (x-dnd-init-motif-for-frame frame))
+  (when (eq 'x (window-system frame))
+    (x-dnd-init-xdnd-for-frame frame)
+    (x-dnd-init-motif-for-frame frame)))
 
 (defun x-dnd-get-state-cons-for-frame (frame-or-window)
   "Return the entry in x-dnd-current-state for a frame or window."
diff --git a/lispref/elisp-covers.texi b/lispref/elisp-covers.texi
deleted file mode 100644 (file)
index 66c3a3b..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-\input texinfo    @c -*-texinfo-*-
-@comment %**start of header
-@setfilename covers.info
-@settitle GNU Emacs Lisp Reference Manual
-@comment %**end of header
-
-@titlepage
-@c ================ Volume 1 ================
-@w{ }
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@page
-@c ================ Volume 2 ================
-@w{ }
-@sp 5
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 2}
-@sp 2
-@center by Bil Lewis,
-@center Dan LaLiberte, and
-@center the GNU Manual Group
-
-@page
-@c ================ Volume 1 with baseline skip 16pt ================
-
-@tex
-\global\baselineskip = 16pt
-@end tex
-
-16 pts baseline skip:
-
-@w{ }
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@page
-@c ================ Volume 1 with baseline skip 18pt ================
-
-@tex
-\global\baselineskip = 18pt
-@end tex
-
-18 pts baseline skip, with 15pts  between sections
-
-@w{ }
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@tex
-\global\baselineskip = 15pt
-@end tex
-
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis,
-@center Dan LaLiberte, and
-@center the GNU Manual Group
-
-@page
-@c ================ Volume 1 with more baseline skip 24 pts ================
-
-@tex
-\global\baselineskip = 24pt
-@end tex
-
-24 pts baseline skip:
-
-@w{ }
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@page
-@c ================ Volume 2 with more baseline skip 18 pts ================
-
-@tex
-\global\baselineskip = 18pt
-@end tex
-
-18 pts baseline skip:
-
-@w{ }
-@sp 5
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 2}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@page
-@c ================ Volume 2 with more baseline skip 24 pts ================
-
-@tex
-\global\baselineskip = 24pt
-@end tex
-
-24 pts baseline skip:
-
-@w{ }
-@sp 5
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 2}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-
-@page
-@c ================  Spine 1 ================
-
-@w{@titlefont{The GNU Emacs Lisp Reference Manual --- Vol. 1}}
-@sp 4
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 4
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@sp 4
-@author The GNU Emacs Lisp Reference Manual --- Vol. 1
-@sp 3
-@author FSF
-
-@author
-
-@page
-@c ================  Spine 2 ================
-
-@w{@titlefont{The GNU Emacs Lisp Reference Manual --- Vol. 2}}
-@sp 4
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 4
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-
-@sp 4
-@author The GNU Emacs Lisp Reference Manual --- Vol. 2
-@sp 3
-@author FSF
-
-@end titlepage
-@bye
-
-@ignore
-   arch-tag: 02d65d63-3b64-49bc-a5c0-bfd5eabb6c98
-@end ignore
index a216064516f5a8d3b2aacac776b7eb72270fb335..1a2c438565893d2163b5d9447be3b5ce4926c2a5 100644 (file)
@@ -1006,6 +1006,7 @@ shortlisp = 
        {Lisp}abbrev.elc ¶
        {Lisp}buff-menu.elc ¶
        {Lisp}button.elc ¶
+       {Lisp}server.elc ¶
        {Lisp}emacs-lisp:byte-run.elc ¶
        {Lisp}cus-face.elc ¶
        {Lisp}cus-start.elc ¶
index a98d4c9932f2eab25dd5266157c64d920a529b91..69aac5da9e46d2d8b7f9f2a9f3d3966b4488169f 100644 (file)
@@ -2,8 +2,10 @@
 source ^\.(gdbinit|dbxinit)$
 
 # Auto-generated files, which ignore
-precious ^(config\.stamp|config\.h|epaths\.h)$
+precious ^(config\.stamp|config\.h|epaths\.h|TAGS-LISP)$
+precious ^(buildobj\.lst)$
 
 backup ^(stamp-oldxmenu|prefix-args|temacs|emacs|emacs-[0-9.]*)$
+backup ^(bootstrap-emacs)$
 
 # arch-tag: 277cc7ae-b3f5-44af-abf1-84c073164543
index 8b1dcb4df5b85d1c49ed6d32bee479e955682228..66b9e64ec7a8f1cbd364200828f846da46495c37 100644 (file)
@@ -705,7 +705,7 @@ set print sevenbit-strings
 
 show environment DISPLAY
 show environment TERM
-set args -geometry 80x40+0+0
+#set args -geometry 80x40+0+0
 
 # Don't let abort actually run, as it will make
 # stdio stop working and therefore the `pr' command above as well.
index 88b71d4d1e2f5a159d4f5be0612b02430d3fe0de..d118557db376ba3774a77b63c23a970656c1724d 100644 (file)
@@ -707,6 +707,7 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj) $(LIBO
 lisp= \
        ${lispsource}abbrev.elc \
        ${lispsource}buff-menu.elc \
+       ${lispsource}server.elc \
        ${lispsource}button.elc \
        ${lispsource}emacs-lisp/byte-run.elc \
        ${lispsource}cus-face.elc \
@@ -801,6 +802,7 @@ lisp= \
 shortlisp= \
        ../lisp/abbrev.elc \
        ../lisp/buff-menu.elc \
+       ../lisp/server.elc \
        ../lisp/button.elc \
        ../lisp/emacs-lisp/byte-run.elc \
        ../lisp/cus-face.elc \
@@ -896,7 +898,10 @@ SOME_MACHINE_LISP = ${dotdot}/lisp/mouse.elc \
   ${dotdot}/lisp/disp-table.elc ${dotdot}/lisp/dos-vars.elc \
   ${dotdot}/lisp/tooltip.elc \
   ${dotdot}/lisp/international/ccl.elc \
-  ${dotdot}/lisp/international/codepage.elc
+  ${dotdot}/lisp/international/codepage.elc \
+  ${dotdot}/lisp/mouse.elc ${dotdot}/lisp/international/fontset.elc \
+  ${dotdot}/lisp/dnd.elc ${dotdot}/lisp/x-dnd.elc \
+  ${dotdot}/lisp/term/x-win.elc
 
 /* Construct full set of libraries to be linked.
    Note that SunOS needs -lm to come before -lc; otherwise, you get
@@ -942,7 +947,7 @@ emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp}
    for the first time, this prevents any variation between configurations
    in the contents of the DOC file.
    Likewise for ${SOME_MACHINE_LISP}.  */
-${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${shortlisp} ${SOME_MACHINE_LISP}
+${etc}DOC: ${libsrc}make-docfile ${obj} ${shortlisp} ${SOME_MACHINE_LISP}
        -rm -f ${etc}DOC
        ${libsrc}make-docfile -d ${srcdir} ${SOME_MACHINE_OBJECTS} ${obj} > ${etc}DOC
        ${libsrc}make-docfile -a ${etc}DOC -d ${srcdir} ${SOME_MACHINE_LISP} ${shortlisp}
@@ -1074,8 +1079,8 @@ ccl.o: ccl.c ccl.h charset.h coding.h $(config_h)
 charset.o: charset.c charset.h buffer.h coding.h composite.h disptab.h \
        $(config_h)
 coding.o: coding.c coding.h ccl.h buffer.h charset.h intervals.h composite.h \
-       window.h dispextern.h $(config_h)
-cm.o: cm.c cm.h termhooks.h $(config_h)
+       window.h dispextern.h frame.h termhooks.h $(config_h)
+cm.o: cm.c frame.h cm.h termhooks.h termchar.h $(config_h)
 cmds.o: cmds.c syntax.h buffer.h charset.h commands.h window.h $(config_h) \
        msdos.h dispextern.h keyboard.h keymap.h
 pre-crt0.o: pre-crt0.c
@@ -1083,7 +1088,7 @@ ecrt0.o: ecrt0.c $(config_h)
        CRT0_COMPILE ${srcdir}/ecrt0.c
 dired.o: dired.c commands.h buffer.h $(config_h) charset.h coding.h regex.h \
    systime.h
-dispnew.o: dispnew.c  systty.h systime.h commands.h process.h frame.h \
+dispnew.o: dispnew.c systime.h commands.h process.h frame.h \
    window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \
    disptab.h indent.h intervals.h \
    xterm.h blockinput.h atimer.h charset.h msdos.h composite.h keyboard.h \
@@ -1098,15 +1103,15 @@ emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
    termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \
    window.h dispextern.h keyboard.h keymap.h
 fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \
-   coding.h msdos.h dispextern.h $(config_h)
+   coding.h ccl.h msdos.h dispextern.h $(config_h)
 filelock.o: filelock.c buffer.h charset.h coding.h systime.h epaths.h $(config_h)
 filemode.o: filemode.c  $(config_h)
 frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
    blockinput.h atimer.h systime.h buffer.h charset.h fontset.h \
-   msdos.h dosfns.h dispextern.h w32term.h macterm.h $(config_h)
-fringe.o: fringe.c dispextern.h frame.h window.h buffer.h $(config_h)
+   msdos.h dosfns.h dispextern.h w32term.h macterm.h termchar.h $(config_h)
+fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h $(config_h)
 fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h charset.h frame.h \
-   keyboard.h $(config_h)
+   keyboard.h termhooks.h $(config_h)
 getloadavg.o: getloadavg.c $(config_h)
 image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \
    systime.h xterm.h w32term.h w32gui.h macterm.h macgui.h $(config_h)
@@ -1117,7 +1122,7 @@ insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h charset.h \
    dispextern.h atimer.h systime.h region-cache.h $(config_h)
 keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h charset.h \
    commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
-   systty.h systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
+   systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
    atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h)
 keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
    atimer.h systime.h puresize.h charset.h intervals.h $(config_h)
@@ -1131,7 +1136,8 @@ vm-limit.o: vm-limit.c mem-limits.h $(config_h)
 marker.o: marker.c buffer.h charset.h $(config_h)
 md5.o: md5.c md5.h $(config_h)
 minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \
-   buffer.h commands.h charset.h msdos.h $(INTERVAL_SRC) keymap.h $(config_h)
+   buffer.h commands.h charset.h msdos.h $(INTERVAL_SRC) keymap.h \
+   termhooks.h $(config_h)
 mktime.o: mktime.c $(config_h)
 msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
    termopts.h termchar.h charset.h coding.h ccl.h disptab.h window.h \
@@ -1143,7 +1149,7 @@ process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
 regex.o: regex.c syntax.h buffer.h $(config_h) regex.h category.h charset.h
 region-cache.o: region-cache.c buffer.h region-cache.h $(config_h)
 scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
-   $(config_h)
+   termhooks.h $(config_h)
 search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
    blockinput.h atimer.h systime.h category.h charset.h composite.h \
    $(INTERVAL_SRC) $(config_h)
@@ -1152,7 +1158,7 @@ syntax.o: syntax.c syntax.h buffer.h commands.h category.h charset.h \
    composite.h keymap.h regex.h $(INTERVAL_SRC) $(config_h)
 sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
    process.h dispextern.h termhooks.h termchar.h termopts.h \
-   frame.h atimer.h window.h msdos.h dosfns.h keyboard.h  $(config_h)
+   frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h $(config_h)
 term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \
    disptab.h dispextern.h keyboard.h charset.h coding.h ccl.h msdos.h \
    window.h keymap.h
@@ -1169,7 +1175,7 @@ w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
 widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
    $(srcdir)/../lwlib/lwlib.h $(config_h)
 window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
-   termhooks.h disptab.h keyboard.h dispextern.h msdos.h composite.h \
+   disptab.h keyboard.h dispextern.h msdos.h composite.h \
    keymap.h blockinput.h $(INTERVAL_SRC) xterm.h w32term.h macterm.h $(config_h)
 xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h coding.h \
    termchar.h frame.h window.h disptab.h termhooks.h charset.h $(config_h) \
@@ -1177,10 +1183,11 @@ xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h co
    msdos.h composite.h fontset.h blockinput.h atimer.h systime.h keymap.h
 xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
    window.h charset.h msdos.h dosfns.h composite.h atimer.h systime.h \
-   keyboard.h fontset.h w32term.h macterm.h $(INTERVAL_SRC) $(config_h)
+   keyboard.h fontset.h w32term.h macterm.h $(INTERVAL_SRC) termchar.h \
+   termhooks.h $(config_h)
 xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
    $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
-   charset.h gtkutil.h $(config_h)
+   charset.h gtkutil.h termchar.h termhooks.h $(config_h)
 xmenu.o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h buffer.h \
    keyboard.h $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h \
    gtkutil.h msdos.h coding.h $(config_h)
@@ -1189,7 +1196,7 @@ xterm.o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h buffer.h \
   keyboard.h gnu.h charset.h ccl.h fontset.h composite.h \
   coding.h process.h gtkutil.h $(config_h)
 xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
-  buffer.h atimer.h systime.h $(config_h)
+  buffer.h atimer.h systime.h termhooks.h $(config_h)
 xrdb.o: xrdb.c $(config_h) epaths.h
 xsmfns.o: xsmfns.c $(config_h) systime.h sysselect.h termhooks.h xterm.h \
   lisp.h termopts.h
@@ -1214,7 +1221,8 @@ fns.o: fns.c commands.h $(config_h) frame.h buffer.h charset.h keyboard.h \
  keymap.h frame.h window.h dispextern.h $(INTERVAL_SRC) coding.h md5.h \
  blockinput.h xterm.h
 print.o: print.c process.h frame.h window.h buffer.h keyboard.h charset.h \
-   $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h
+   $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h \
+   termchar.h
 lread.o: lread.c commands.h keyboard.h buffer.h epaths.h charset.h \
  $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h
 
@@ -1229,7 +1237,7 @@ composite.o: composite.c buffer.h  charset.h $(INTERVAL_SRC) $(config_h)
    OTHER_FILES and OBJECTS_MACHINE
    select which of these should be compiled.  */
 
-sunfns.o: sunfns.c buffer.h window.h dispextern.h $(config_h)
+sunfns.o: sunfns.c buffer.h window.h dispextern.h termhooks.h $(config_h)
 
 #ifdef HAVE_CARBON
 abbrev.o buffer.o callint.o cmds.o dispnew.o editfns.o fileio.o frame.o \
index f3c43106087d005ddd346345d66a00c001776390..dddfda828e6afc465e4df8918d8434f7158aaa30 100644 (file)
@@ -303,6 +303,7 @@ EMACS_INT gcs_done;         /* accumulated GCs  */
 
 static void mark_buffer P_ ((Lisp_Object));
 extern void mark_kboards P_ ((void));
+extern void mark_ttys P_ ((void));
 extern void mark_backtrace P_ ((void));
 static void gc_sweep P_ ((void));
 static void mark_glyph_matrix P_ ((struct glyph_matrix *));
@@ -4785,6 +4786,7 @@ returns nil, because real GC can't be done.  */)
       mark_object (bind->old_value);
     }
   mark_kboards ();
+  mark_ttys ();
 
 #ifdef USE_GTK
   {
index 41567be2018619821c7418351e113f7e45bf241a..16df7273149ac80bee320390e6b44f6478bb65b3 100644 (file)
--- a/src/cm.c
+++ b/src/cm.c
@@ -22,8 +22,13 @@ Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
 #include <stdio.h>
+
+#include "lisp.h"
+#include "frame.h"
 #include "cm.h"
 #include "termhooks.h"
+#include "termchar.h"
+
 
 /* For now, don't try to include termcap.h.  On some systems,
    configure finds a non-standard termcap.h that the main build
@@ -52,13 +57,16 @@ evalcost (c)
   return c;
 }
 
+/* The terminal to use for low-level output. */
+struct tty_display_info *current_tty;
+
 int
 cmputc (c)
      char c;
 {
-  if (termscript)
-    fputc (c & 0177, termscript);
-  putchar (c & 0177);
+  if (current_tty->termscript)
+    putc (c & 0177, current_tty->termscript);
+  putc (c & 0177, current_tty->output);
   return c;
 }
 
@@ -71,9 +79,9 @@ cmputc (c)
  */
 
 static
-at (row, col) {
-    curY = row;
-    curX = col;
+at (tty, row, col) {
+  curY (tty) = row;
+  curX (tty)  = col;
 }
 
 /*
@@ -81,8 +89,8 @@ at (row, col) {
  */
 
 static
-addcol (n) {
-    curX += n;
+addcol (tty, n) {
+  curX (tty) += n;
 
     /*
      * If cursor hit edge of screen, what happened?
@@ -92,21 +100,21 @@ addcol (n) {
      * of the last line.
      */
 
-    if (curX == Wcm.cm_cols) {
+  if (curX (tty) == tty->Wcm->cm_cols) {
        /*
         * Well, if magicwrap, still there, past the edge of the
         * screen (!).  If autowrap, on the col 0 of the next line.
         * Otherwise on last column.
         */
 
-       if (Wcm.cm_magicwrap)
+       if (tty->Wcm->cm_magicwrap)
            ;                   /* "limbo" */
-       else if (Wcm.cm_autowrap) {
-           curX = 0;
-           curY++;             /* Beware end of screen! */
+       else if (tty->Wcm->cm_autowrap) {
+          curX (tty) = 0;
+          curY (tty) ++;               /* Beware end of screen! */
        }
        else
-           curX--;
+          curX (tty)--;
     }
 }
 #endif
@@ -122,20 +130,20 @@ addcol (n) {
  * after we reach the last column; this takes us to a known state.
  */
 void
-cmcheckmagic ()
+cmcheckmagic (struct tty_display_info *tty)
 {
-  if (curX == FrameCols)
+  if (curX (tty) == FrameCols (tty))
     {
-      if (!MagicWrap || curY >= FrameRows - 1)
+      if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1)
        abort ();
-      if (termscript)
-       putc ('\r', termscript);
-      putchar ('\r');
-      if (termscript)
-       putc ('\n', termscript);
-      putchar ('\n');
-      curX = 0;
-      curY++;
+      if (tty->termscript)
+       putc ('\r', tty->termscript);
+      putc ('\r', tty->output);
+      if (tty->termscript)
+       putc ('\n', tty->termscript);
+      putc ('\n', tty->output);
+      curX (tty) = 0;
+      curY (tty)++;
     }
 }
 
@@ -147,21 +155,21 @@ cmcheckmagic ()
  */
 
 void
-cmcostinit ()
+cmcostinit (struct tty_display_info *tty)
 {
     char *p;
 
 #define        COST(x,e)       (x ? (cost = 0, tputs (x, 1, e), cost) : BIG)
 #define CMCOST(x,e)    ((x == 0) ? BIG : (p = tgoto(x, 0, 0), COST(p ,e)))
 
-    Wcm.cc_up =                COST (Wcm.cm_up, evalcost);
-    Wcm.cc_down =      COST (Wcm.cm_down, evalcost);
-    Wcm.cc_left =      COST (Wcm.cm_left, evalcost);
-    Wcm.cc_right =     COST (Wcm.cm_right, evalcost);
-    Wcm.cc_home =      COST (Wcm.cm_home, evalcost);
-    Wcm.cc_cr =                COST (Wcm.cm_cr, evalcost);
-    Wcm.cc_ll =                COST (Wcm.cm_ll, evalcost);
-    Wcm.cc_tab =       Wcm.cm_tabwidth ? COST (Wcm.cm_tab, evalcost) : BIG;
+    tty->Wcm->cc_up =   COST (tty->Wcm->cm_up, evalcost);
+    tty->Wcm->cc_down =         COST (tty->Wcm->cm_down, evalcost);
+    tty->Wcm->cc_left =         COST (tty->Wcm->cm_left, evalcost);
+    tty->Wcm->cc_right = COST (tty->Wcm->cm_right, evalcost);
+    tty->Wcm->cc_home =         COST (tty->Wcm->cm_home, evalcost);
+    tty->Wcm->cc_cr =   COST (tty->Wcm->cm_cr, evalcost);
+    tty->Wcm->cc_ll =   COST (tty->Wcm->cm_ll, evalcost);
+    tty->Wcm->cc_tab =  tty->Wcm->cm_tabwidth ? COST (tty->Wcm->cm_tab, evalcost) : BIG;
 
     /*
      * These last three are actually minimum costs.  When (if) they are
@@ -172,9 +180,9 @@ cmcostinit ()
      * cursor motion seem to take straight numeric values.  --ACT)
      */
 
-    Wcm.cc_abs =  CMCOST (Wcm.cm_abs, evalcost);
-    Wcm.cc_habs = CMCOST (Wcm.cm_habs, evalcost);
-    Wcm.cc_vabs = CMCOST (Wcm.cm_vabs, evalcost);
+    tty->Wcm->cc_abs =  CMCOST (tty->Wcm->cm_abs, evalcost);
+    tty->Wcm->cc_habs = CMCOST (tty->Wcm->cm_habs, evalcost);
+    tty->Wcm->cc_vabs = CMCOST (tty->Wcm->cm_vabs, evalcost);
 
 #undef CMCOST
 #undef COST
@@ -187,8 +195,8 @@ cmcostinit ()
  */
 
 static int
-calccost (srcy, srcx, dsty, dstx, doit)
-     int srcy, srcx, dsty, dstx, doit;
+calccost (struct tty_display_info *tty,
+          int srcy, int srcx, int dsty, int dstx, int doit)
 {
     register int    deltay,
                     deltax,
@@ -205,16 +213,16 @@ calccost (srcy, srcx, dsty, dstx, doit)
        don't believe the cursor position: give up here
        and force use of absolute positioning.  */
 
-    if (curX == Wcm.cm_cols)
+    if (curX (tty) == tty->Wcm->cm_cols)
       goto fail;
 
     totalcost = 0;
     if ((deltay = dsty - srcy) == 0)
        goto x;
     if (deltay < 0)
-       p = Wcm.cm_up, c = Wcm.cc_up, deltay = -deltay;
+       p = tty->Wcm->cm_up, c = tty->Wcm->cc_up, deltay = -deltay;
     else
-       p = Wcm.cm_down, c = Wcm.cc_down;
+       p = tty->Wcm->cm_down, c = tty->Wcm->cc_down;
     if (c == BIG) {            /* caint get thar from here */
        if (doit)
            printf ("OOPS");
@@ -223,16 +231,16 @@ calccost (srcy, srcx, dsty, dstx, doit)
     totalcost = c * deltay;
     if (doit)
        while (--deltay >= 0)
-           tputs (p, 1, cmputc);
+          emacs_tputs (tty, p, 1, cmputc);
 x:
     if ((deltax = dstx - srcx) == 0)
        goto done;
     if (deltax < 0) {
-       p = Wcm.cm_left, c = Wcm.cc_left, deltax = -deltax;
+       p = tty->Wcm->cm_left, c = tty->Wcm->cc_left, deltax = -deltax;
        goto dodelta;           /* skip all the tab junk */
     }
     /* Tabs (the toughie) */
-    if (Wcm.cc_tab >= BIG || !Wcm.cm_usetabs)
+    if (tty->Wcm->cc_tab >= BIG || !tty->Wcm->cm_usetabs)
        goto olddelta;          /* forget it! */
 
     /*
@@ -243,12 +251,12 @@ x:
      * we will put into tabx (for ntabs) and tab2x (for n2tabs)).
      */
 
-    ntabs = (deltax + srcx % Wcm.cm_tabwidth) / Wcm.cm_tabwidth;
+    ntabs = (deltax + srcx % tty->Wcm->cm_tabwidth) / tty->Wcm->cm_tabwidth;
     n2tabs = ntabs + 1;
-    tabx = (srcx / Wcm.cm_tabwidth + ntabs) * Wcm.cm_tabwidth;
-    tab2x = tabx + Wcm.cm_tabwidth;
+    tabx = (srcx / tty->Wcm->cm_tabwidth + ntabs) * tty->Wcm->cm_tabwidth;
+    tab2x = tabx + tty->Wcm->cm_tabwidth;
 
-    if (tab2x >= Wcm.cm_cols)  /* too far (past edge) */
+    if (tab2x >= tty->Wcm->cm_cols)    /* too far (past edge) */
        n2tabs = 0;
 
     /*
@@ -256,12 +264,12 @@ x:
      * for using n2tabs, then pick the minimum.
      */
 
-                  /* cost for ntabs     +    cost for right motion */
-    tabcost = ntabs ? ntabs * Wcm.cc_tab + (dstx - tabx) * Wcm.cc_right
+                  /* cost for ntabs           +    cost for right motion */
+    tabcost = ntabs ? ntabs * tty->Wcm->cc_tab + (dstx - tabx) * tty->Wcm->cc_right
                    : BIG;
 
-                  /* cost for n2tabs    +    cost for left motion */
-    c = n2tabs  ?    n2tabs * Wcm.cc_tab + (tab2x - dstx) * Wcm.cc_left
+                  /* cost for n2tabs          +    cost for left motion */
+    c = n2tabs  ?    n2tabs * tty->Wcm->cc_tab + (tab2x - dstx) * tty->Wcm->cc_left
                : BIG;
 
     if (c < tabcost)           /* then cheaper to overshoot & back up */
@@ -274,11 +282,11 @@ x:
      * See if tabcost is less than just moving right
      */
 
-    if (tabcost < (deltax * Wcm.cc_right)) {
+    if (tabcost < (deltax * tty->Wcm->cc_right)) {
        totalcost += tabcost;   /* use the tabs */
        if (doit)
            while (--ntabs >= 0)
-               tputs (Wcm.cm_tab, 1, cmputc);
+              emacs_tputs (tty, tty->Wcm->cm_tab, 1, cmputc);
        srcx = tabx;
     }
 
@@ -291,9 +299,9 @@ newdelta:
        goto done;
 olddelta:
     if (deltax > 0)
-       p = Wcm.cm_right, c = Wcm.cc_right;
+       p = tty->Wcm->cm_right, c = tty->Wcm->cc_right;
     else
-       p = Wcm.cm_left, c = Wcm.cc_left, deltax = -deltax;
+       p = tty->Wcm->cm_left, c = tty->Wcm->cc_left, deltax = -deltax;
 
 dodelta:
     if (c == BIG) {            /* caint get thar from here */
@@ -305,7 +313,7 @@ fail:
     totalcost += c * deltax;
     if (doit)
        while (--deltax >= 0)
-           tputs (p, 1, cmputc);
+          emacs_tputs (tty, p, 1, cmputc);
 done:
     return totalcost;
 }
@@ -323,7 +331,8 @@ losecursor ()
 #define        USECR   3
 
 void
-cmgoto (row, col)
+cmgoto (tty, row, col)
+     struct tty_display_info *tty;
      int row, col;
 {
     int     homecost,
@@ -336,47 +345,47 @@ cmgoto (row, col)
            *dcm;
 
   /* First the degenerate case */
-  if (row == curY && col == curX) /* already there */
+    if (row == curY (tty) && col == curX (tty)) /* already there */
     return;
 
-  if (curY >= 0 && curX >= 0)
+    if (curY (tty) >= 0 && curX (tty) >= 0)
     {
       /* We may have quick ways to go to the upper-left, bottom-left,
        * start-of-line, or start-of-next-line.  Or it might be best to
        * start where we are.  Examine the options, and pick the cheapest.
        */
 
-      relcost = calccost (curY, curX, row, col, 0);
+      relcost = calccost (tty, curY (tty), curX (tty), row, col, 0);
       use = USEREL;
-      if ((homecost = Wcm.cc_home) < BIG)
-         homecost += calccost (0, 0, row, col, 0);
+      if ((homecost = tty->Wcm->cc_home) < BIG)
+          homecost += calccost (tty, 0, 0, row, col, 0);
       if (homecost < relcost)
-         relcost = homecost, use = USEHOME;
-      if ((llcost = Wcm.cc_ll) < BIG)
-         llcost += calccost (Wcm.cm_rows - 1, 0, row, col, 0);
+          relcost = homecost, use = USEHOME;
+      if ((llcost = tty->Wcm->cc_ll) < BIG)
+          llcost += calccost (tty, tty->Wcm->cm_rows - 1, 0, row, col, 0);
       if (llcost < relcost)
-         relcost = llcost, use = USELL;
-      if ((crcost = Wcm.cc_cr) < BIG) {
-         if (Wcm.cm_autolf)
-             if (curY + 1 >= Wcm.cm_rows)
-                 crcost = BIG;
+          relcost = llcost, use = USELL;
+      if ((crcost = tty->Wcm->cc_cr) < BIG) {
+         if (tty->Wcm->cm_autolf)
+            if (curY (tty) + 1 >= tty->Wcm->cm_rows)
+                crcost = BIG;
              else
-                 crcost += calccost (curY + 1, 0, row, col, 0);
+                crcost += calccost (tty, curY (tty) + 1, 0, row, col, 0);
          else
-             crcost += calccost (curY, 0, row, col, 0);
+            crcost += calccost (tty, curY (tty), 0, row, col, 0);
       }
       if (crcost < relcost)
          relcost = crcost, use = USECR;
-      directcost = Wcm.cc_abs, dcm = Wcm.cm_abs;
-      if (row == curY && Wcm.cc_habs < BIG)
-         directcost = Wcm.cc_habs, dcm = Wcm.cm_habs;
-      else if (col == curX && Wcm.cc_vabs < BIG)
-         directcost = Wcm.cc_vabs, dcm = Wcm.cm_vabs;
+      directcost = tty->Wcm->cc_abs, dcm = tty->Wcm->cm_abs;
+      if (row == curY (tty) && tty->Wcm->cc_habs < BIG)
+         directcost = tty->Wcm->cc_habs, dcm = tty->Wcm->cm_habs;
+      else if (col == curX (tty) && tty->Wcm->cc_vabs < BIG)
+         directcost = tty->Wcm->cc_vabs, dcm = tty->Wcm->cm_vabs;
     }
   else
     {
       directcost = 0, relcost = 100000;
-      dcm = Wcm.cm_abs;
+      dcm = tty->Wcm->cm_abs;
     }
 
   /*
@@ -387,13 +396,14 @@ cmgoto (row, col)
     {
       /* compute REAL direct cost */
       cost = 0;
-      p = dcm == Wcm.cm_habs ? tgoto (dcm, row, col) :
-                              tgoto (dcm, col, row);
-      tputs (p, 1, evalcost);
+      p = (dcm == tty->Wcm->cm_habs
+           ? tgoto (dcm, row, col)
+           : tgoto (dcm, col, row));
+      emacs_tputs (tty, p, 1, evalcost);
       if (cost <= relcost)
        {       /* really is cheaper */
-         tputs (p, 1, cmputc);
-         curY = row, curX = col;
+         emacs_tputs (tty, p, 1, cmputc);
+         curY (tty) = row, curX (tty) = col;
          return;
        }
     }
@@ -401,25 +411,25 @@ cmgoto (row, col)
   switch (use)
     {
     case USEHOME:
-      tputs (Wcm.cm_home, 1, cmputc);
-      curY = 0, curX = 0;
+      emacs_tputs (tty, tty->Wcm->cm_home, 1, cmputc);
+      curY (tty) = 0, curX (tty) = 0;
       break;
 
     case USELL:
-      tputs (Wcm.cm_ll, 1, cmputc);
-      curY = Wcm.cm_rows - 1, curX = 0;
+      emacs_tputs (tty, tty->Wcm->cm_ll, 1, cmputc);
+      curY (tty) = tty->Wcm->cm_rows - 1, curX (tty) = 0;
       break;
 
     case USECR:
-      tputs (Wcm.cm_cr, 1, cmputc);
-      if (Wcm.cm_autolf)
-       curY++;
-      curX = 0;
+      emacs_tputs (tty, tty->Wcm->cm_cr, 1, cmputc);
+      if (tty->Wcm->cm_autolf)
+       curY (tty)++;
+      curX (tty) = 0;
       break;
     }
 
-  (void) calccost (curY, curX, row, col, 1);
-  curY = row, curX = col;
+  (void) calccost (tty, curY (tty), curX (tty), row, col, 1);
+  curY (tty) = row, curX (tty) = col;
 }
 
 /* Clear out all terminal info.
@@ -427,9 +437,9 @@ cmgoto (row, col)
  */
 
 void
-Wcm_clear ()
+Wcm_clear (struct tty_display_info *tty)
 {
-  bzero (&Wcm, sizeof Wcm);
+  bzero (tty->Wcm, sizeof (struct cm));
   UP = 0;
   BC = 0;
 }
@@ -442,21 +452,21 @@ Wcm_clear ()
  */
 
 int
-Wcm_init ()
+Wcm_init (struct tty_display_info *tty)
 {
 #if 0
-  if (Wcm.cm_abs && !Wcm.cm_ds)
+  if (tty->Wcm->cm_abs && !tty->Wcm->cm_ds)
     return 0;
 #endif
-  if (Wcm.cm_abs)
+  if (tty->Wcm->cm_abs)
     return 0;
   /* Require up and left, and, if no absolute, down and right */
-  if (!Wcm.cm_up || !Wcm.cm_left)
+  if (!tty->Wcm->cm_up || !tty->Wcm->cm_left)
     return - 1;
-  if (!Wcm.cm_abs && (!Wcm.cm_down || !Wcm.cm_right))
+  if (!tty->Wcm->cm_abs && (!tty->Wcm->cm_down || !tty->Wcm->cm_right))
     return - 1;
   /* Check that we know the size of the screen.... */
-  if (Wcm.cm_rows <= 0 || Wcm.cm_cols <= 0)
+  if (tty->Wcm->cm_rows <= 0 || tty->Wcm->cm_cols <= 0)
     return - 2;
   return 0;
 }
index 5f806993346a5239cc7741c04963cb697a97557d..69ddd7f74d12a8616946e1c244b491c42a743c9e 100644 (file)
--- a/src/cm.h
+++ b/src/cm.h
@@ -98,76 +98,78 @@ struct cm
     int cc_vabs;
   };
 
-extern struct cm Wcm;          /* Terminal capabilities */
 extern char PC;                        /* Pad character */
 
 /* Shorthand */
 #ifndef NoCMShortHand
-#define curY           Wcm.cm_curY
-#define curX           Wcm.cm_curX
-#define Up             Wcm.cm_up
-#define Down           Wcm.cm_down
-#define Left           Wcm.cm_left
-#define Right          Wcm.cm_right
-#define Tab            Wcm.cm_tab
-#define BackTab                Wcm.cm_backtab
-#define TabWidth       Wcm.cm_tabwidth
-#define CR             Wcm.cm_cr
-#define Home           Wcm.cm_home
-#define LastLine       Wcm.cm_ll
-#define AbsPosition    Wcm.cm_abs
-#define ColPosition    Wcm.cm_habs
-#define RowPosition    Wcm.cm_vabs
-#define MultiUp                Wcm.cm_multiup
-#define MultiDown      Wcm.cm_multidown
-#define MultiLeft      Wcm.cm_multileft
-#define MultiRight     Wcm.cm_multiright
-#define AutoWrap       Wcm.cm_autowrap
-#define MagicWrap      Wcm.cm_magicwrap
-#define UseTabs                Wcm.cm_usetabs
-#define FrameRows      Wcm.cm_rows
-#define FrameCols      Wcm.cm_cols
-
-#define UpCost         Wcm.cc_up
-#define DownCost       Wcm.cc_down
-#define LeftCost       Wcm.cc_left
-#define RightCost      Wcm.cc_right
-#define HomeCost       Wcm.cc_home
-#define CRCost         Wcm.cc_cr
-#define LastLineCost   Wcm.cc_ll
-#define TabCost                Wcm.cc_tab
-#define BackTabCost    Wcm.cc_backtab
-#define AbsPositionCost        Wcm.cc_abs
-#define ColPositionCost        Wcm.cc_habs
-#define RowPositionCost        Wcm.cc_vabs
-#define MultiUpCost    Wcm.cc_multiup
-#define MultiDownCost  Wcm.cc_multidown
-#define MultiLeftCost  Wcm.cc_multileft
-#define MultiRightCost Wcm.cc_multiright
+#define curY(tty)              (tty)->Wcm->cm_curY
+#define curX(tty)              (tty)->Wcm->cm_curX
+#define Up(tty)                        (tty)->Wcm->cm_up
+#define Down(tty)              (tty)->Wcm->cm_down
+#define Left(tty)              (tty)->Wcm->cm_left
+#define Right(tty)             (tty)->Wcm->cm_right
+#define Tab(tty)               (tty)->Wcm->cm_tab
+#define BackTab(tty)           (tty)->Wcm->cm_backtab
+#define TabWidth(tty)          (tty)->Wcm->cm_tabwidth
+#define CR(tty)                        (tty)->Wcm->cm_cr
+#define Home(tty)              (tty)->Wcm->cm_home
+#define LastLine(tty)          (tty)->Wcm->cm_ll
+#define AbsPosition(tty)       (tty)->Wcm->cm_abs
+#define ColPosition(tty)       (tty)->Wcm->cm_habs
+#define RowPosition(tty)       (tty)->Wcm->cm_vabs
+#define MultiUp(tty)           (tty)->Wcm->cm_multiup
+#define MultiDown(tty)         (tty)->Wcm->cm_multidown
+#define MultiLeft(tty)         (tty)->Wcm->cm_multileft
+#define MultiRight(tty)                (tty)->Wcm->cm_multiright
+#define AutoWrap(tty)          (tty)->Wcm->cm_autowrap
+#define MagicWrap(tty)         (tty)->Wcm->cm_magicwrap
+#define UseTabs(tty)           (tty)->Wcm->cm_usetabs
+#define FrameRows(tty)         (tty)->Wcm->cm_rows
+#define FrameCols(tty)         (tty)->Wcm->cm_cols
+
+#define UpCost(tty)            (tty)->Wcm->cc_up
+#define DownCost(tty)          (tty)->Wcm->cc_down
+#define LeftCost(tty)          (tty)->Wcm->cc_left
+#define RightCost(tty)         (tty)->Wcm->cc_right
+#define HomeCost(tty)          (tty)->Wcm->cc_home
+#define CRCost(tty)            (tty)->Wcm->cc_cr
+#define LastLineCost(tty)      (tty)->Wcm->cc_ll
+#define TabCost(tty)           (tty)->Wcm->cc_tab
+#define BackTabCost(tty)       (tty)->Wcm->cc_backtab
+#define AbsPositionCost(tty)   (tty)->Wcm->cc_abs
+#define ColPositionCost(tty)   (tty)->Wcm->cc_habs
+#define RowPositionCost(tty)   (tty)->Wcm->cc_vabs
+#define MultiUpCost(tty)       (tty)->Wcm->cc_multiup
+#define MultiDownCost(tty)     (tty)->Wcm->cc_multidown
+#define MultiLeftCost(tty)     (tty)->Wcm->cc_multileft
+#define MultiRightCost(tty)    (tty)->Wcm->cc_multiright
 #endif
 
-#define cmat(row,col)  (curY = (row), curX = (col))
-#define cmplus(n)                                      \
-  {                                                    \
-    if ((curX += (n)) >= FrameCols && !MagicWrap)      \
-      {                                                        \
-       if (Wcm.cm_losewrap) losecursor ();             \
-       else if (AutoWrap) curX = 0, curY++;            \
-       else curX--;                                    \
-      }                                                        \
+#define cmat(tty,row,col)      (curY(tty) = (row), curX(tty) = (col))
+#define cmplus(tty,n)                                              \
+  {                                                                 \
+    if ((curX (tty) += (n)) >= FrameCols (tty) && !MagicWrap (tty)) \
+      {                                                             \
+       if ((tty)->Wcm->cm_losewrap) losecursor (tty);              \
+       else if (AutoWrap (tty)) curX (tty) = 0, curY (tty)++;      \
+       else curX (tty)--;                                          \
+      }                                                             \
   }
 
-#define losecursor()   (curX = -1, curY = -1)
+#define losecursor(tty)         (curX(tty) = -1, curY(tty) = -1)
 
 extern int cost;
 extern int evalcost ();
 
-extern void cmcheckmagic ();
-extern int cmputc ();
-extern void cmcostinit ();
-extern void cmgoto ();
-extern void Wcm_clear ();
-extern int Wcm_init ();
+#define emacs_tputs(tty, str, affcnt, putc) (current_tty = (tty), tputs (str, affcnt, putc))
+
+extern struct tty_display_info *current_tty;
+extern void cmcheckmagic P_ ((struct tty_display_info *));
+extern int cmputc P_ ((int));
+extern void cmcostinit P_ ((struct tty_display_info *));
+extern void cmgoto P_ ((struct tty_display_info *, int, int));
+extern void Wcm_clear P_ ((struct tty_display_info *));
+extern int Wcm_init P_ ((struct tty_display_info *));
 
 /* arch-tag: acc1535a-7136-49d6-b22d-9bc85702251b
    (do not change this comment) */
index 46dd8fe780d193de0e3e83e81d6b95652298bd72..79b1c93cb3a227fe68c0e430c9d0440601304e25 100644 (file)
@@ -347,6 +347,8 @@ encode_coding_XXX (coding, source, destination, src_bytes, dst_bytes)
 #include "coding.h"
 #include "window.h"
 #include "intervals.h"
+#include "frame.h"
+#include "termhooks.h"
 
 #else  /* not emacs */
 
@@ -429,16 +431,10 @@ int inhibit_iso_escape_detection;
 /* Flag to make buffer-file-coding-system inherit from process-coding.  */
 int inherit_process_coding_system;
 
-/* Coding system to be used to encode text for terminal display.  */
-struct coding_system terminal_coding;
-
 /* Coding system to be used to encode text for terminal display when
    terminal coding system is nil.  */
 struct coding_system safe_terminal_coding;
 
-/* Coding system of what is sent from terminal keyboard.  */
-struct coding_system keyboard_coding;
-
 /* Default coding system to be used to write a file.  */
 struct coding_system default_buffer_file_coding;
 
@@ -7309,21 +7305,23 @@ Return the corresponding character code in Big5.  */)
 }
 \f
 DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal,
-       Sset_terminal_coding_system_internal, 1, 1, 0,
+       Sset_terminal_coding_system_internal, 1, 2, 0,
        doc: /* Internal use only.  */)
-     (coding_system)
+     (coding_system, display)
      Lisp_Object coding_system;
+     Lisp_Object display;
 {
+  struct coding_system *terminal_coding = DISPLAY_TERMINAL_CODING (get_display (display, 1));
   CHECK_SYMBOL (coding_system);
-  setup_coding_system (Fcheck_coding_system (coding_system), &terminal_coding);
+  setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
   /* We had better not send unsafe characters to terminal.  */
-  terminal_coding.mode |= CODING_MODE_INHIBIT_UNENCODABLE_CHAR;
+  terminal_coding->mode |= CODING_MODE_INHIBIT_UNENCODABLE_CHAR;
   /* Character composition should be disabled.  */
-  terminal_coding.composing = COMPOSITION_DISABLED;
+  terminal_coding->composing = COMPOSITION_DISABLED;
   /* Error notification should be suppressed.  */
-  terminal_coding.suppress_error = 1;
-  terminal_coding.src_multibyte = 1;
-  terminal_coding.dst_multibyte = 0;
+  terminal_coding->suppress_error = 1;
+  terminal_coding->src_multibyte = 1;
+  terminal_coding->dst_multibyte = 0;
   return Qnil;
 }
 
@@ -7346,32 +7344,39 @@ DEFUN ("set-safe-terminal-coding-system-internal", Fset_safe_terminal_coding_sys
 }
 
 DEFUN ("terminal-coding-system", Fterminal_coding_system,
-       Sterminal_coding_system, 0, 0, 0,
-       doc: /* Return coding system specified for terminal output.  */)
-     ()
+       Sterminal_coding_system, 0, 1, 0,
+       doc: /* Return coding system specified for terminal output on the given display.
+DISPLAY may be a display id, a frame, or nil for the selected frame's display.  */)
+     (display)
+     Lisp_Object display;
 {
-  return terminal_coding.symbol;
+  return DISPLAY_TERMINAL_CODING (get_display (display, 1))->symbol;
 }
 
 DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal,
-       Sset_keyboard_coding_system_internal, 1, 1, 0,
+       Sset_keyboard_coding_system_internal, 1, 2, 0,
        doc: /* Internal use only.  */)
-     (coding_system)
+     (coding_system, display)
      Lisp_Object coding_system;
+     Lisp_Object display;
 {
+  struct display *d = get_display (display, 1);
   CHECK_SYMBOL (coding_system);
-  setup_coding_system (Fcheck_coding_system (coding_system), &keyboard_coding);
+
+  setup_coding_system (Fcheck_coding_system (coding_system),
+                       DISPLAY_KEYBOARD_CODING (d));
   /* Character composition should be disabled.  */
-  keyboard_coding.composing = COMPOSITION_DISABLED;
+  DISPLAY_KEYBOARD_CODING (d)->composing = COMPOSITION_DISABLED;
   return Qnil;
 }
 
 DEFUN ("keyboard-coding-system", Fkeyboard_coding_system,
-       Skeyboard_coding_system, 0, 0, 0,
+       Skeyboard_coding_system, 0, 1, 0,
        doc: /* Return coding system specified for decoding keyboard input.  */)
-     ()
+     (display)
+     Lisp_Object display;
 {
-  return keyboard_coding.symbol;
+  return DISPLAY_KEYBOARD_CODING (get_display (display, 1))->symbol;
 }
 
 \f
@@ -7618,8 +7623,6 @@ init_coding_once ()
   iso_code_class[ISO_CODE_SS3] = ISO_single_shift_3;
   iso_code_class[ISO_CODE_CSI] = ISO_control_sequence_introducer;
 
-  setup_coding_system (Qnil, &keyboard_coding);
-  setup_coding_system (Qnil, &terminal_coding);
   setup_coding_system (Qnil, &safe_terminal_coding);
   setup_coding_system (Qnil, &default_buffer_file_coding);
 
index ee86cd6ac12f84e3ddf25f351687d8b53f8eafc3..4081b7f2028556bf1f6d70a35d208cee14648ba4 100644 (file)
@@ -685,20 +685,10 @@ extern Lisp_Object Vlocale_coding_system;
    the subprocess output.  */
 extern int inherit_process_coding_system;
 
-/* Coding-system to be used for encoding terminal output.  This
-   structure contains information of a coding-system specified by the
-   function `set-terminal-coding-system'.  */
-extern struct coding_system terminal_coding;
-
 /* Coding system to be used to encode text for terminal display when
    terminal coding system is nil.  */
 extern struct coding_system safe_terminal_coding;
 
-/* Coding-system of what is sent from terminal keyboard.  This
-   structure contains information of a coding-system specified by the
-   function `set-keyboard-coding-system'.  */
-extern struct coding_system keyboard_coding;
-
 /* Default coding system to be used to write a file.  */
 extern struct coding_system default_buffer_file_coding;
 
index d3369641a8f201c6989b8fd4fc2ad2d15877e6d7..f4ab9fbb3dd881fcbcf55979faab55d11040cf71 100644 (file)
@@ -897,6 +897,12 @@ Boston, MA 02110-1301, USA.  */
 #define HAVE_MOUSE
 #endif
 
+/* Multi-tty support relies on MULTI_KBOARD.  It seems safe to turn it
+   on unconditionally. */
+#ifndef MULTI_KBOARD
+#define MULTI_KBOARD
+#endif
+
 /* Define USER_FULL_NAME to return a string
    that is the user's full name.
    It can assume that the variable `pw'
index 5fcfc66e59eccd09441f92e1b804e163c6529518..4102af809ca1229559f1b1bd316464ff241f6d6e 100644 (file)
@@ -1875,6 +1875,44 @@ If the current binding is global (the default), the value is nil.  */)
 
   return Qnil;
 }
+
+extern struct display *get_display P_ ((Lisp_Object display, int));
+
+DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0,
+       doc: /* Return the terminal-local value of SYMBOL on DISPLAY.
+If SYMBOL is not a terminal-local variable, then return its normal
+value, like `symbol-value'.
+
+DISPLAY may be a display, a frame, or nil (meaning the selected
+frame's display).  */)
+  (symbol, display)
+     Lisp_Object symbol;
+     Lisp_Object display;
+{
+  Lisp_Object result;
+  struct display *d = get_display (display, 1);
+  push_display_kboard (d);
+  result = Fsymbol_value (symbol);
+  pop_frame_kboard ();
+  return result;
+}
+
+DEFUN ("set-terminal-local-value", Fset_terminal_local_value, Sset_terminal_local_value, 3, 3, 0,
+       doc: /* Set the terminal-local binding of SYMBOL on DISPLAY to VALUE.
+If VARIABLE is not a terminal-local variable, then set its normal
+binding, like `set'.  */)
+  (symbol, display, value)
+     Lisp_Object symbol;
+     Lisp_Object display;
+     Lisp_Object value;
+{
+  Lisp_Object result;
+  struct display *d = get_display (display, 1);
+  push_display_kboard (d);
+  result = Fset (symbol, value);
+  pop_frame_kboard ();
+  return result;
+}
 \f
 /* Find the function at the end of a chain of symbol function indirections.  */
 
@@ -3326,6 +3364,8 @@ syms_of_data ()
   defsubr (&Slocal_variable_p);
   defsubr (&Slocal_variable_if_set_p);
   defsubr (&Svariable_binding_locus);
+  defsubr (&Sterminal_local_value);
+  defsubr (&Sset_terminal_local_value);
   defsubr (&Saref);
   defsubr (&Saset);
   defsubr (&Snumber_to_string);
index af599792c636feccb5ab692c0bb32ba9d2d9ebae..9a1d484064144274edeeaad606988079998b8487 100644 (file)
@@ -1029,13 +1029,8 @@ extern int fonts_changed_p;
 
 extern struct glyph space_glyph;
 
-/* Frame being updated by update_window/update_frame.  */
-
-extern struct frame *updating_frame;
-
 /* Window being updated by update_window.  This is non-null as long as
-   update_window has not finished, and null otherwise.  It's role is
-   analogous to updating_frame.  */
+   update_window has not finished, and null otherwise.  */
 
 extern struct window *updated_window;
 
@@ -1347,7 +1342,7 @@ struct glyph_string
        DESCENT = FONT->descent
        HEIGHT = FONT_HEIGHT (FONT)
        F_DESCENT = (FRAME_FONT (F)->descent
-                    - F->output_data.x->baseline_offset)
+                    - F->device->output_data.x->baseline_offset)
        F_HEIGHT = FRAME_LINE_HEIGHT (F)
 */
 
@@ -2145,16 +2140,16 @@ struct it
 /* Call produce_glyphs or produce_glyphs_hook, if set.  Shortcut to
    avoid the function call overhead.  */
 
-#define PRODUCE_GLYPHS(IT)                     \
-     do {                                      \
-       extern int inhibit_free_realized_faces; \
-       if (rif != NULL)                                \
-        rif->produce_glyphs ((IT));            \
-       else                                    \
-        produce_glyphs ((IT));                 \
-       if ((IT)->glyph_row != NULL)            \
-        inhibit_free_realized_faces = 1;       \
-     } while (0)
+#define PRODUCE_GLYPHS(IT)                              \
+  do {                                                  \
+    extern int inhibit_free_realized_faces;             \
+    if (FRAME_RIF ((IT)->f) != NULL)                    \
+      FRAME_RIF ((IT)->f)->produce_glyphs ((IT));       \
+    else                                                \
+      produce_glyphs ((IT));                            \
+    if ((IT)->glyph_row != NULL)                        \
+      inhibit_free_realized_faces = 1;                  \
+  } while (0)
 
 /* Bit-flags indicating what operation move_it_to should perform.  */
 
@@ -2328,10 +2323,6 @@ struct redisplay_interface
 #endif /* HAVE_WINDOW_SYSTEM */
 };
 
-/* The current interface for window-based redisplay.  */
-
-extern struct redisplay_interface *rif;
-
 \f
 /***********************************************************************
                                Images
@@ -2755,11 +2746,11 @@ int image_ascent P_ ((struct image *, struct face *, struct glyph_slice *));
 
 /* Defined in sysdep.c */
 
-void get_frame_size P_ ((int *, int *));
+void get_tty_size P_ ((int, int *, int *));
 void request_sigio P_ ((void));
 void unrequest_sigio P_ ((void));
-int tabs_safe_p P_ ((void));
-void init_baud_rate P_ ((void));
+int tabs_safe_p P_ ((int));
+void init_baud_rate P_ ((int));
 void init_sigio P_ ((int));
 
 /* Defined in xfaces.c */
@@ -2898,8 +2889,8 @@ void clear_glyph_row P_ ((struct glyph_row *));
 void prepare_desired_row P_ ((struct glyph_row *));
 int line_hash_code P_ ((struct glyph_row *));
 void set_window_update_flags P_ ((struct window *, int));
-void write_glyphs P_ ((struct glyph *, int));
-void insert_glyphs P_ ((struct glyph *, int));
+void write_glyphs P_ ((struct frame *, struct glyph *, int));
+void insert_glyphs P_ ((struct frame *, struct glyph *, int));
 void redraw_frame P_ ((struct frame *));
 void redraw_garbaged_frames P_ ((void));
 int scroll_cost P_ ((struct frame *, int, int, int));
@@ -2919,30 +2910,38 @@ GLYPH spec_glyph_lookup_face P_ ((struct window *, GLYPH));
 
 /* Defined in term.c */
 
-extern void ring_bell P_ ((void));
-extern void set_terminal_modes P_ ((void));
-extern void reset_terminal_modes P_ ((void));
+extern void ring_bell P_ ((struct frame *));
 extern void update_begin P_ ((struct frame *));
 extern void update_end P_ ((struct frame *));
-extern void set_terminal_window P_ ((int));
-extern void set_scroll_region P_ ((int, int));
-extern void turn_off_insert P_ ((void));
-extern void turn_off_highlight P_ ((void));
-extern void background_highlight P_ ((void));
-extern void clear_frame P_ ((void));
-extern void clear_end_of_line P_ ((int));
-extern void clear_end_of_line_raw P_ ((int));
-extern void delete_glyphs P_ ((int));
-extern void ins_del_lines P_ ((int, int));
+extern void set_terminal_window P_ ((struct frame *, int));
+extern void set_scroll_region P_ ((struct frame *, int, int));
+extern void turn_off_insert P_ ((struct tty_display_info *));
+extern void turn_off_highlight P_ ((struct tty_display_info *));
+extern void background_highlight P_ ((struct tty_display_info *));
+extern void clear_frame P_ ((struct frame *));
+extern void clear_end_of_line P_ ((struct frame *, int));
+extern void clear_end_of_line_raw P_ ((struct frame *, int));
+extern void tty_clear_end_of_line P_ ((struct frame *, int));
+extern void delete_glyphs P_ ((struct frame *, int));
+extern void ins_del_lines P_ ((struct frame *, int, int));
 extern int string_cost P_ ((char *));
 extern int per_line_cost P_ ((char *));
 extern void calculate_costs P_ ((struct frame *));
 extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
-extern void tty_setup_colors P_ ((int));
-extern void term_init P_ ((char *));
+extern void tty_setup_colors P_ ((struct tty_display_info *, int));
+extern struct display *get_display P_ ((Lisp_Object display, int));
+extern struct display *get_named_tty_display P_ ((char *));
+EXFUN (Fdisplay_tty_type, 1);
+extern struct display *init_initial_display P_ ((void));
+extern struct display *term_init P_ ((char *, char *, int));
+extern void delete_tty P_ ((struct display *));
 extern void fatal P_ ((/* char *, ... */));
-void cursor_to P_ ((int, int));
-extern int tty_capable_p P_ ((struct frame *, unsigned, unsigned long, unsigned long));
+extern void cursor_to P_ ((struct frame *, int, int));
+extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
+extern void tty_set_terminal_modes P_ ((struct display *));
+extern void tty_reset_terminal_modes P_ ((struct display *));
+extern void create_tty_output P_ ((struct frame *));
+
 
 /* Defined in scroll.c */
 
index 6d0faf14f76c48e4208659c93abf4ad51c574d91..4bae5a231aeedaefa8332e4dafcc8661b3ad66f9 100644 (file)
@@ -31,7 +31,6 @@ Boston, MA 02110-1301, USA.  */
 #include "lisp.h"
 #include "termchar.h"
 #include "termopts.h"
-#include "termhooks.h"
 /* cm.h must come after dispextern.h on Windows.  */
 #include "dispextern.h"
 #include "cm.h"
@@ -39,6 +38,7 @@ Boston, MA 02110-1301, USA.  */
 #include "charset.h"
 #include "keyboard.h"
 #include "frame.h"
+#include "termhooks.h"
 #include "window.h"
 #include "commands.h"
 #include "disptab.h"
@@ -214,9 +214,9 @@ int inverse_video;
 EMACS_INT baud_rate;
 
 /* Either nil or a symbol naming the window system under which Emacs
-   is running.  */
+   creates the first frame.  */
 
-Lisp_Object Vwindow_system;
+Lisp_Object Vinitial_window_system;
 
 /* Version number of X windows: 10, 11 or nil.  */
 
@@ -258,14 +258,6 @@ Lisp_Object selected_frame;
 
 struct frame *last_nonminibuf_frame;
 
-/* Stdio stream being used for copy of all output.  */
-
-FILE *termscript;
-
-/* Structure for info on cursor positioning.  */
-
-struct cm Wcm;
-
 /* 1 means SIGWINCH happened when not safe.  */
 
 int delayed_size_change;
@@ -304,11 +296,6 @@ int glyph_pool_count;
 
 static struct frame *frame_matrix_frame;
 
-/* Current interface for window-based redisplay.  Set from init_xterm.
-   A null value means we are not using window-based redisplay.  */
-
-struct redisplay_interface *rif;
-
 /* Non-zero means that fonts have been loaded since the last glyph
    matrix adjustments.  Redisplay must stop, and glyph matrices must
    be adjusted when this flag becomes non-zero during display.  The
@@ -1397,7 +1384,7 @@ line_hash_code (row)
        {
          int c = glyph->u.ch;
          int face_id = glyph->face_id;
-         if (must_write_spaces)
+         if (FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME OK here? */
            c -= SPACEGLYPH;
          hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c;
          hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + face_id;
@@ -1429,7 +1416,7 @@ line_draw_cost (matrix, vpos)
   int glyph_table_len = GLYPH_TABLE_LENGTH;
 
   /* Ignore trailing and leading spaces if we can.  */
-  if (!must_write_spaces)
+  if (!FRAME_MUST_WRITE_SPACES (SELECTED_FRAME ())) /* XXX Is SELECTED_FRAME OK here? */
     {
       /* Skip from the end over trailing spaces.  */
       while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1)))
@@ -1645,8 +1632,10 @@ realloc_glyph_pool (pool, matrix_dim)
 #if GLYPH_DEBUG
 
 
-/* Flush standard output.  This is sometimes useful to call from
-   the debugger.  */
+/* Flush standard output.  This is sometimes useful to call from the debugger.
+   XXX Maybe this should be changed to flush the current terminal instead of
+   stdout.
+*/
 
 void
 flush_stdout ()
@@ -3352,12 +3341,15 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
     return Qnil;
 
   update_begin (f);
+#ifdef MSDOS
   if (FRAME_MSDOS_P (f))
-    set_terminal_modes ();
-  clear_frame ();
+    set_terminal_modes (FRAME_DISPLAY (f));
+#endif
+  clear_frame (f);
   clear_current_matrices (f);
   update_end (f);
-  fflush (stdout);
+  if (FRAME_TERMCAP_P (f))
+    fflush (FRAME_TTY (f)->output);
   windows_or_buffers_changed++;
   /* Mark all windows as inaccurate, so that every window will have
      its redisplay done.  */
@@ -3498,7 +3490,7 @@ direct_output_for_insert (g)
 
   /* If we can't insert glyphs, we can use this method only
      at the end of a line.  */
-  if (!char_ins_del_ok)
+  if (!FRAME_CHAR_INS_DEL_OK (f))
     if (PT != ZV && FETCH_BYTE (PT_BYTE) != '\n')
       return 0;
 
@@ -3648,24 +3640,24 @@ direct_output_for_insert (g)
   updated_row = glyph_row;
   updated_area = TEXT_AREA;
   update_begin (f);
-  if (rif)
+  if (FRAME_RIF (f))
     {
-      rif->update_window_begin_hook (w);
+      FRAME_RIF (f)->update_window_begin_hook (w);
 
       if (glyphs == end - n
          /* In front of a space added by append_space.  */
          || (glyphs == end - n - 1
              && (end - n)->charpos <= 0))
-       rif->write_glyphs (glyphs, n);
+       FRAME_RIF (f)->write_glyphs (glyphs, n);
       else
-       rif->insert_glyphs (glyphs, n);
+       FRAME_RIF (f)->insert_glyphs (glyphs, n);
     }
   else
     {
       if (glyphs == end - n)
-       write_glyphs (glyphs, n);
+       write_glyphs (f, glyphs, n);
       else
-       insert_glyphs (glyphs, n);
+       insert_glyphs (f, glyphs, n);
     }
 
   w->cursor.hpos += n;
@@ -3678,8 +3670,8 @@ direct_output_for_insert (g)
      a frame matrix is used, cursor_to expects frame coordinates,
      and the X and Y parameters are not used.  */
   if (window_redisplay_p)
-    rif->cursor_to (w->cursor.vpos, w->cursor.hpos,
-                   w->cursor.y, w->cursor.x);
+    FRAME_RIF (f)->cursor_to (w->cursor.vpos, w->cursor.hpos,
+                              w->cursor.y, w->cursor.x);
   else
     {
       int x, y;
@@ -3688,18 +3680,19 @@ direct_output_for_insert (g)
              ? XFASTINT (w->left_margin_cols)
              : 0));
       y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
-      cursor_to (y, x);
+      cursor_to (f, y, x);
     }
 
 #ifdef HAVE_WINDOW_SYSTEM
   update_window_fringes (w, 0);
 #endif
 
-  if (rif)
-    rif->update_window_end_hook (w, 1, 0);
+  if (FRAME_RIF (f))
+    FRAME_RIF (f)->update_window_end_hook (w, 1, 0);
   update_end (f);
   updated_row = NULL;
-  fflush (stdout);
+  if (FRAME_TERMCAP_P (f))
+    fflush (FRAME_TTY (f)->output);
 
   TRACE ((stderr, "direct output for insert\n"));
   mark_window_display_accurate (it.window, 1);
@@ -3777,8 +3770,8 @@ direct_output_forward_char (n)
           && w->cursor.hpos < w->desired_matrix->matrix_w);
 
   if (FRAME_WINDOW_P (f))
-    rif->cursor_to (w->cursor.vpos, w->cursor.hpos,
-                   w->cursor.y, w->cursor.x);
+    FRAME_RIF (f)->cursor_to (w->cursor.vpos, w->cursor.hpos,
+                              w->cursor.y, w->cursor.x);
   else
     {
       int x, y;
@@ -3787,10 +3780,11 @@ direct_output_forward_char (n)
              ? XFASTINT (w->left_margin_cols)
              : 0));
       y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
-      cursor_to (y, x);
+      cursor_to (f, y, x);
     }
 
-  fflush (stdout);
+  if (FRAME_TERMCAP_P (f))
+    fflush (FRAME_TTY (f)->output);
   redisplay_performed_directly_p = 1;
   return 1;
 }
@@ -3863,14 +3857,14 @@ update_frame (f, force_p, inhibit_hairy_id_p)
       update_end (f);
 
       /* This flush is a performance bottleneck under X,
-        and it doesn't seem to be necessary anyway (in general).
+        and it doesn't seem to be necessary anyway (in general).
          It is necessary when resizing the window with the mouse, or
-        at least the fringes are not redrawn in a timely manner.  ++kfs */
+        at least the fringes are not redrawn in a timely manner.  ++kfs */
       if (f->force_flush_display_p)
-       {
-         rif->flush_display (f);
-         f->force_flush_display_p = 0;
-       }
+       {
+         FRAME_RIF (f)->flush_display (f);
+         f->force_flush_display_p = 0;
+       }
     }
   else
     {
@@ -3886,9 +3880,12 @@ update_frame (f, force_p, inhibit_hairy_id_p)
       paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);
       update_end (f);
 
-      if (termscript)
-       fflush (termscript);
-      fflush (stdout);
+      if (FRAME_TERMCAP_P (f))
+        {
+          if (FRAME_TTY (f)->termscript)
+            fflush (FRAME_TTY (f)->termscript);
+          fflush (FRAME_TTY (f)->output);
+        }
 
       /* Check window matrices for lost pointers.  */
 #if GLYPH_DEBUG
@@ -3971,7 +3968,8 @@ redraw_overlapped_rows (w, yb)
      int yb;
 {
   int i;
-
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  
   /* If rows overlapping others have been changed, the rows being
      overlapped have to be redrawn.  This won't draw lines that have
      already been drawn in update_window_line because overlapped_p in
@@ -3994,10 +3992,12 @@ redraw_overlapped_rows (w, yb)
            {
              updated_row = row;
              updated_area = area;
-             rif->cursor_to (i, 0, row->y, area == TEXT_AREA ? row->x : 0);
+             FRAME_RIF (f)->cursor_to (i, 0, row->y,
+                                        area == TEXT_AREA ? row->x : 0);
              if (row->used[area])
-               rif->write_glyphs (row->glyphs[area], row->used[area]);
-             rif->clear_end_of_line (-1);
+               FRAME_RIF (f)->write_glyphs (row->glyphs[area],
+                                             row->used[area]);
+             FRAME_RIF (f)->clear_end_of_line (-1);
            }
 
          row->overlapped_p = 0;
@@ -4019,7 +4019,8 @@ redraw_overlapping_rows (w, yb)
 {
   int i, bottom_y;
   struct glyph_row *row;
-
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
+  
   for (i = 0; i < w->current_matrix->nrows; ++i)
     {
       row = w->current_matrix->rows + i;
@@ -4096,12 +4097,12 @@ update_window (w, force_p)
   int preempt_count = baud_rate / 2400 + 1;
   extern int input_pending;
   extern Lisp_Object do_mouse_tracking;
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 #if GLYPH_DEBUG
   struct frame *f = XFRAME (WINDOW_FRAME (w));
 
   /* Check that W's frame doesn't have glyph matrices.  */
   xassert (FRAME_WINDOW_P (f));
-  xassert (updating_frame != NULL);
 #endif
 
   /* Check pending input the first time so that we can quickly return.  */
@@ -4272,6 +4273,7 @@ update_marginal_area (w, area, vpos)
      int area, vpos;
 {
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 
   /* Let functions in xterm.c know what area subsequent X positions
      will be relative to.  */
@@ -4297,6 +4299,7 @@ update_text_area (w, vpos)
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
   int changed_p = 0;
 
   /* Let functions in xterm.c know what area subsequent X positions
@@ -4518,6 +4521,7 @@ update_window_line (w, vpos, mouse_face_overwritten_p)
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
   int changed_p = 0;
 
   /* Set the row being updated.  This is important to let xterm.c
@@ -4586,6 +4590,7 @@ set_window_cursor_after_update (w)
      struct window *w;
 {
   struct frame *f = XFRAME (w->frame);
+  struct redisplay_interface *rif = FRAME_RIF (f);
   int cx, cy, vpos, hpos;
 
   /* Not intended for frame matrix updates.  */
@@ -4809,6 +4814,7 @@ scrolling_window (w, header_line_p)
   int i, j, first_old, first_new, last_old, last_new;
   int nruns, nbytes, n, run_idx;
   struct row_entry *entry;
+  struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 
   /* Skip over rows equal at the start.  */
   for (i = header_line_p ? 1 : 0; i < current_matrix->nrows - 1; ++i)
@@ -5133,7 +5139,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
     }
 
   /* If we cannot insert/delete lines, it's no use trying it.  */
-  if (!line_ins_del_ok)
+  if (!FRAME_LINE_INS_DEL_OK (f))
     inhibit_id_p = 1;
 
   /* See if any of the desired lines are enabled; don't compute for
@@ -5161,18 +5167,18 @@ update_frame_1 (f, force_p, inhibit_id_p)
                 Also flush out if likely to have more than 1k buffered
                 otherwise.   I'm told that some telnet connections get
                 really screwed by more than 1k output at once.  */
-             int outq = PENDING_OUTPUT_COUNT (stdout);
+             int outq = PENDING_OUTPUT_COUNT (FRAME_TTY (f)->output);
              if (outq > 900
                  || (outq > 20 && ((i - 1) % preempt_count == 0)))
                {
-                 fflush (stdout);
+                 fflush (FRAME_TTY (f)->output);
                  if (preempt_count == 1)
                    {
 #ifdef EMACS_OUTQSIZE
                      if (EMACS_OUTQSIZE (0, &outq) < 0)
                        /* Probably not a tty.  Ignore the error and reset
                           the outq count.  */
-                       outq = PENDING_OUTPUT_COUNT (stdout);
+                       outq = PENDING_OUTPUT_COUNT (FRAME_TTY (f->output));
 #endif
                      outq *= 10;
                      if (baud_rate <= outq && baud_rate > 0)
@@ -5260,7 +5266,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
                }
            }
 
-         cursor_to (row, col);
+         cursor_to (f, row, col);
        }
       else
        {
@@ -5282,7 +5288,7 @@ update_frame_1 (f, force_p, inhibit_id_p)
                x += XFASTINT (w->left_margin_cols);
 
              /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */
-             cursor_to (y, x);
+             cursor_to (f, y, x);
            }
        }
     }
@@ -5351,21 +5357,23 @@ scrolling (frame)
     }
 
   /* If changed lines are few, don't allow preemption, don't scroll.  */
-  if ((!scroll_region_ok && changed_lines < baud_rate / 2400)
+  if ((!FRAME_SCROLL_REGION_OK (frame)
+       && changed_lines < baud_rate / 2400)
       || unchanged_at_bottom == FRAME_LINES (frame))
     return 1;
 
   window_size = (FRAME_LINES (frame) - unchanged_at_top
                 - unchanged_at_bottom);
 
-  if (scroll_region_ok)
+  if (FRAME_SCROLL_REGION_OK (frame))
     free_at_end_vpos -= unchanged_at_bottom;
-  else if (memory_below_frame)
+  else if (FRAME_MEMORY_BELOW_FRAME (frame))
     free_at_end_vpos = -1;
 
   /* If large window, fast terminal and few lines in common between
      current frame and desired frame, don't bother with i/d calc.  */
-  if (!scroll_region_ok && window_size >= 18 && baud_rate > 2400
+  if (!FRAME_SCROLL_REGION_OK (frame)
+      && window_size >= 18 && baud_rate > 2400
       && (window_size >=
          10 * scrolling_max_lines_saved (unchanged_at_top,
                                          FRAME_LINES (frame) - unchanged_at_bottom,
@@ -5445,7 +5453,7 @@ update_frame_line (f, vpos)
   struct glyph_row *current_row = MATRIX_ROW (current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, vpos);
   int must_write_whole_line_p;
-  int write_spaces_p = must_write_spaces;
+  int write_spaces_p = FRAME_MUST_WRITE_SPACES (f);
   int colored_spaces_p = (FACE_FROM_ID (f, DEFAULT_FACE_ID)->background
                          != FACE_TTY_DEFAULT_BG_COLOR);
 
@@ -5496,8 +5504,8 @@ update_frame_line (f, vpos)
       /* Write the contents of the desired line.  */
       if (nlen)
        {
-          cursor_to (vpos, 0);
-         write_glyphs (nbody, nlen);
+          cursor_to (f, vpos, 0);
+         write_glyphs (f, nbody, nlen);
        }
 
       /* Don't call clear_end_of_line if we already wrote the whole
@@ -5505,13 +5513,13 @@ update_frame_line (f, vpos)
         case but in the line below.  */
       if (nlen < FRAME_TOTAL_COLS (f))
        {
-         cursor_to (vpos, nlen);
-          clear_end_of_line (FRAME_TOTAL_COLS (f));
+         cursor_to (f, vpos, nlen);
+          clear_end_of_line (f, FRAME_TOTAL_COLS (f));
        }
       else
        /* Make sure we are in the right row, otherwise cursor movement
           with cmgoto might use `ch' in the wrong row.  */
-       cursor_to (vpos, 0);
+       cursor_to (f, vpos, 0);
 
       make_current (desired_matrix, current_matrix, vpos);
       return;
@@ -5524,7 +5532,7 @@ update_frame_line (f, vpos)
       nlen--;
 
   /* If there's no i/d char, quickly do the best we can without it.  */
-  if (!char_ins_del_ok)
+  if (!FRAME_CHAR_INS_DEL_OK (f))
     {
       int i, j;
 
@@ -5543,8 +5551,8 @@ update_frame_line (f, vpos)
                ++j;
 
              /* Output this run of non-matching chars.  */
-             cursor_to (vpos, i);
-             write_glyphs (nbody + i, j - i);
+             cursor_to (f, vpos, i);
+             write_glyphs (f, nbody + i, j - i);
              i = j - 1;
 
              /* Now find the next non-match.  */
@@ -5554,8 +5562,8 @@ update_frame_line (f, vpos)
       /* Clear the rest of the line, or the non-clear part of it.  */
       if (olen > nlen)
        {
-         cursor_to (vpos, nlen);
-         clear_end_of_line (olen);
+         cursor_to (f, vpos, nlen);
+         clear_end_of_line (f, olen);
        }
 
       /* Make current row = desired row.  */
@@ -5577,8 +5585,8 @@ update_frame_line (f, vpos)
 
       if (nlen > nsp)
        {
-         cursor_to (vpos, nsp);
-         write_glyphs (nbody + nsp, nlen - nsp);
+         cursor_to (f, vpos, nsp);
+         write_glyphs (f, nbody + nsp, nlen - nsp);
        }
 
       /* Exchange contents between current_frame and new_frame.  */
@@ -5627,7 +5635,8 @@ update_frame_line (f, vpos)
 
   tem = (nlen - nsp) - (olen - osp);
   if (endmatch && tem
-      && (!char_ins_del_ok || endmatch <= char_ins_del_cost (f)[tem]))
+      && (!FRAME_CHAR_INS_DEL_OK (f)
+          || endmatch <= char_ins_del_cost (f)[tem]))
     endmatch = 0;
 
   /* nsp - osp is the distance to insert or delete.
@@ -5636,7 +5645,7 @@ update_frame_line (f, vpos)
      Is it worth it?  */
 
   if (nsp != osp
-      && (!char_ins_del_ok
+      && (!FRAME_CHAR_INS_DEL_OK (f)
          || begmatch + endmatch <= char_ins_del_cost (f)[nsp - osp]))
     {
       begmatch = 0;
@@ -5649,8 +5658,8 @@ update_frame_line (f, vpos)
 
   if (osp > nsp)
     {
-      cursor_to (vpos, nsp);
-      delete_glyphs (osp - nsp);
+      cursor_to (f, vpos, nsp);
+      delete_glyphs (f, osp - nsp);
     }
   else if (nsp > osp)
     {
@@ -5659,12 +5668,12 @@ update_frame_line (f, vpos)
         must delete first to avoid losing data in the insert */
       if (endmatch && nlen < olen + nsp - osp)
        {
-         cursor_to (vpos, nlen - endmatch + osp - nsp);
-         delete_glyphs (olen + nsp - osp - nlen);
+         cursor_to (f, vpos, nlen - endmatch + osp - nsp);
+         delete_glyphs (f, olen + nsp - osp - nlen);
          olen = nlen - (nsp - osp);
        }
-      cursor_to (vpos, osp);
-      insert_glyphs (0, nsp - osp);
+      cursor_to (f, vpos, osp);
+      insert_glyphs (f, 0, nsp - osp);
     }
   olen += nsp - osp;
 
@@ -5685,8 +5694,8 @@ update_frame_line (f, vpos)
             unnecessary cursor movement.  */
          if (nlen - tem > 0)
            {
-             cursor_to (vpos, nsp + begmatch);
-             write_glyphs (nbody + nsp + begmatch, nlen - tem);
+             cursor_to (f, vpos, nsp + begmatch);
+             write_glyphs (f, nbody + nsp + begmatch, nlen - tem);
            }
        }
       else if (nlen > olen)
@@ -5701,27 +5710,27 @@ update_frame_line (f, vpos)
          int out = olen - tem; /* Columns to be overwritten originally.  */
          int del;
 
-         cursor_to (vpos, nsp + begmatch);
+         cursor_to (f, vpos, nsp + begmatch);
 
          /* Calculate columns we can actually overwrite.  */
          while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out]))
            out--;
-         write_glyphs (nbody + nsp + begmatch, out);
+         write_glyphs (f, nbody + nsp + begmatch, out);
 
          /* If we left columns to be overwritten, we must delete them.  */
          del = olen - tem - out;
          if (del > 0)
-           delete_glyphs (del);
+           delete_glyphs (f, del);
 
          /* At last, we insert columns not yet written out.  */
-         insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del);
+         insert_glyphs (f, nbody + nsp + begmatch + out, nlen - olen + del);
          olen = nlen;
        }
       else if (olen > nlen)
        {
-         cursor_to (vpos, nsp + begmatch);
-         write_glyphs (nbody + nsp + begmatch, nlen - tem);
-         delete_glyphs (olen - nlen);
+         cursor_to (f, vpos, nsp + begmatch);
+         write_glyphs (f, nbody + nsp + begmatch, nlen - tem);
+         delete_glyphs (f, olen - nlen);
          olen = nlen;
        }
     }
@@ -5730,8 +5739,8 @@ update_frame_line (f, vpos)
   /* If any unerased characters remain after the new line, erase them.  */
   if (olen > nlen)
     {
-      cursor_to (vpos, nlen);
-      clear_end_of_line (olen);
+      cursor_to (f, vpos, nlen);
+      clear_end_of_line (f, olen);
     }
 
   /* Exchange contents between current_frame and new_frame.  */
@@ -6027,31 +6036,34 @@ window_change_signal (signalnum) /* If we don't have an argument, */
 #endif
   int old_errno = errno;
 
+  struct tty_display_info *tty;
+
   signal (SIGWINCH, window_change_signal);
   SIGNAL_THREAD_CHECK (signalnum);
 
-  get_frame_size (&width, &height);
-
-  /* The frame size change obviously applies to a termcap-controlled
-     frame.  Find such a frame in the list, and assume it's the only
-     one (since the redisplay code always writes to stdout, not a
-     FILE * specified in the frame structure).  Record the new size,
-     but don't reallocate the data structures now.  Let that be done
-     later outside of the signal handler.  */
+  /* The frame size change obviously applies to a single
+     termcap-controlled terminal, but we can't decide which.
+     Therefore, we resize the frames corresponding to each tty.
+  */
+  for (tty = tty_list; tty; tty = tty->next) {
 
-  {
-    Lisp_Object tail, frame;
+    if (! tty->term_initted)
+      continue;
 
-    FOR_EACH_FRAME (tail, frame)
-      {
-       if (FRAME_TERMCAP_P (XFRAME (frame)))
-         {
-           change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
-           break;
-         }
-      }
+    get_tty_size (fileno (tty->input), &width, &height);
+    
+    {
+      Lisp_Object tail, frame;
+      
+      FOR_EACH_FRAME (tail, frame)
+        if (FRAME_TERMCAP_P (XFRAME (frame)) && FRAME_TTY (XFRAME (frame)) == tty)
+          /* Record the new sizes, but don't reallocate the data
+             structures now.  Let that be done later outside of the
+             signal handler.  */
+          change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
+    }
   }
-
+  
   errno = old_errno;
 }
 #endif /* SIGWINCH */
@@ -6105,10 +6117,11 @@ change_frame_size (f, newheight, newwidth, pretend, delay, safe)
 {
   Lisp_Object tail, frame;
 
-  if (! FRAME_WINDOW_P (f))
+  if (FRAME_MSDOS_P (f))
     {
-      /* When using termcap, or on MS-DOS, all frames use
-        the same screen, so a change in size affects all frames.  */
+      /* On MS-DOS, all frames use the same screen, so a change in
+         size affects all frames.  Termcap now supports multiple
+         ttys. */
       FOR_EACH_FRAME (tail, frame)
        if (! FRAME_WINDOW_P (XFRAME (frame)))
          change_frame_size_1 (XFRAME (frame), newheight, newwidth,
@@ -6188,7 +6201,7 @@ change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
                           newheight - FRAME_TOP_MARGIN (f), 0);
 
       if (FRAME_TERMCAP_P (f) && !pretend)
-       FrameRows = newheight;
+       FrameRows (FRAME_TTY (f)) = newheight;
     }
 
   if (new_frame_total_cols != FRAME_TOTAL_COLS (f))
@@ -6198,7 +6211,7 @@ change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
        set_window_width (FRAME_MINIBUF_WINDOW (f), new_frame_total_cols, 0);
 
       if (FRAME_TERMCAP_P (f) && !pretend)
-       FrameCols = newwidth;
+       FrameCols (FRAME_TTY (f)) = newwidth;
 
       if (WINDOWP (f->tool_bar_window))
        XSETFASTINT (XWINDOW (f->tool_bar_window)->total_cols, newwidth);
@@ -6248,14 +6261,22 @@ FILE = nil means just close any termscript file currently open.  */)
      (file)
      Lisp_Object file;
 {
-  if (termscript != 0) fclose (termscript);
-  termscript = 0;
+  struct tty_display_info *tty;
+
+  if (! FRAME_TERMCAP_P (SELECTED_FRAME ()))
+    error ("Current frame is not on a tty device");
+
+  tty = CURTTY ();
+
+  if (tty->termscript != 0)
+    fclose (tty->termscript);
+  tty->termscript = 0;
 
   if (! NILP (file))
     {
       file = Fexpand_file_name (file, Qnil);
-      termscript = fopen (SDATA (file), "w");
-      if (termscript == 0)
+      tty->termscript = fopen (SDATA (file), "w");
+      if (tty->termscript == 0)
        report_file_error ("Opening termscript", Fcons (file, Qnil));
     }
   return Qnil;
@@ -6269,16 +6290,23 @@ Control characters in STRING will have terminal-dependent effects.  */)
      (string)
      Lisp_Object string;
 {
+  struct tty_display_info *tty;
+
   /* ??? Perhaps we should do something special for multibyte strings here.  */
   CHECK_STRING (string);
-  fwrite (SDATA (string), 1, SBYTES (string), stdout);
-  fflush (stdout);
-  if (termscript)
+
+  if (! FRAME_TERMCAP_P (SELECTED_FRAME ()))
+    error ("Current frame is not on a tty device");
+
+  tty = CURTTY ();
+  
+  if (tty->termscript)
     {
-      fwrite (SDATA (string), 1, SBYTES (string),
-             termscript);
-      fflush (termscript);
+      fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
+      fflush (tty->termscript);
     }
+  fwrite (SDATA (string), 1, SBYTES (string), tty->output);
+  fflush (tty->output);
   return Qnil;
 }
 
@@ -6295,8 +6323,7 @@ terminate any keyboard macro currently executing.  */)
       if (noninteractive)
        putchar (07);
       else
-       ring_bell ();
-      fflush (stdout);
+       ring_bell (XFRAME (selected_frame));
     }
   else
     bitch_at_user ();
@@ -6312,8 +6339,7 @@ bitch_at_user ()
   else if (!INTERACTIVE)  /* Stop executing a keyboard macro.  */
     error ("Keyboard macro terminated by a command ringing the bell");
   else
-    ring_bell ();
-  fflush (stdout);
+    ring_bell (XFRAME (selected_frame));
 }
 
 
@@ -6557,8 +6583,6 @@ the current state.  */)
                            Initialization
 ***********************************************************************/
 
-char *terminal_type;
-
 /* Initialization done when Emacs fork is started, before doing stty.
    Determine terminal type and set terminal_driver.  Then invoke its
    decoding routine to set up variables in the terminal package.  */
@@ -6566,6 +6590,8 @@ char *terminal_type;
 void
 init_display ()
 {
+  char *terminal_type;
+
 #ifdef HAVE_X_WINDOWS
   extern int display_arg;
 #endif
@@ -6575,14 +6601,23 @@ init_display ()
   SET_CHAR_GLYPH_FROM_GLYPH (space_glyph, ' ');
   space_glyph.charpos = -1;
 
-  meta_key = 0;
   inverse_video = 0;
   cursor_in_echo_area = 0;
   terminal_type = (char *) 0;
 
   /* Now is the time to initialize this; it's used by init_sys_modes
      during startup.  */
-  Vwindow_system = Qnil;
+  Vinitial_window_system = Qnil;
+
+  /* SIGWINCH needs to be handled no matter what display we start
+     with.  Otherwise newly opened tty frames will not resize
+     automatically. */
+#ifdef SIGWINCH
+#ifndef CANNOT_DUMP
+  if (initialized)
+#endif /* CANNOT_DUMP */
+    signal (SIGWINCH, window_change_signal);
+#endif /* SIGWINCH */
 
   /* If the user wants to use a window system, we shouldn't bother
      initializing the terminal.  This is especially important when the
@@ -6611,7 +6646,7 @@ init_display ()
 #endif
      )
     {
-      Vwindow_system = intern ("x");
+      Vinitial_window_system = intern ("x");
 #ifdef HAVE_X11
       Vwindow_system_version = make_number (11);
 #else
@@ -6631,7 +6666,7 @@ init_display ()
 #ifdef HAVE_NTGUI
   if (!inhibit_window_system)
     {
-      Vwindow_system = intern ("w32");
+      Vinitial_window_system = intern ("w32");
       Vwindow_system_version = make_number (1);
       adjust_frame_glyphs_initially ();
       return;
@@ -6641,7 +6676,7 @@ init_display ()
 #ifdef MAC_OS
   if (!inhibit_window_system)
     {
-      Vwindow_system = intern ("mac");
+      Vinitial_window_system = intern ("mac");
       Vwindow_system_version = make_number (1);
       adjust_frame_glyphs_initially ();
       return;
@@ -6687,8 +6722,34 @@ For types not defined in VMS, use  define emacs_term \"TYPE\".\n\
   }
 #endif /* VMS */
 
-  term_init (terminal_type);
-
+  {
+    struct display *d;
+    struct frame *f = XFRAME (selected_frame);
+
+    /* Open a display on the controlling tty. */
+    d = term_init (0, terminal_type, 1); /* Errors are fatal. */
+
+    /* Convert the initial frame to use the new display. */
+    if (f->output_method != output_initial)
+      abort ();
+    f->output_method = d->type;
+    f->display = d;
+
+    d->reference_count++;
+    d->display_info.tty->top_frame = selected_frame;
+    change_frame_size (XFRAME (selected_frame), FrameRows (d->display_info.tty), FrameCols (d->display_info.tty), 0, 0, 1);
+
+    /* Delete the initial display. */
+    if (--initial_display->reference_count == 0
+        && initial_display->delete_display_hook)
+      (*initial_display->delete_display_hook) (initial_display);
+
+    /* Update frame parameters to reflect the new type. */
+    Fmodify_frame_parameters
+      (selected_frame, Fcons (Fcons (Qtty_type,
+                                     Fdisplay_tty_type (selected_frame)), Qnil));
+  }
+  
   {
     struct frame *sf = SELECTED_FRAME ();
     int width = FRAME_TOTAL_COLS (sf);
@@ -6705,13 +6766,6 @@ For types not defined in VMS, use  define emacs_term \"TYPE\".\n\
   adjust_frame_glyphs_initially ();
   calculate_costs (XFRAME (selected_frame));
 
-#ifdef SIGWINCH
-#ifndef CANNOT_DUMP
-  if (initialized)
-#endif /* CANNOT_DUMP */
-    signal (SIGWINCH, window_change_signal);
-#endif /* SIGWINCH */
-
   /* Set up faces of the initial terminal frame of a dumped Emacs.  */
   if (initialized
       && !noninteractive
@@ -6722,7 +6776,7 @@ For types not defined in VMS, use  define emacs_term \"TYPE\".\n\
         and internal_terminal_init.  */
       && (strcmp (terminal_type, "internal") != 0 || inhibit_window_system)
 #endif
-      && NILP (Vwindow_system))
+      && NILP (Vinitial_window_system))
     {
       /* For the initial frame, we don't have any way of knowing what
         are the foreground and background colors of the terminal.  */
@@ -6834,8 +6888,8 @@ A non-nil value is useful if the terminal can automatically preserve
 Emacs's frame display when you reenter Emacs.
 It is up to you to set this variable if your terminal can do that.  */);
 
-  DEFVAR_LISP ("window-system", &Vwindow_system,
-              doc: /* Name of window system that Emacs is displaying through.
+  DEFVAR_LISP ("initial-window-system", &Vinitial_window_system,
+              doc: /* Name of the window system that Emacs uses for the first frame.
 The value is a symbol--for instance, `x' for X windows.
 The value is nil if Emacs is using a text-only terminal.  */);
 
@@ -6871,7 +6925,7 @@ See `buffer-display-table' for more information.  */);
   if (noninteractive)
 #endif
     {
-      Vwindow_system = Qnil;
+      Vinitial_window_system = Qnil;
       Vwindow_system_version = Qnil;
     }
 }
index ae9eb4decb7d20568e4c9cc17268d8073a5a89b2..af23f8b9136ca431b6df91bbbb73a602f77db6d6 100644 (file)
@@ -57,6 +57,7 @@ Boston, MA 02110-1301, USA.  */
 #include "blockinput.h"
 #include "syssignal.h"
 #include "process.h"
+#include "frame.h"
 #include "termhooks.h"
 #include "keyboard.h"
 #include "keymap.h"
@@ -211,7 +212,7 @@ static unsigned long heap_bss_diff;
 
 
 #ifdef HAVE_WINDOW_SYSTEM
-extern Lisp_Object Vwindow_system;
+extern Lisp_Object Vinitial_window_system;
 #endif /* HAVE_WINDOW_SYSTEM */
 
 extern Lisp_Object Vauto_save_list_file_name;
@@ -1308,6 +1309,9 @@ main (argc, argv
         faces, and the face implementation uses some symbols as
         face names.  */
       syms_of_xfaces ();
+      /* XXX syms_of_keyboard uses some symbols in keymap.c.  It would
+         be better to arrange things not to have this dependency.  */
+      syms_of_keymap ();
       /* Call syms_of_keyboard before init_window_once because
         keyboard sets up symbols that include some face names that
         the X support will want to use.  This can happen when
@@ -1579,7 +1583,7 @@ main (argc, argv
 #endif /* CLASH_DETECTION */
       syms_of_indent ();
       syms_of_insdel ();
-      syms_of_keymap ();
+      /* syms_of_keymap (); */
       syms_of_macros ();
       syms_of_marker ();
       syms_of_minibuf ();
@@ -1676,13 +1680,7 @@ main (argc, argv
 #endif  /* HAVE_NTGUI */
     }
 
-  if (!noninteractive)
-    {
-#ifdef VMS
-      init_vms_input ();/* init_display calls get_frame_size, that needs this.  */
-#endif /* VMS */
-      init_display (); /* Determine terminal type.  init_sys_modes uses results.  */
-    }
+  init_process (); /* init_display uses add_keyboard_wait_descriptor. */
 #ifndef MAC_OS8
   /* Called before init_window_once for Mac OS Classic.  */
   init_keyboard ();    /* This too must precede init_sys_modes.  */
@@ -1690,7 +1688,13 @@ main (argc, argv
 #ifdef VMS
   init_vmsproc ();     /* And this too.  */
 #endif /* VMS */
-  init_sys_modes ();   /* Init system terminal modes (RAW or CBREAK, etc.).  */
+  if (!noninteractive)
+    {
+#ifdef VMS
+      init_vms_input ();/* init_display calls get_tty_size, that needs this.  */
+#endif /* VMS */
+      init_display (); /* Determine terminal type.  Calls init_sys_modes.  */
+    }
   init_fns ();
   init_xdisp ();
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1703,7 +1707,6 @@ main (argc, argv
 #ifdef VMS
   init_vmsfns ();
 #endif /* VMS */
-  init_process ();
 #ifdef HAVE_SOUND
   init_sound ();
 #endif
@@ -2110,15 +2113,14 @@ shut_down_emacs (sig, no_x, stuff)
     if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1
        && tpgrp == pgrp)
       {
-       fflush (stdout);
-       reset_sys_modes ();
+       reset_all_sys_modes ();
        if (sig && sig != SIGTERM)
          fprintf (stderr, "Fatal error (%d)", sig);
       }
   }
 #else
   fflush (stdout);
-  reset_sys_modes ();
+  reset_all_sys_modes ();
 #endif
 
   stuff_buffered_input (stuff);
@@ -2137,9 +2139,9 @@ shut_down_emacs (sig, no_x, stuff)
 #if 0 /* This triggers a bug in XCloseDisplay and is not needed.  */
 #ifdef HAVE_X_WINDOWS
   /* It's not safe to call intern here.  Maybe we are crashing.  */
-  if (!noninteractive && SYMBOLP (Vwindow_system)
-      && SCHARS (SYMBOL_NAME (Vwindow_system)) == 1
-      && SREF (SYMBOL_NAME (Vwindow_system), 0) == 'x'
+  if (!noninteractive && SYMBOLP (Vinitial_window_system)
+      && SCHARS (SYMBOL_NAME (Vinitial_window_system)) == 1
+      && SREF (SYMBOL_NAME (Vinitial_window_system), 0) == 'x'
       && ! no_x)
     Fx_close_current_connection ();
 #endif /* HAVE_X_WINDOWS */
index 6070c28aed957330c6eb847926a85a9ef3510ee7..769dc14e77d9f428c40c591f33acfb0229e589df 100644 (file)
@@ -76,6 +76,8 @@ extern int errno;
 #include "charset.h"
 #include "coding.h"
 #include "window.h"
+#include "frame.h"
+#include "dispextern.h"
 
 #ifdef WINDOWSNT
 #define NOMINMAX 1
@@ -5769,7 +5771,7 @@ auto_save_error (error)
   int i, nbytes;
   struct gcpro gcpro1;
 
-  ring_bell ();
+  ring_bell (XFRAME (selected_frame));
 
   args[0] = build_string ("Auto-saving %s: %s");
   args[1] = current_buffer->name;
index 27295715eaf0fe312bf0431d928533bc83aeb525..e3bb1ced2f4d63c0b6d138e371fdc7318a9f85bc 100644 (file)
@@ -46,6 +46,7 @@ Boston, MA 02110-1301, USA.  */
 #ifdef MAC_OS
 #include "macterm.h"
 #endif
+#include "termhooks.h"
 
 #ifdef FONTSET_DEBUG
 #undef xassert
@@ -1344,7 +1345,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
       STORE_XCHAR2B (&char2b, c1, c2);
     else
       STORE_XCHAR2B (&char2b, 0, c1);
-    rif->encode_char (c, &char2b, fontp, NULL);
+    FRAME_RIF (f)->encode_char (c, &char2b, fontp, NULL);
     code = (XCHAR2B_BYTE1 (&char2b) << 8) | XCHAR2B_BYTE2 (&char2b);
   }
   return Fcons (build_string (face->font_name), make_number (code));
index b23fbe9cd1271233777084c9cd0cec83e5c22b64..f32ad7a936351e30bc3fff2b76766d1caa3ebe95 100644 (file)
@@ -42,6 +42,7 @@ Boston, MA 02110-1301, USA.  */
 #include "fontset.h"
 #endif
 #include "blockinput.h"
+#include "termchar.h"
 #include "termhooks.h"
 #include "dispextern.h"
 #include "window.h"
@@ -75,6 +76,8 @@ Lisp_Object Qinhibit_default_face_x_resources;
 
 Lisp_Object Qx_frame_parameter;
 Lisp_Object Qx_resource_name;
+Lisp_Object Qdisplay_id;
+Lisp_Object Qdisplay_live_p;
 
 /* Frame parameters (set or reported).  */
 
@@ -106,12 +109,13 @@ Lisp_Object Qmenu_bar_lines, Qtool_bar_lines;
 Lisp_Object Qleft_fringe, Qright_fringe;
 Lisp_Object Qbuffer_predicate, Qbuffer_list;
 Lisp_Object Qtty_color_mode;
+Lisp_Object Qtty, Qtty_type;
+Lisp_Object Qwindow_system;
 
 Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
 
 Lisp_Object Qface_set_after_frame_default;
 
-
 Lisp_Object Vterminal_frame;
 Lisp_Object Vdefault_frame_alist;
 Lisp_Object Vdefault_frame_scroll_bars;
@@ -121,8 +125,8 @@ Lisp_Object Vdelete_frame_functions;
 \f
 static void
 set_menu_bar_lines_1 (window, n)
-  Lisp_Object window;
-  int n;
+     Lisp_Object window;
+     int n;
 {
   struct window *w = XWINDOW (window);
 
@@ -180,8 +184,6 @@ set_menu_bar_lines (f, value, oldval)
 Lisp_Object Vemacs_iconified;
 Lisp_Object Vframe_list;
 
-struct x_output tty_display;
-
 extern Lisp_Object Vminibuffer_list;
 extern Lisp_Object get_minibuffer ();
 extern Lisp_Object Fhandle_switch_frame ();
@@ -203,6 +205,7 @@ See also `frame-live-p'.  */)
     return Qnil;
   switch (XFRAME (object)->output_method)
     {
+    case output_initial: /* The initial frame is like a termcap frame. */
     case output_termcap:
       return Qt;
     case output_x_window:
@@ -233,6 +236,30 @@ return values.  */)
          : Qnil);
 }
 
+DEFUN ("window-system", Fwindow_system, Swindow_system, 0, 1, 0,
+       doc: /* The name of the window system that FRAME is displaying through.
+The value is a symbol---for instance, 'x' for X windows.
+The value is nil if Emacs is using a text-only terminal.
+
+FRAME defaults to the currently selected frame.  */)
+  (frame)
+     Lisp_Object frame;
+{
+  Lisp_Object type;
+  if (NILP (frame))
+    frame = selected_frame;
+
+  type = Fframep (frame);
+
+  if (NILP (type))
+    wrong_type_argument (Qframep, frame);
+
+  if (EQ (type, Qt))
+    return Qnil;
+  else
+    return type;
+}      
+
 struct frame *
 make_frame (mini_p)
      int mini_p;
@@ -276,9 +303,6 @@ make_frame (mini_p)
   f->menu_bar_items_used = 0;
   f->buffer_predicate = Qnil;
   f->buffer_list = Qnil;
-#ifdef MULTI_KBOARD
-  f->kboard = initial_kboard;
-#endif
   f->namebuf = 0;
   f->title = Qnil;
   f->menu_bar_window = Qnil;
@@ -398,7 +422,7 @@ make_frame_without_minibuffer (mini_window, kb, display)
 
 #ifdef MULTI_KBOARD
   if (!NILP (mini_window)
-      && XFRAME (XWINDOW (mini_window)->frame)->kboard != kb)
+      && XFRAME (XWINDOW (mini_window)->frame)->display->kboard != kb)
     error ("Frame and minibuffer must be on the same display");
 #endif
 
@@ -475,18 +499,19 @@ make_minibuffer_frame ()
 }
 #endif /* HAVE_WINDOW_SYSTEM */
 \f
-/* Construct a frame that refers to the terminal (stdin and stdout).  */
+/* Construct a frame that refers to a terminal.  */
 
 static int terminal_frame_count;
 
 struct frame *
-make_terminal_frame ()
+make_initial_frame (void)
 {
-  register struct frame *f;
+  struct frame *f;
+  struct display *display;
   Lisp_Object frame;
-  char name[20];
 
 #ifdef MULTI_KBOARD
+  /* Create the initial keyboard. */
   if (!initial_kboard)
     {
       initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
@@ -500,6 +525,41 @@ make_terminal_frame ()
   if (! (NILP (Vframe_list) || CONSP (Vframe_list)))
     Vframe_list = Qnil;
 
+  display = init_initial_display ();
+
+  f = make_frame (1);
+  XSETFRAME (frame, f);
+
+  Vframe_list = Fcons (frame, Vframe_list);
+
+  terminal_frame_count = 1;
+  f->name = build_string ("F1");
+
+  f->visible = 1;
+  f->async_visible = 1;
+
+  f->output_method = display->type;
+  f->display = display;
+  f->display->reference_count++;
+  f->output_data.nothing = 0;
+  
+  FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR;
+  FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR;
+    
+  FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
+  FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
+
+  return f;
+}
+
+
+struct frame *
+make_terminal_frame (struct display *display)
+{
+  register struct frame *f;
+  Lisp_Object frame;
+  char name[20];
+  
   f = make_frame (1);
 
   XSETFRAME (frame, f);
@@ -538,12 +598,31 @@ make_terminal_frame ()
 #else
 #ifdef WINDOWSNT
   f->output_method = output_termcap;
-  f->output_data.x = &tty_display;
+  f->output_data.x = &tty_display; /* XXX ??? */
 #else
 #ifdef MAC_OS8
   make_mac_terminal_frame (f);
 #else
-  f->output_data.x = &tty_display;
+  {
+    f->output_method = output_termcap;
+    f->display = display;
+    f->display->reference_count++;
+    create_tty_output (f);
+    
+    FRAME_FOREGROUND_PIXEL (f) = FACE_TTY_DEFAULT_FG_COLOR;
+    FRAME_BACKGROUND_PIXEL (f) = FACE_TTY_DEFAULT_BG_COLOR;
+    
+    FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
+    FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
+
+    /* Set the top frame to the newly created frame. */
+    if (FRAME_TTY (f)->top_frame
+        && FRAME_LIVE_P (XFRAME (FRAME_TTY (f)->top_frame)))
+      XFRAME (FRAME_TTY (f)->top_frame)->async_visible = 2; /* obscured */
+    
+    FRAME_TTY (f)->top_frame = frame;
+  }
+  
 #ifdef CANNOT_DUMP
   FRAME_FOREGROUND_PIXEL(f) = FACE_TTY_DEFAULT_FG_COLOR;
   FRAME_BACKGROUND_PIXEL(f) = FACE_TTY_DEFAULT_BG_COLOR;
@@ -560,16 +639,26 @@ make_terminal_frame ()
 
 DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame,
        1, 1, 0,
-       doc: /* Create an additional terminal frame.
-You can create multiple frames on a text-only terminal in this way.
-Only the selected terminal frame is actually displayed.
+       doc: /* Create an additional terminal frame, possibly on another terminal.
 This function takes one argument, an alist specifying frame parameters.
-In practice, generally you don't need to specify any parameters.
-Note that changing the size of one terminal frame automatically affects all.  */)
+
+You can create multiple frames on a single text-only terminal, but
+only one of them (the selected terminal frame) is actually displayed.
+
+In practice, generally you don't need to specify any parameters,
+except when you want to create a new frame on another terminal.
+In that case, the `tty' parameter specifies the device file to open,
+and the `tty-type' parameter specifies the terminal type.  Example:
+
+   (make-terminal-frame '((tty . "/dev/pts/5") (tty-type . "xterm")))
+
+Note that changing the size of one terminal frame automatically
+affects all frames on the same terminal device.  */)
      (parms)
      Lisp_Object parms;
 {
   struct frame *f;
+  struct display *d = NULL;
   Lisp_Object frame, tem;
   struct frame *sf = SELECTED_FRAME ();
 
@@ -583,20 +672,87 @@ Note that changing the size of one terminal frame automatically affects all.  */
   if (sf->output_method != output_mac)
     error ("Not running on a Macintosh screen; cannot make a new Macintosh frame");
 #else
+#if 0                           /* This should work now! */
   if (sf->output_method != output_termcap)
     error ("Not using an ASCII terminal now; cannot make a new ASCII frame");
 #endif
+#endif
 #endif /* not MSDOS */
+  
+  {
+    Lisp_Object display_device;
 
-  f = make_terminal_frame ();
+    display_device = Fassq (Qdisplay_id, parms);
+    if (!NILP (display_device))
+      {
+        display_device = XCDR (display_device);
+        CHECK_NUMBER (display_device);
+        d = get_display (XINT (display_device), 1);
+      }
+  }
+  
+  if (!d)
+    { 
+      Lisp_Object tty, tty_type;
+      char *name = 0, *type = 0;
+
+      tty = Fassq (Qtty, parms);
+      if (EQ (tty, Qnil))
+        tty = Fassq (Qtty, XFRAME (selected_frame)->param_alist);
+      if (EQ (tty, Qnil) && FRAME_TERMCAP_P (XFRAME (selected_frame))
+          && FRAME_TTY (XFRAME (selected_frame))->name)
+        tty = build_string (FRAME_TTY (XFRAME (selected_frame))->name);
+      if (EQ (tty, Qnil))
+        tty = Fassq (Qtty, Vdefault_frame_alist);
+      if (! EQ (tty, Qnil) && ! STRINGP (tty))
+        tty = XCDR (tty);
+      if (EQ (tty, Qnil) || !STRINGP (tty))
+        tty = Qnil;
+
+      tty_type = Fassq (Qtty_type, parms);
+      if (EQ (tty_type, Qnil))
+        tty_type = Fassq (Qtty, XFRAME (selected_frame)->param_alist);
+      if (EQ (tty_type, Qnil) && FRAME_TERMCAP_P (XFRAME (selected_frame))
+          && FRAME_TTY (XFRAME (selected_frame))->type)
+        tty_type = build_string (FRAME_TTY (XFRAME (selected_frame))->type);
+      if (EQ (tty_type, Qnil))
+        tty_type = Fassq (Qtty_type, Vdefault_frame_alist);
+      if (! EQ (tty_type, Qnil) && ! STRINGP (tty_type))
+        tty_type = XCDR (tty_type);
+      if (EQ (tty_type, Qnil) || !STRINGP (tty_type))
+        tty_type = Qnil;
+
+      if (! EQ (tty, Qnil))
+        {
+          name = (char *) alloca (SBYTES (tty) + 1);
+          strncpy (name, SDATA (tty), SBYTES (tty));
+          name[SBYTES (tty)] = 0;
+        }
+      
+      if (! EQ (tty_type, Qnil))
+        {
+          type = (char *) alloca (SBYTES (tty_type) + 1);
+          strncpy (type, SDATA (tty_type), SBYTES (tty_type));
+          type[SBYTES (tty_type)] = 0;
+        }
+
+      d = term_init (name, type, 0); /* Errors are not fatal. */
+    }
 
-  change_frame_size (f, FRAME_LINES (sf),
-                    FRAME_COLS (sf), 0, 0, 0);
+  f = make_terminal_frame (d);
+
+  {
+    int width, height;
+    get_tty_size (fileno (FRAME_TTY (f)->input), &width, &height);
+    change_frame_size (f, height, width, 0, 0, 0);
+  }
+  
   adjust_glyphs (f);
   calculate_costs (f);
   XSETFRAME (frame, f);
   Fmodify_frame_parameters (frame, Vdefault_frame_alist);
   Fmodify_frame_parameters (frame, parms);
+  Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qnil), Qnil));
 
   /* Make the frame face alist be frame-specific, so that each
      frame could change its face definitions independently.  */
@@ -695,6 +851,15 @@ do_switch_frame (frame, track, for_deletion)
   if (!for_deletion && FRAME_HAS_MINIBUF_P (sf))
     resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1);
 
+  if (FRAME_TERMCAP_P (XFRAME (selected_frame))
+      && FRAME_TERMCAP_P (XFRAME (frame))
+      && FRAME_TTY (XFRAME (selected_frame)) == FRAME_TTY (XFRAME (frame)))
+    {
+      XFRAME (selected_frame)->async_visible = 2; /* obscured */
+      XFRAME (frame)->async_visible = 1;
+      FRAME_TTY (XFRAME (frame))->top_frame = frame;
+    }
+
   selected_frame = frame;
   if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame)))
     last_nonminibuf_frame = XFRAME (selected_frame);
@@ -878,6 +1043,31 @@ If FRAME is the selected frame, this makes WINDOW the selected window.  */)
 
   return XFRAME (frame)->selected_window = window;
 }
+\f
+
+DEFUN ("frame-display", Fframe_display, Sframe_display, 0, 1, 0,
+       doc: /* Return the display device that FRAME is displayed on.
+If FRAME is nil, the selected frame is used.
+
+The display device is represented by its integer identifier.  */)
+  (frame)
+     Lisp_Object frame;
+{
+  struct display *d;
+
+  if (NILP (frame))
+    frame = selected_frame;
+
+  CHECK_LIVE_FRAME (frame);
+
+  d = get_display (frame, 0);
+
+  if (!d)
+    return Qnil;
+  else
+    return make_number (d->id);
+}
+
 \f
 DEFUN ("frame-list", Fframe_list, Sframe_list,
        0, 0, 0,
@@ -925,7 +1115,10 @@ next_frame (frame, minibuf)
        f = XCAR (tail);
 
        if (passed
-           && FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame)))
+           && ((!FRAME_TERMCAP_P (XFRAME (f)) && !FRAME_TERMCAP_P (XFRAME (frame))
+                 && FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame)))
+                || (FRAME_TERMCAP_P (XFRAME (f)) && FRAME_TERMCAP_P (XFRAME (frame))
+                    && FRAME_TTY (XFRAME (f)) == FRAME_TTY (XFRAME (frame)))))
          {
            /* Decide whether this frame is eligible to be returned.  */
 
@@ -1002,7 +1195,10 @@ prev_frame (frame, minibuf)
       if (EQ (frame, f) && !NILP (prev))
        return prev;
 
-      if (FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame)))
+      if ((!FRAME_TERMCAP_P (XFRAME (f)) && !FRAME_TERMCAP_P (XFRAME (frame))
+           && FRAME_KBOARD (XFRAME (f)) == FRAME_KBOARD (XFRAME (frame)))
+          || (FRAME_TERMCAP_P (XFRAME (f)) && FRAME_TERMCAP_P (XFRAME (frame))
+              && FRAME_TTY (XFRAME (f)) == FRAME_TTY (XFRAME (frame))))
        {
          /* Decide whether this frame is eligible to be returned,
             according to minibuf.  */
@@ -1151,6 +1347,8 @@ The functions are run with one arg, the frame to be deleted.  */)
 {
   struct frame *f;
   struct frame *sf = SELECTED_FRAME ();
+  struct kboard *kb;
+
   int minibuffer_selected;
 
   if (EQ (frame, Qnil))
@@ -1214,6 +1412,10 @@ The functions are run with one arg, the frame to be deleted.  */)
       Frun_hook_with_args (2, args);
     }
 
+  /* The hook may sometimes (indirectly) cause the frame to be deleted.  */
+  if (! FRAME_LIVE_P (f))
+    return Qnil;
+
   minibuffer_selected = EQ (minibuf_window, selected_window);
 
   /* Don't let the frame remain selected.  */
@@ -1229,7 +1431,7 @@ The functions are run with one arg, the frame to be deleted.  */)
        {
          FOR_EACH_FRAME (tail, frame1)
            {
-             if (! EQ (frame, frame1))
+             if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1)))
                break;
            }
        }
@@ -1300,13 +1502,28 @@ The functions are run with one arg, the frame to be deleted.  */)
      promise that the display of the frame must be valid until we have
      called the window-system-dependent frame destruction routine.  */
 
-  /* I think this should be done with a hook.  */
-#ifdef HAVE_WINDOW_SYSTEM
-  if (FRAME_WINDOW_P (f))
-    x_destroy_window (f);
-#endif
+  if (FRAME_DISPLAY (f)->delete_frame_hook)
+    (*FRAME_DISPLAY (f)->delete_frame_hook) (f);
 
-  f->output_data.nothing = 0;
+  {
+    struct display *display = FRAME_DISPLAY (f);
+    f->output_data.nothing = 0; 
+    f->display = 0;             /* Now the frame is dead. */
+
+    /* If needed, delete the device that this frame was on.
+       (This must be done after the frame is killed.) */
+    display->reference_count--;
+    if (display->reference_count == 0)
+      {
+        kb = NULL;
+        if (display->delete_display_hook)
+          (*display->delete_display_hook) (display);
+        else
+          delete_display (display);
+      }
+    else
+      kb = display->kboard;
+  }
 
   /* If we've deleted the last_nonminibuf_frame, then try to find
      another one.  */
@@ -1331,38 +1548,39 @@ The functions are run with one arg, the frame to be deleted.  */)
 
   /* If there's no other frame on the same kboard, get out of
      single-kboard state if we're in it for this kboard.  */
-  {
-    Lisp_Object frames;
-    /* Some frame we found on the same kboard, or nil if there are none.  */
-    Lisp_Object frame_on_same_kboard;
+  if (kb != NULL)
+    {
+      Lisp_Object frames;
+      /* Some frame we found on the same kboard, or nil if there are none.  */
+      Lisp_Object frame_on_same_kboard;
 
-    frame_on_same_kboard = Qnil;
+      frame_on_same_kboard = Qnil;
 
-    for (frames = Vframe_list;
-        CONSP (frames);
-        frames = XCDR (frames))
-      {
-       Lisp_Object this;
-       struct frame *f1;
+      for (frames = Vframe_list;
+          CONSP (frames);
+          frames = XCDR (frames))
+       {
+         Lisp_Object this;
+         struct frame *f1;
 
-       this = XCAR (frames);
-       if (!FRAMEP (this))
-         abort ();
-       f1 = XFRAME (this);
+         this = XCAR (frames);
+         if (!FRAMEP (this))
+           abort ();
+         f1 = XFRAME (this);
 
-       if (FRAME_KBOARD (f) == FRAME_KBOARD (f1))
-         frame_on_same_kboard = this;
-      }
+         if (kb == FRAME_KBOARD (f1))
+           frame_on_same_kboard = this;
+       }
 
-    if (NILP (frame_on_same_kboard))
-      not_single_kboard_state (FRAME_KBOARD (f));
-  }
+      if (NILP (frame_on_same_kboard))
+       not_single_kboard_state (kb);
+    }
 
 
   /* If we've deleted this keyboard's default_minibuffer_frame, try to
      find another one.  Prefer minibuffer-only frames, but also notice
      frames with other windows.  */
-  if (EQ (frame, FRAME_KBOARD (f)->Vdefault_minibuffer_frame))
+  if (kb != NULL && EQ (frame, kb->Vdefault_minibuffer_frame))
     {
       Lisp_Object frames;
 
@@ -1388,7 +1606,7 @@ The functions are run with one arg, the frame to be deleted.  */)
 
          /* Consider only frames on the same kboard
             and only those with minibuffers.  */
-         if (FRAME_KBOARD (f) == FRAME_KBOARD (f1)
+         if (kb == FRAME_KBOARD (f1)
              && FRAME_HAS_MINIBUF_P (f1))
            {
              frame_with_minibuf = this;
@@ -1396,7 +1614,7 @@ The functions are run with one arg, the frame to be deleted.  */)
                break;
            }
 
-         if (FRAME_KBOARD (f) == FRAME_KBOARD (f1))
+         if (kb == FRAME_KBOARD (f1))
            frame_on_same_kboard = this;
        }
 
@@ -1411,11 +1629,11 @@ The functions are run with one arg, the frame to be deleted.  */)
          if (NILP (frame_with_minibuf))
            abort ();
 
-         FRAME_KBOARD (f)->Vdefault_minibuffer_frame = frame_with_minibuf;
+         kb->Vdefault_minibuffer_frame = frame_with_minibuf;
        }
       else
        /* No frames left on this kboard--say no minibuffer either.  */
-       FRAME_KBOARD (f)->Vdefault_minibuffer_frame = Qnil;
+       kb->Vdefault_minibuffer_frame = Qnil;
     }
 
   /* Cause frame titles to update--necessary if we now have just one frame.  */
@@ -1451,11 +1669,11 @@ and returns whatever that function returns.  */)
 
 #ifdef HAVE_MOUSE
   /* It's okay for the hook to refrain from storing anything.  */
-  if (mouse_position_hook)
-    (*mouse_position_hook) (&f, -1,
-                           &lispy_dummy, &party_dummy,
-                           &x, &y,
-                           &long_dummy);
+  if (FRAME_DISPLAY (f)->mouse_position_hook)
+    (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, -1,
+                                              &lispy_dummy, &party_dummy,
+                                              &x, &y,
+                                              &long_dummy);
   if (! NILP (x))
     {
       col = XINT (x);
@@ -1494,11 +1712,11 @@ and nil for X and Y.  */)
 
 #ifdef HAVE_MOUSE
   /* It's okay for the hook to refrain from storing anything.  */
-  if (mouse_position_hook)
-    (*mouse_position_hook) (&f, -1,
-                           &lispy_dummy, &party_dummy,
-                           &x, &y,
-                           &long_dummy);
+  if (FRAME_DISPLAY (f)->mouse_position_hook)
+    (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, -1,
+                                              &lispy_dummy, &party_dummy,
+                                              &x, &y,
+                                              &long_dummy);
 #endif
   XSETFRAME (lispy_dummy, f);
   return Fcons (lispy_dummy, Fcons (x, y));
@@ -1764,16 +1982,19 @@ doesn't support multiple overlapping frames, this function does nothing.  */)
      (frame)
      Lisp_Object frame;
 {
+  struct frame *f;
   if (NILP (frame))
     frame = selected_frame;
 
   CHECK_LIVE_FRAME (frame);
 
+  f = XFRAME (frame);
+  
   /* Do like the documentation says. */
   Fmake_frame_visible (frame);
 
-  if (frame_raise_lower_hook)
-    (*frame_raise_lower_hook) (XFRAME (frame), 1);
+  if (FRAME_DISPLAY (f)->frame_raise_lower_hook)
+    (*FRAME_DISPLAY (f)->frame_raise_lower_hook) (f, 1);
 
   return Qnil;
 }
@@ -1787,13 +2008,17 @@ doesn't support multiple overlapping frames, this function does nothing.  */)
      (frame)
      Lisp_Object frame;
 {
+  struct frame *f;
+  
   if (NILP (frame))
     frame = selected_frame;
 
   CHECK_LIVE_FRAME (frame);
 
-  if (frame_raise_lower_hook)
-    (*frame_raise_lower_hook) (XFRAME (frame), 0);
+  f = XFRAME (frame);
+  
+  if (FRAME_DISPLAY (f)->frame_raise_lower_hook)
+    (*FRAME_DISPLAY (f)->frame_raise_lower_hook) (f, 0);
 
   return Qnil;
 }
@@ -1827,6 +2052,8 @@ The redirection lasts until `redirect-frame-focus' is called to change it.  */)
      (frame, focus_frame)
      Lisp_Object frame, focus_frame;
 {
+  struct frame *f;
+  
   /* Note that we don't check for a live frame here.  It's reasonable
      to redirect the focus of a frame you're about to delete, if you
      know what other frame should receive those keystrokes.  */
@@ -1835,10 +2062,12 @@ The redirection lasts until `redirect-frame-focus' is called to change it.  */)
   if (! NILP (focus_frame))
     CHECK_LIVE_FRAME (focus_frame);
 
-  XFRAME (frame)->focus_frame = focus_frame;
+  f = XFRAME (frame);
+  
+  f->focus_frame = focus_frame;
 
-  if (frame_rehighlight_hook)
-    (*frame_rehighlight_hook) (XFRAME (frame));
+  if (FRAME_DISPLAY (f)->frame_rehighlight_hook)
+    (*FRAME_DISPLAY (f)->frame_rehighlight_hook) (f);
 
   return Qnil;
 }
@@ -2733,8 +2962,8 @@ x_set_frame_parameters (f, alist)
              if (NATNUMP (param_index)
                  && (XFASTINT (param_index)
                      < sizeof (frame_parms)/sizeof (frame_parms[0]))
-                 && rif->frame_parm_handlers[XINT (param_index)])
-               (*(rif->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
+                  && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
+                (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
            }
        }
     }
@@ -2777,8 +3006,8 @@ x_set_frame_parameters (f, alist)
          if (NATNUMP (param_index)
              && (XFASTINT (param_index)
                  < sizeof (frame_parms)/sizeof (frame_parms[0]))
-             && rif->frame_parm_handlers[XINT (param_index)])
-           (*(rif->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
+             && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
+           (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
        }
     }
 
@@ -3972,7 +4201,13 @@ syms_of_frame ()
   staticpro (&Qbackground_mode);
   Qtty_color_mode = intern ("tty-color-mode");
   staticpro (&Qtty_color_mode);
-
+  Qtty = intern ("tty");
+  staticpro (&Qtty);
+  Qtty_type = intern ("tty-type");
+  staticpro (&Qtty_type);
+  Qwindow_system = intern ("window-system");
+  staticpro (&Qwindow_system);
+  
   Qface_set_after_frame_default = intern ("face-set-after-frame-default");
   staticpro (&Qface_set_after_frame_default);
 
@@ -3988,6 +4223,11 @@ syms_of_frame ()
   Qx_frame_parameter = intern ("x-frame-parameter");
   staticpro (&Qx_frame_parameter);
 
+  Qdisplay_id = intern ("display-id");
+  staticpro (&Qdisplay_id);
+  Qdisplay_live_p = intern ("display-live-p");
+  staticpro (&Qdisplay_live_p);
+  
   {
     int i;
 
@@ -4061,7 +4301,7 @@ Setting this variable does not affect existing frames, only new ones.  */);
   staticpro (&Qinhibit_default_face_x_resources);
 
   DEFVAR_LISP ("terminal-frame", &Vterminal_frame,
-              doc: /* The initial frame-object, which represents Emacs's stdout.  */);
+               doc: /* The initial frame-object, which represents Emacs's stdout.  */);
 
   DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified,
               doc: /* Non-nil if all of emacs is iconified and frame updates are not needed.  */);
@@ -4109,6 +4349,7 @@ This variable is local to the current terminal and cannot be buffer-local.  */);
   defsubr (&Sactive_minibuffer_window);
   defsubr (&Sframep);
   defsubr (&Sframe_live_p);
+  defsubr (&Swindow_system);
   defsubr (&Smake_terminal_frame);
   defsubr (&Shandle_switch_frame);
   defsubr (&Sselect_frame);
@@ -4118,6 +4359,7 @@ This variable is local to the current terminal and cannot be buffer-local.  */);
   defsubr (&Sframe_first_window);
   defsubr (&Sframe_selected_window);
   defsubr (&Sset_frame_selected_window);
+  defsubr (&Sframe_display);
   defsubr (&Sframe_list);
   defsubr (&Snext_frame);
   defsubr (&Sprevious_frame);
index d70b38d3203717be747479245b3cc9e19d035edf..625f3ffa81743f7ba6b0bcd59bbbcdeaea559efc 100644 (file)
@@ -28,9 +28,7 @@ Boston, MA 02110-1301, USA.  */
 \f
 /* Miscellanea.  */
 
-/* Nonzero means don't assume anything about current contents of
-   actual terminal frame */
-
+/* Nonzero means there is at least one garbaged frame. */
 extern int frame_garbaged;
 
 /* Nonzero means FRAME_MESSAGE_BUF (selected_frame) is being used by
@@ -43,6 +41,7 @@ extern int message_buf_print;
 
 enum output_method
 {
+  output_initial,
   output_termcap,
   output_x_window,
   output_msdos_raw,
@@ -67,30 +66,10 @@ enum text_cursor_kinds
   HBAR_CURSOR
 };
 
-#if !defined(MSDOS) && !defined(WINDOWSNT) && !defined(MAC_OS)
-
-#if !defined(HAVE_X_WINDOWS)
-
-#define PIX_TYPE int
-
-/* A (mostly empty) x_output structure definition for building Emacs
-   on Unix and GNU/Linux without X support.  */
-struct x_output
-{
-  PIX_TYPE background_pixel;
-  PIX_TYPE foreground_pixel;
-};
-
-#endif /* ! HAVE_X_WINDOWS */
-
+#define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel)
+#define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel)
 
-#define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_pixel)
-#define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_pixel)
-
-/* A structure describing a termcap frame display.  */
-extern struct x_output tty_display;
-
-#endif /* ! MSDOS && ! WINDOWSNT && ! MAC_OS */
+struct display;
 
 struct frame
 {
@@ -281,20 +260,24 @@ struct frame
   /* Canonical Y unit.  Height of a line, in pixels.  */
   int line_height;
 
-  /* The output method says how the contents of this frame
-     are displayed.  It could be using termcap, or using an X window.  */
+  /* The output method says how the contents of this frame are
+     displayed.  It could be using termcap, or using an X window.
+     This must be the same as the display->type. */
   enum output_method output_method;
 
-  /* A structure of auxiliary data used for displaying the contents.
-     struct x_output is used for X window frames;
-     it is defined in xterm.h.
-     struct w32_output is used for W32 window frames;
-     it is defined in w32term.h.  */
+  /* The display that this frame uses.  If this is NULL, then the
+     frame is deleted. */
+  struct display *display;
+  
+  /* Display-dependent, frame-local auxiliary data used for displaying
+     the contents.  When the frame is deleted, this data is deleted as
+     well. */
   union output_data
   {
-    struct x_output *x;
-    struct w32_output *w32;
-    struct mac_output *mac;
+    struct tty_output *tty;     /* termchar.h */
+    struct x_output *x;         /* xterm.h */
+    struct w32_output *w32;     /* w32term.h */
+    struct mac_output *mac;     /* macterm.h */
     EMACS_INT nothing;
   }
   output_data;
@@ -309,13 +292,6 @@ struct frame
   /* The extra width (in pixels) currently allotted for fringes.  */
   int left_fringe_width, right_fringe_width;
 
-#ifdef MULTI_KBOARD
-  /* A pointer to the kboard structure associated with this frame.
-     For termcap frames, this points to initial_kboard.  For X frames,
-     it will be the same as display.x->display_info->kboard.  */
-  struct kboard *kboard;
-#endif
-
   /* See FULLSCREEN_ enum below */
   int want_fullscreen;
 
@@ -339,13 +315,13 @@ struct frame
      frame becomes visible again, it must be marked as garbaged.  The
      FRAME_SAMPLE_VISIBILITY macro takes care of this.
 
-     On Windows NT/9X, to avoid wasting effort updating visible frames
-     that are actually completely obscured by other windows on the
-     display, we bend the meaning of visible slightly: if greater than
-     1, then the frame is obscured - we still consider it to be
-     "visible" as seen from lisp, but we don't bother updating it.  We
-     must take care to garbage the frame when it ceaces to be obscured
-     though.  Note that these semantics are only used on NT/9X.
+     On ttys and on Windows NT/9X, to avoid wasting effort updating
+     visible frames that are actually completely obscured by other
+     windows on the display, we bend the meaning of visible slightly:
+     if greater than 1, then the frame is obscured - we still consider
+     it to be "visible" as seen from lisp, but we don't bother
+     updating it.  We must take care to garbage the frame when it
+     ceaces to be obscured though.
 
      iconified is nonzero if the frame is currently iconified.
 
@@ -458,7 +434,11 @@ struct frame
   /* Set to non-zero in when we want for force a flush_display in
      update_frame, usually after resizing the frame.  */
   unsigned force_flush_display_p : 1;
-
+  
+  /* All display backends seem to need these two pixel values. */
+  unsigned long background_pixel;
+  unsigned long foreground_pixel;
+  
   /* Set to non-zero if the default face for the frame has been
      realized.  Reset to zero whenever the default face changes.
      Used to see the difference between a font change and face change.  */
@@ -466,7 +446,7 @@ struct frame
 };
 
 #ifdef MULTI_KBOARD
-#define FRAME_KBOARD(f) ((f)->kboard)
+#define FRAME_KBOARD(f) ((f)->display->kboard)
 #else
 #define FRAME_KBOARD(f) (&the_only_kboard)
 #endif
@@ -480,6 +460,7 @@ typedef struct frame *FRAME_PTR;
 #define WINDOW_FRAME(w) (w)->frame
 
 /* Test a frame for particular kinds of display methods.  */
+#define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
 #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
@@ -503,7 +484,7 @@ typedef struct frame *FRAME_PTR;
 #endif
 
 /* Nonzero if frame F is still alive (not deleted).  */
-#define FRAME_LIVE_P(f) ((f)->output_data.nothing != 0)
+#define FRAME_LIVE_P(f) ((f)->display != 0)
 
 /* Nonzero if frame F is a minibuffer-only frame.  */
 #define FRAME_MINIBUF_ONLY_P(f) \
@@ -743,7 +724,10 @@ typedef struct frame *FRAME_PTR;
 
    Also, if a frame used to be invisible, but has just become visible,
    it must be marked as garbaged, since redisplay hasn't been keeping
-   up its contents.  */
+   up its contents.
+
+   Note that a tty frame is visible if and only if it is the topmost
+   frame. */
 
 #define FRAME_SAMPLE_VISIBILITY(f) \
   (((f)->async_visible && (f)->visible != (f)->async_visible) ? \
@@ -783,10 +767,13 @@ typedef struct frame *FRAME_PTR;
 
 
 extern Lisp_Object Qframep, Qframe_live_p;
+extern Lisp_Object Qtty, Qtty_type;
+extern Lisp_Object Qdisplay_id, Qdisplay_live_p;
 
 extern struct frame *last_nonminibuf_frame;
 
-extern struct frame *make_terminal_frame P_ ((void));
+extern struct frame *make_initial_frame P_ ((void));
+extern struct frame *make_terminal_frame P_ ((struct display *));
 extern struct frame *make_frame P_ ((int));
 #ifdef HAVE_WINDOW_SYSTEM
 extern struct frame *make_minibuffer_frame P_ ((void));
@@ -1018,6 +1005,8 @@ extern Lisp_Object Qx_resource_name;
 extern Lisp_Object Qleft, Qright, Qtop, Qbox;
 extern Lisp_Object Qdisplay;
 
+extern Lisp_Object Qwindow_system;
+
 #ifdef HAVE_WINDOW_SYSTEM
 
 /* The class of this X application.  */
index 082aabc37a1336424c63c02ec330abb9b476dcc7..7731c0302e915db04038ec36a03eb78609594f6b 100644 (file)
@@ -28,6 +28,7 @@ Boston, MA 02110-1301, USA.  */
 #include "dispextern.h"
 #include "buffer.h"
 #include "blockinput.h"
+#include "termhooks.h"
 
 #ifdef HAVE_WINDOW_SYSTEM
 
@@ -652,7 +653,7 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which)
       break;
     }
 
-  rif->draw_fringe_bitmap (w, row, &p);
+  FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p);
 }
 
 void
@@ -1086,6 +1087,8 @@ destroy_fringe_bitmap (n)
   fbp = &fringe_bitmaps[n];
   if (*fbp && (*fbp)->dynamic)
     {
+      /* XXX Is SELECTED_FRAME OK here? */
+      struct redisplay_interface *rif = FRAME_RIF (SELECTED_FRAME ());
       if (rif && rif->destroy_fringe_bitmap)
        rif->destroy_fringe_bitmap (n);
       xfree (*fbp);
@@ -1191,6 +1194,9 @@ init_fringe_bitmap (which, fb, once_p)
 
   if (!once_p)
     {
+      /* XXX Is SELECTED_FRAME OK here? */
+      struct redisplay_interface *rif = FRAME_RIF (SELECTED_FRAME ());
+
       destroy_fringe_bitmap (which);
 
       if (rif && rif->define_fringe_bitmap)
index ff188183327b6d25d88aa6b788e8325fac58e506..2dc113a9086fb2beada9c780c30be048c4f5dd9e 100644 (file)
@@ -20,6 +20,8 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
+#include <stdio.h>
+
 #include "lisp.h"
 #include "buffer.h"
 #include "charset.h"
index 0d3e50ff694dff49a07f0c11960fd4f091cf74e0..374f89841672eb134bc357ba246f15ceab66b6f2 100644 (file)
@@ -87,7 +87,7 @@ struct interval
 
 #ifdef ENABLE_CHECKING
 #define NULL_INTERVAL_P(i) \
-   (CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL)
+  ((void)CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL)
 /* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */
 #else
 #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL)
index 88cc0badd2b8058bbf3aa5d7ad5f0408af2aebaa..599ab282619e9bac97f7f354fcd8b6574715e0f5 100644 (file)
@@ -22,13 +22,13 @@ Boston, MA 02110-1301, USA.  */
 #include <config.h>
 #include <signal.h>
 #include <stdio.h>
+#include "lisp.h"
 #include "termchar.h"
 #include "termopts.h"
-#include "lisp.h"
+#include "frame.h"
 #include "termhooks.h"
 #include "macros.h"
 #include "keyboard.h"
-#include "frame.h"
 #include "window.h"
 #include "commands.h"
 #include "buffer.h"
@@ -58,7 +58,6 @@ Boston, MA 02110-1301, USA.  */
 #endif /* not MSDOS */
 
 #include "syssignal.h"
-#include "systty.h"
 
 #include <sys/types.h>
 #ifdef HAVE_UNISTD_H
@@ -96,9 +95,6 @@ int interrupt_input_blocked;
 int interrupt_input_pending;
 
 
-/* File descriptor to use for input.  */
-extern int input_fd;
-
 #ifdef HAVE_WINDOW_SYSTEM
 /* Make all keyboard buffers much bigger when using X windows.  */
 #ifdef MAC_OS8
@@ -421,13 +417,6 @@ Lisp_Object Vtop_level;
 /* User-supplied table to translate input characters.  */
 Lisp_Object Vkeyboard_translate_table;
 
-/* Keymap mapping ASCII function key sequences onto their preferred forms.  */
-extern Lisp_Object Vfunction_key_map;
-
-/* Another keymap that maps key sequences into key sequences.
-   This one takes precedence over ordinary definitions.  */
-extern Lisp_Object Vkey_translation_map;
-
 /* If non-nil, this implements the current input method.  */
 Lisp_Object Vinput_method_function;
 Lisp_Object Qinput_method_function;
@@ -451,6 +440,9 @@ Lisp_Object Qpre_command_hook, Vpre_command_hook;
 Lisp_Object Qpost_command_hook, Vpost_command_hook;
 Lisp_Object Qcommand_hook_internal, Vcommand_hook_internal;
 
+/* Parent keymap of terminal-local key-translation-map instances.  */
+Lisp_Object Vglobal_key_translation_map;
+
 /* List of deferred actions to be performed at a later time.
    The precise format isn't relevant here; we just check whether it is nil.  */
 Lisp_Object Vdeferred_action_list;
@@ -468,11 +460,6 @@ FILE *dribble;
 /* Nonzero if input is available.  */
 int input_pending;
 
-/* 1 if should obey 0200 bit in input chars as "Meta", 2 if should
-   keep 0200 bit in input chars.  0 to ignore the 0200 bit.  */
-
-int meta_key;
-
 /* Non-zero means force key bindings update in parse_menu_item.  */
 
 int update_menu_bindings;
@@ -603,9 +590,6 @@ int interrupt_input;
 /* Nonzero while interrupts are temporarily deferred during redisplay.  */
 int interrupts_deferred;
 
-/* Nonzero means use ^S/^Q for flow control.  */
-int flow_control;
-
 /* Allow m- file to inhibit use of FIONREAD.  */
 #ifdef BROKEN_FIONREAD
 #undef FIONREAD
@@ -685,6 +669,7 @@ static Lisp_Object apply_modifiers P_ ((int, Lisp_Object));
 static void clear_event P_ ((struct input_event *));
 static void any_kboard_state P_ ((void));
 static SIGTYPE interrupt_signal P_ ((int signalnum));
+static void handle_interrupt P_ ((void));
 static void timer_start_idle P_ ((void));
 static void timer_stop_idle P_ ((void));
 static void timer_resume_idle P_ ((void));
@@ -1126,6 +1111,22 @@ struct kboard_stack
 
 static struct kboard_stack *kboard_stack;
 
+void
+push_display_kboard (d)
+     struct display *d;
+{
+#ifdef MULTI_KBOARD
+  struct kboard_stack *p
+    = (struct kboard_stack *) xmalloc (sizeof (struct kboard_stack));
+
+  p->next = kboard_stack;
+  p->kboard = current_kboard;
+  kboard_stack = p;
+
+  current_kboard = d->kboard;
+#endif
+}
+
 void
 push_frame_kboard (f)
      FRAME_PTR f;
@@ -1232,11 +1233,7 @@ cmd_error_internal (data, context)
      yet, or we're not interactive, it's best to dump this message out
      to stderr and exit.  */
   if (!sf->glyphs_initialized_p
-      /* This is the case of the frame dumped with Emacs, when we're
-        running under a window system.  */
-      || (!NILP (Vwindow_system)
-         && !inhibit_window_system
-         && FRAME_TERMCAP_P (sf))
+      || FRAME_INITIAL_P (sf)
       || noninteractive)
     {
       stream = Qexternal_debugging_output;
@@ -1290,10 +1287,10 @@ command_loop ()
     while (1)
       {
        internal_catch (Qtop_level, top_level_1, Qnil);
-       /* Reset single_kboard in case top-level set it while
-          evaluating an -f option, or we are stuck there for some
-          other reason.  */
-       any_kboard_state ();
+        /* Reset single_kboard in case top-level set it while
+           evaluating an -f option, or we are stuck there for some
+           other reason. */
+        any_kboard_state ();
        internal_catch (Qtop_level, command_loop_2, Qnil);
        executing_kbd_macro = Qnil;
 
@@ -1408,12 +1405,12 @@ command_loop_1 ()
   Lisp_Object keybuf[30];
   int i;
   int no_direct;
-  int prev_modiff;
+  int prev_modiff = 0;
   struct buffer *prev_buffer = NULL;
 #ifdef MULTI_KBOARD
   int was_locked = single_kboard;
 #endif
-  int already_adjusted;
+  int already_adjusted = 0;
 
   current_kboard->Vprefix_arg = Qnil;
   current_kboard->Vlast_prefix_arg = Qnil;
@@ -2110,7 +2107,10 @@ void
 start_polling ()
 {
 #ifdef POLL_FOR_INPUT
-  if (read_socket_hook && !interrupt_input)
+  /* XXX This condition was (read_socket_hook && !interrupt_input),
+     but read_socket_hook is not global anymore.  Let's pretend that
+     it's always set. */
+  if (!interrupt_input)
     {
       /* Turn alarm handling on unconditionally.  It might have
         been turned off in process.c.  */
@@ -2144,7 +2144,10 @@ int
 input_polling_used ()
 {
 #ifdef POLL_FOR_INPUT
-  return read_socket_hook && !interrupt_input;
+  /* XXX This condition was (read_socket_hook && !interrupt_input),
+     but read_socket_hook is not global anymore.  Let's pretend that
+     it's always set. */
+  return !interrupt_input;
 #else
   return 0;
 #endif
@@ -2156,7 +2159,10 @@ void
 stop_polling ()
 {
 #ifdef POLL_FOR_INPUT
-  if (read_socket_hook && !interrupt_input)
+  /* XXX This condition was (read_socket_hook && !interrupt_input),
+     but read_socket_hook is not global anymore.  Let's pretend that
+     it's always set. */
+  if (!interrupt_input)
     ++poll_suppress_count;
 #endif
 }
@@ -3692,7 +3698,7 @@ kbd_buffer_store_event_hold (event, hold_quit)
          }
 
          last_event_timestamp = event->timestamp;
-         interrupt_signal (0 /* dummy */);
+         handle_interrupt ();
          return;
        }
 
@@ -4161,7 +4167,11 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
         If there is no valid info, it does not store anything
         so x remains nil.  */
       x = Qnil;
-      (*mouse_position_hook) (&f, 0, &bar_window, &part, &x, &y, &time);
+
+      /* XXX Can f or mouse_position_hook be NULL here? */
+      if (f && FRAME_DISPLAY (f)->mouse_position_hook)
+        (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, 0, &bar_window,
+                                                   &part, &x, &y, &time);
 
       obj = Qnil;
 
@@ -6312,8 +6322,8 @@ modify_event_symbol (symbol_num, modifiers, symbol_kind, name_alist_or_stem,
        {
          int len = SBYTES (name_alist_or_stem);
          char *buf = (char *) alloca (len + 50);
-         sprintf (buf, "%s-%ld", SDATA (name_alist_or_stem),
-                  (long) XINT (symbol_int) + 1);
+          sprintf (buf, "%s-%ld", SDATA (name_alist_or_stem),
+                   (long) XINT (symbol_int) + 1);
          value = intern (buf);
        }
       else if (name_table != 0 && name_table[symbol_num])
@@ -6578,7 +6588,10 @@ gobble_input (expected)
     }
   else
 #ifdef POLL_FOR_INPUT
-  if (read_socket_hook && !interrupt_input && poll_suppress_count == 0)
+  /* XXX This condition was (read_socket_hook && !interrupt_input),
+     but read_socket_hook is not global anymore.  Let's pretend that
+     it's always set. */
+  if (!interrupt_input && poll_suppress_count == 0)
     {
       SIGMASKTYPE mask;
       mask = sigblock (sigmask (SIGALRM));
@@ -6655,146 +6668,214 @@ static int
 read_avail_input (expected)
      int expected;
 {
-  register int i;
   int nread = 0;
+  int err = 0;
+  struct display *d;
 
-  if (read_socket_hook)
+  /* Loop through the available displays, and call their input hooks. */
+  d = display_list;
+  while (d)
     {
-      int nr;
-      struct input_event hold_quit;
+      struct display *next = d->next_display;
 
-      EVENT_INIT (hold_quit);
-      hold_quit.kind = NO_EVENT;
+      if (d->read_socket_hook)
+        {
+          int nr;
+          struct input_event hold_quit;
+
+          EVENT_INIT (hold_quit);
+          hold_quit.kind = NO_EVENT;
+
+          /* No need for FIONREAD or fcntl; just say don't wait.  */
+          while (nr = (*d->read_socket_hook) (d, expected, &hold_quit), nr > 0)
+            {
+              nread += nr;
+              expected = 0;
+            }
+          
+          if (nr == -1)          /* Not OK to read input now. */
+            {
+              err = 1;
+            }
+          else if (nr == -2)          /* Non-transient error. */
+            {
+              /* The display device terminated; it should be closed. */
+              
+              /* Kill Emacs if this was our last display. */
+              if (! display_list->next_display)
+                /* Formerly simply reported no input, but that
+                   sometimes led to a failure of Emacs to terminate.
+                   SIGHUP seems appropriate if we can't reach the
+                   terminal.  */
+                /* ??? Is it really right to send the signal just to
+                   this process rather than to the whole process
+                   group?  Perhaps on systems with FIONREAD Emacs is
+                   alone in its group.  */
+                kill (getpid (), SIGHUP);
+              
+              /* XXX Is calling delete_display safe here?  It calls Fdelete_frame. */
+              if (d->delete_display_hook)
+                (*d->delete_display_hook) (d);
+              else
+                delete_display (d);
+            }
+
+          if (hold_quit.kind != NO_EVENT)
+            kbd_buffer_store_event (&hold_quit);
+        }
 
-      /* No need for FIONREAD or fcntl; just say don't wait.  */
-      while (nr = (*read_socket_hook) (input_fd, expected, &hold_quit), nr > 0)
-       {
-         nread += nr;
-         expected = 0;
-       }
-      if (hold_quit.kind != NO_EVENT)
-       kbd_buffer_store_event (&hold_quit);
+      d = next;
     }
-  else
-    {
-      /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than
-        the kbd_buffer can really hold.  That may prevent loss
-        of characters on some systems when input is stuffed at us.  */
-      unsigned char cbuf[KBD_BUFFER_SIZE - 1];
-      int n_to_read;
 
-      /* Determine how many characters we should *try* to read.  */
+  if (err && !nread)
+    nread = -1;
+
+  return nread;
+}
+
+/* This is the tty way of reading available input.
+
+   Note that each terminal device has its own `struct display' object,
+   and so this function is called once for each individual termcap
+   display.  The first parameter indicates which device to read from.  */
+
+int
+tty_read_avail_input (struct display *display,
+                      int expected,
+                      struct input_event *hold_quit)
+{
+  /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than
+     the kbd_buffer can really hold.  That may prevent loss
+     of characters on some systems when input is stuffed at us.  */
+  unsigned char cbuf[KBD_BUFFER_SIZE - 1];
+  int n_to_read, i;
+  struct tty_display_info *tty = display->display_info.tty;
+  int nread = 0;
+
+  if (display->type != output_termcap)
+    abort ();
+
+  /* XXX I think the following code should be moved to separate hook
+     functions in system-dependent files. */
 #ifdef WINDOWSNT
-      return 0;
+  return 0;
 #else /* not WINDOWSNT */
 #ifdef MSDOS
-      n_to_read = dos_keysns ();
-      if (n_to_read == 0)
-       return 0;
+  n_to_read = dos_keysns ();
+  if (n_to_read == 0)
+    return 0;
+
+  cbuf[0] = dos_keyread ();
+  nread = 1;
+
 #else /* not MSDOS */
+
+  if (! tty->term_initted)      /* In case we get called during bootstrap. */
+    return 0;
+
+  if (! tty->input)
+    return 0;                   /* The terminal is suspended. */
+
+  /* Determine how many characters we should *try* to read.  */
 #ifdef FIONREAD
-      /* Find out how much input is available.  */
-      if (ioctl (input_fd, FIONREAD, &n_to_read) < 0)
-       /* Formerly simply reported no input, but that sometimes led to
-          a failure of Emacs to terminate.
-          SIGHUP seems appropriate if we can't reach the terminal.  */
-       /* ??? Is it really right to send the signal just to this process
-          rather than to the whole process group?
-          Perhaps on systems with FIONREAD Emacs is alone in its group.  */
-       {
-         if (! noninteractive)
-           kill (getpid (), SIGHUP);
-         else
-           n_to_read = 0;
-       }
-      if (n_to_read == 0)
-       return 0;
-      if (n_to_read > sizeof cbuf)
-       n_to_read = sizeof cbuf;
+  /* Find out how much input is available.  */
+  if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0)
+    {
+      if (! noninteractive)
+        return -2;          /* Close this display. */
+      else
+        n_to_read = 0;
+    }
+  if (n_to_read == 0)
+    return 0;
+  if (n_to_read > sizeof cbuf)
+    n_to_read = sizeof cbuf;
 #else /* no FIONREAD */
 #if defined (USG) || defined (DGUX) || defined(CYGWIN)
-      /* Read some input if available, but don't wait.  */
-      n_to_read = sizeof cbuf;
-      fcntl (input_fd, F_SETFL, O_NDELAY);
+  /* Read some input if available, but don't wait.  */
+  n_to_read = sizeof cbuf;
+  fcntl (fileno (tty->input), F_SETFL, O_NDELAY);
 #else
-      you lose;
+  you lose;
 #endif
 #endif
-#endif /* not MSDOS */
-#endif /* not WINDOWSNT */
 
-      /* Now read; for one reason or another, this will not block.
-        NREAD is set to the number of chars read.  */
-      do
-       {
-#ifdef MSDOS
-         cbuf[0] = dos_keyread ();
-         nread = 1;
-#else
-         nread = emacs_read (input_fd, cbuf, n_to_read);
-#endif
-         /* POSIX infers that processes which are not in the session leader's
-            process group won't get SIGHUP's at logout time.  BSDI adheres to
-            this part standard and returns -1 from read (0) with errno==EIO
-            when the control tty is taken away.
-            Jeffrey Honig <jch@bsdi.com> says this is generally safe.  */
-         if (nread == -1 && errno == EIO)
-           kill (0, SIGHUP);
+  /* Now read; for one reason or another, this will not block.
+     NREAD is set to the number of chars read.  */
+  do
+    {
+      nread = emacs_read (fileno (tty->input), cbuf, n_to_read);
+      /* POSIX infers that processes which are not in the session leader's
+         process group won't get SIGHUP's at logout time.  BSDI adheres to
+         this part standard and returns -1 from read (0) with errno==EIO
+         when the control tty is taken away.
+         Jeffrey Honig <jch@bsdi.com> says this is generally safe. */
+      if (nread == -1 && errno == EIO)
+        return -2;          /* Close this display. */
 #if defined (AIX) && (! defined (aix386) && defined (_BSD))
-         /* The kernel sometimes fails to deliver SIGHUP for ptys.
-            This looks incorrect, but it isn't, because _BSD causes
-            O_NDELAY to be defined in fcntl.h as O_NONBLOCK,
-            and that causes a value other than 0 when there is no input.  */
-         if (nread == 0)
-           kill (0, SIGHUP);
-#endif
-       }
-      while (
-            /* We used to retry the read if it was interrupted.
-               But this does the wrong thing when O_NDELAY causes
-               an EAGAIN error.  Does anybody know of a situation
-               where a retry is actually needed?  */
+      /* The kernel sometimes fails to deliver SIGHUP for ptys.
+         This looks incorrect, but it isn't, because _BSD causes
+         O_NDELAY to be defined in fcntl.h as O_NONBLOCK,
+         and that causes a value other than 0 when there is no input.  */
+      if (nread == 0)
+        return -2;          /* Close this display. */
+#endif
+    }
+  while (
+         /* We used to retry the read if it was interrupted.
+            But this does the wrong thing when O_NDELAY causes
+            an EAGAIN error.  Does anybody know of a situation
+            where a retry is actually needed?  */
 #if 0
-            nread < 0 && (errno == EAGAIN
+         nread < 0 && (errno == EAGAIN
 #ifdef EFAULT
-                          || errno == EFAULT
+                       || errno == EFAULT
 #endif
 #ifdef EBADSLT
-                          || errno == EBADSLT
+                       || errno == EBADSLT
 #endif
-                          )
+                       )
 #else
-            0
+         0
 #endif
-            );
+         );
 
 #ifndef FIONREAD
 #if defined (USG) || defined (DGUX) || defined (CYGWIN)
-      fcntl (input_fd, F_SETFL, 0);
+  fcntl (fileno (tty->input), F_SETFL, 0);
 #endif /* USG or DGUX or CYGWIN */
 #endif /* no FIONREAD */
-      for (i = 0; i < nread; i++)
-       {
-         struct input_event buf;
-         EVENT_INIT (buf);
-         buf.kind = ASCII_KEYSTROKE_EVENT;
-         buf.modifiers = 0;
-         if (meta_key == 1 && (cbuf[i] & 0x80))
-           buf.modifiers = meta_modifier;
-         if (meta_key != 2)
-           cbuf[i] &= ~0x80;
-
-         buf.code = cbuf[i];
-         buf.frame_or_window = selected_frame;
-         buf.arg = Qnil;
-
-         kbd_buffer_store_event (&buf);
-         /* Don't look at input that follows a C-g too closely.
-            This reduces lossage due to autorepeat on C-g.  */
-         if (buf.kind == ASCII_KEYSTROKE_EVENT
-             && buf.code == quit_char)
-           break;
-       }
+
+  if (nread <= 0)
+    return nread;
+
+#endif /* not MSDOS */
+#endif /* not WINDOWSNT */
+
+  for (i = 0; i < nread; i++)
+    {
+      struct input_event buf;
+      EVENT_INIT (buf);
+      buf.kind = ASCII_KEYSTROKE_EVENT;
+      buf.modifiers = 0;
+      if (tty->meta_key == 1 && (cbuf[i] & 0x80))
+        buf.modifiers = meta_modifier;
+      if (tty->meta_key != 2)
+        cbuf[i] &= ~0x80;
+      
+      buf.code = cbuf[i];
+      /* Set the frame corresponding to the active tty.  Note that the
+         value of selected_frame is not reliable here, redisplay tends
+         to temporarily change it. */
+      buf.frame_or_window = tty->top_frame;
+      buf.arg = Qnil;
+      
+      kbd_buffer_store_event (&buf);
+      /* Don't look at input that follows a C-g too closely.
+         This reduces lossage due to autorepeat on C-g.  */
+      if (buf.kind == ASCII_KEYSTROKE_EVENT
+          && buf.code == quit_char)
+        break;
     }
 
   return nread;
@@ -8585,8 +8666,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
   last_nonmenu_event = Qnil;
 
   delayed_switch_frame = Qnil;
-  fkey.map = fkey.parent = Vfunction_key_map;
-  keytran.map = keytran.parent = Vkey_translation_map;
+  fkey.map = fkey.parent = current_kboard->Vfunction_key_map;
+  keytran.map = keytran.parent = current_kboard->Vkey_translation_map;
   /* If there is no translation-map, turn off scanning.  */
   fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1;
   keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1;
@@ -9919,8 +10000,12 @@ detect_input_pending_run_timers (do_display)
         from an idle timer function.  The symptom of the bug is that
         the cursor sometimes doesn't become visible until the next X
         event is processed.  --gerd.  */
-      if (rif)
-       rif->flush_display (NULL);
+      {
+        Lisp_Object tail, frame;
+        FOR_EACH_FRAME (tail, frame)
+          if (FRAME_RIF (XFRAME (frame)))
+            FRAME_RIF (XFRAME (frame))->flush_display (XFRAME (frame));
+      }
     }
 
   return input_pending;
@@ -10164,6 +10249,9 @@ On such systems, Emacs starts a subshell instead of suspending.  */)
   int width, height;
   struct gcpro gcpro1;
 
+  if (tty_list && tty_list->next)
+    error ("There are other tty frames open; close them before suspending Emacs");
+
   if (!NILP (stuffstring))
     CHECK_STRING (stuffstring);
 
@@ -10172,11 +10260,11 @@ On such systems, Emacs starts a subshell instead of suspending.  */)
     call1 (Vrun_hooks, intern ("suspend-hook"));
 
   GCPRO1 (stuffstring);
-  get_frame_size (&old_width, &old_height);
-  reset_sys_modes ();
+  get_tty_size (fileno (CURTTY ()->input), &old_width, &old_height);
+  reset_all_sys_modes ();
   /* sys_suspend can get an error if it tries to fork a subshell
      and the system resources aren't available for that.  */
-  record_unwind_protect ((Lisp_Object (*) P_ ((Lisp_Object))) init_sys_modes,
+  record_unwind_protect ((Lisp_Object (*) P_ ((Lisp_Object))) init_all_sys_modes,
                         Qnil);
   stuff_buffered_input (stuffstring);
   if (cannot_suspend)
@@ -10188,7 +10276,7 @@ On such systems, Emacs starts a subshell instead of suspending.  */)
   /* Check if terminal/window size has changed.
      Note that this is not useful when we are running directly
      with a window system; but suspend should be disabled in that case.  */
-  get_frame_size (&width, &height);
+  get_tty_size (fileno (CURTTY ()->input), &width, &height);
   if (width != old_width || height != old_height)
     change_frame_size (SELECTED_FRAME (), height, width, 0, 0, 0);
 
@@ -10248,10 +10336,10 @@ set_waiting_for_input (time_to_clear)
 {
   input_available_clear_time = time_to_clear;
 
-  /* Tell interrupt_signal to throw back to read_char,  */
+  /* Tell handle_interrupt to throw back to read_char,  */
   waiting_for_input = 1;
 
-  /* If interrupt_signal was called before and buffered a C-g,
+  /* If handle_interrupt was called before and buffered a C-g,
      make it run again now, to avoid timing error. */
   if (!NILP (Vquit_flag))
     quit_throw_to_read_char ();
@@ -10260,48 +10348,82 @@ set_waiting_for_input (time_to_clear)
 void
 clear_waiting_for_input ()
 {
-  /* Tell interrupt_signal not to throw back to read_char,  */
+  /* Tell handle_interrupt not to throw back to read_char,  */
   waiting_for_input = 0;
   input_available_clear_time = 0;
 }
 
-/* This routine is called at interrupt level in response to C-g.
+/* The SIGINT handler.
 
-   If interrupt_input, this is the handler for SIGINT.  Otherwise, it
-   is called from kbd_buffer_store_event, in handling SIGIO or
-   SIGTINT.
-
-   If `waiting_for_input' is non zero, then unless `echoing' is
-   nonzero, immediately throw back to read_char.
-
-   Otherwise it sets the Lisp variable quit-flag not-nil.  This causes
-   eval to throw, when it gets a chance.  If quit-flag is already
-   non-nil, it stops the job right away.  */
+   If we have a frame on the controlling tty, we assume that the
+   SIGINT was generated by C-g, so we call handle_interrupt.
+   Otherwise, the handler kills Emacs.  */
 
 static SIGTYPE
 interrupt_signal (signalnum)   /* If we don't have an argument, */
      int signalnum;            /* some compilers complain in signal calls. */
 {
-  char c;
   /* Must preserve main program's value of errno.  */
   int old_errno = errno;
-  struct frame *sf = SELECTED_FRAME ();
+  struct display *display;
 
 #if defined (USG) && !defined (POSIX_SIGNALS)
-  if (!read_socket_hook && NILP (Vwindow_system))
-    {
-      /* USG systems forget handlers when they are used;
-        must reestablish each time */
-      signal (SIGINT, interrupt_signal);
-      signal (SIGQUIT, interrupt_signal);
-    }
+  /* USG systems forget handlers when they are used;
+     must reestablish each time */
+  signal (SIGINT, interrupt_signal);
+  signal (SIGQUIT, interrupt_signal);
 #endif /* USG */
 
   SIGNAL_THREAD_CHECK (signalnum);
+
+  /* See if we have an active display on our controlling terminal. */
+  display = get_named_tty_display (NULL);
+  if (!display)
+    {
+      /* If there are no frames there, let's pretend that we are a
+         well-behaving UN*X program and quit. */
+      fatal_error_signal (SIGTERM);
+    }
+  else
+    {
+      /* Otherwise, the SIGINT was probably generated by C-g.  */
+
+      /* Set internal_last_event_frame to the top frame of the
+         controlling tty, if we have a frame there.  We disable the
+         interrupt key on secondary ttys, so the SIGINT must have come
+         from the controlling tty.  */
+      internal_last_event_frame = display->display_info.tty->top_frame;
+
+      handle_interrupt ();
+    }
+
+  errno = old_errno;
+}
+
+/* This routine is called at interrupt level in response to C-g.
+
+   It is called from the SIGINT handler or kbd_buffer_store_event.
+
+   If `waiting_for_input' is non zero, then unless `echoing' is
+   nonzero, immediately throw back to read_char.
+
+   Otherwise it sets the Lisp variable quit-flag not-nil.  This causes
+   eval to throw, when it gets a chance.  If quit-flag is already
+   non-nil, it stops the job right away. */
+
+static void
+handle_interrupt ()
+{
+  char c;
+
   cancel_echoing ();
 
+  /* XXX This code needs to be revised for multi-tty support. */
   if (!NILP (Vquit_flag)
-      && (FRAME_TERMCAP_P (sf) || FRAME_MSDOS_P (sf)))
+#ifndef MSDOS
+      && get_named_tty_display (NULL)
+#endif
+      )
     {
       /* If SIGINT isn't blocked, don't let us be interrupted by
         another SIGINT, it might be harmful due to non-reentrancy
@@ -10309,7 +10431,7 @@ interrupt_signal (signalnum)    /* If we don't have an argument, */
       sigblock (sigmask (SIGINT));
 
       fflush (stdout);
-      reset_sys_modes ();
+      reset_all_sys_modes ();
 
 #ifdef SIGTSTP                 /* Support possible in later USG versions */
 /*
@@ -10388,7 +10510,7 @@ interrupt_signal (signalnum)    /* If we don't have an argument, */
       printf ("Continuing...\n");
 #endif /* not MSDOS */
       fflush (stdout);
-      init_sys_modes ();
+      init_all_sys_modes ();
       sigfree ();
     }
   else
@@ -10416,9 +10538,7 @@ interrupt_signal (signalnum)    /* If we don't have an argument, */
     }
 
   if (waiting_for_input && !echoing)
-    quit_throw_to_read_char ();
-
-  errno = old_errno;
+      quit_throw_to_read_char ();
 }
 
 /* Handle a C-g by making read_char return C-g.  */
@@ -10465,6 +10585,11 @@ See also `current-input-mode'.  */)
      (interrupt, flow, meta, quit)
      Lisp_Object interrupt, flow, meta, quit;
 {
+  /* XXX This function needs to be revised for multi-device support.
+     Currently it compiles fine, but its semantics are wrong.  It sets
+     global parameters (e.g. interrupt_input) based on only the
+     current frame's device. */
+
   if (!NILP (quit)
       && (!INTEGERP (quit) || XINT (quit) < 0 || XINT (quit) > 0400))
     error ("set-input-mode: QUIT must be an ASCII character");
@@ -10474,13 +10599,14 @@ See also `current-input-mode'.  */)
 #endif
 
 #ifndef DOS_NT
-  /* this causes startup screen to be restored and messes with the mouse */
-  reset_sys_modes ();
+  if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
+    /* this causes startup screen to be restored and messes with the mouse */
+    reset_sys_modes (CURTTY ());
 #endif
 
 #ifdef SIGIO
 /* Note SIGIO has been undef'd if FIONREAD is missing.  */
-  if (read_socket_hook)
+  if (FRAME_DISPLAY (SELECTED_FRAME ())->read_socket_hook)
     {
       /* When using X, don't give the user a real choice,
         because we haven't implemented the mechanisms to support it.  */
@@ -10501,19 +10627,25 @@ See also `current-input-mode'.  */)
   interrupt_input = 1;
 #endif
 
-  flow_control = !NILP (flow);
-  if (NILP (meta))
-    meta_key = 0;
-  else if (EQ (meta, Qt))
-    meta_key = 1;
-  else
-    meta_key = 2;
+  if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
+    {
+      struct tty_display_info *tty = CURTTY ();
+      tty->flow_control = !NILP (flow);
+      if (NILP (meta))
+        tty->meta_key = 0;
+      else if (EQ (meta, Qt))
+        tty->meta_key = 1;
+      else
+        tty->meta_key = 2;
+    }
+
   if (!NILP (quit))
     /* Don't let this value be out of range.  */
-    quit_char = XINT (quit) & (meta_key ? 0377 : 0177);
+    quit_char = XINT (quit) & (NILP (meta) ? 0177 : 0377);
 
 #ifndef DOS_NT
-  init_sys_modes ();
+  if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
+    init_sys_modes (CURTTY ());
 #endif
 
 #ifdef POLL_FOR_INPUT
@@ -10540,10 +10672,21 @@ The elements of this list correspond to the arguments of
      ()
 {
   Lisp_Object val[4];
+  struct frame *sf = XFRAME (selected_frame);
 
   val[0] = interrupt_input ? Qt : Qnil;
-  val[1] = flow_control ? Qt : Qnil;
-  val[2] = meta_key == 2 ? make_number (0) : meta_key == 1 ? Qt : Qnil;
+  if (FRAME_TERMCAP_P (sf))
+    {
+      val[1] = FRAME_TTY (sf)->flow_control ? Qt : Qnil;
+      val[2] = (FRAME_TTY (sf)->meta_key == 2
+                ? make_number (0)
+                : (CURTTY ()->meta_key == 1 ? Qt : Qnil));
+    }
+  else
+    {
+      val[1] = Qnil;
+      val[2] = Qt;
+    }
   XSETFASTINT (val[3], quit_char);
 
   return Flist (sizeof (val) / sizeof (val[0]), val);
@@ -10637,6 +10780,9 @@ init_kboard (kb)
   kb->reference_count = 0;
   kb->Vsystem_key_alist = Qnil;
   kb->system_key_syms = Qnil;
+  kb->Vfunction_key_map = Fmake_sparse_keymap (Qnil);
+  kb->Vkey_translation_map = Fmake_sparse_keymap (Qnil);
+  Fset_keymap_parent (kb->Vkey_translation_map, Vglobal_key_translation_map);
   kb->Vdefault_minibuffer_frame = Qnil;
 }
 
@@ -10673,7 +10819,7 @@ delete_kboard (kb)
       && FRAMEP (selected_frame)
       && FRAME_LIVE_P (XFRAME (selected_frame)))
     {
-      current_kboard = XFRAME (selected_frame)->kboard;
+      current_kboard = XFRAME (selected_frame)->display->kboard;
       if (current_kboard == kb)
        abort ();
     }
@@ -10714,8 +10860,14 @@ init_keyboard ()
   wipe_kboard (current_kboard);
   init_kboard (current_kboard);
 
-  if (!noninteractive && !read_socket_hook && NILP (Vwindow_system))
+  if (!noninteractive)
     {
+      /* Before multi-tty support, these handlers used to be installed
+         only if the current session was a tty session.  Now an Emacs
+         session may have multiple display types, so we always handle
+         SIGINT.  There is special code in interrupt_signal to exit
+         Emacs on SIGINT when there are no termcap frames on the
+         controlling terminal. */
       signal (SIGINT, interrupt_signal);
 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
       /* For systems with SysV TERMIO, C-g is set up for both SIGINT and
@@ -11095,7 +11247,10 @@ In other words, the present command is the event that made the previous
 command exit.
 
 The value `kill-region' is special; it means that the previous command
-was a kill command.  */);
+was a kill command.
+
+`last-command' has a separate binding for each display device.
+See Info node `(elisp)Multiple displays'.  */);
 
   DEFVAR_KBOARD ("real-last-command", Vreal_last_command,
                 doc: /* Same as `last-command', but never altered by Lisp code.  */);
@@ -11303,7 +11458,10 @@ buffer's local map, and the minor mode keymaps and text property keymaps.
 It also replaces `overriding-local-map'.
 
 This variable is intended to let commands such as `universal-argument'
-set up a different keymap for reading the next command.  */);
+set up a different keymap for reading the next command.
+
+`overriding-terminal-local-map' has a separate binding for each display device.
+See Info node `(elisp)Multiple displays'.  */);
 
   DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map,
               doc: /* Keymap that overrides all other local keymaps.
@@ -11328,7 +11486,63 @@ and the minor mode maps regardless of `overriding-local-map'.  */);
                 doc: /* Alist of system-specific X windows key symbols.
 Each element should have the form (N . SYMBOL) where N is the
 numeric keysym code (sans the \"system-specific\" bit 1<<28)
-and SYMBOL is its name.  */);
+and SYMBOL is its name.
+
+`system-key-alist' has a separate binding for each display device.
+See Info node `(elisp)Multiple displays'.
+
+Note that the currently selected frame has very little to do with
+which binding of this variable is active at any given moment.  If you
+need set or get the binding on a specific display, use
+`terminal-local-value' and `set-terminal-local-value'.  */);
+
+  DEFVAR_KBOARD ("function-key-map", Vfunction_key_map,
+                 doc: /* Keymap mapping ASCII function key sequences onto their preferred forms.
+This allows Emacs to recognize function keys sent from ASCII
+terminals at any point in a key sequence.
+
+The `read-key-sequence' function replaces any subsequence bound by
+`function-key-map' with its binding.  More precisely, when the active
+keymaps have no binding for the current key sequence but
+`function-key-map' binds a suffix of the sequence to a vector or string,
+`read-key-sequence' replaces the matching suffix with its binding, and
+continues with the new sequence.
+
+The events that come from bindings in `function-key-map' are not
+themselves looked up in `function-key-map'.
+
+For example, suppose `function-key-map' binds `ESC O P' to [f1].
+Typing `ESC O P' to `read-key-sequence' would return [f1].  Typing
+`C-x ESC O P' would return [?\\C-x f1].  If [f1] were a prefix
+key, typing `ESC O P x' would return [f1 x].
+
+`function-key-map' has a separate binding for each display device.
+See Info node `(elisp)Multiple displays'.
+
+Note that the currently selected frame has very little to do with
+which binding of this variable is active at any given moment.  If you
+need set or get the binding on a specific display, use
+`terminal-local-value' and `set-terminal-local-value'.  */);
+
+  DEFVAR_KBOARD ("key-translation-map", Vkey_translation_map,
+              doc: /* Keymap of key translations that can override keymaps.
+This keymap works like `function-key-map', but comes after that,
+and its non-prefix bindings override ordinary bindings.
+
+`key-translation-map' has a separate binding for each display device.
+(See Info node `(elisp)Multiple displays'.)  If you need to set a key
+translation on all devices, change `global-key-translation-map' instead.
+
+Note that the currently selected frame has very little to do with
+which binding of this variable is active at any given moment.  If you
+need set or get the binding on a specific display, use
+`terminal-local-value' and `set-terminal-local-value'.  */);
+
+  DEFVAR_LISP ("global-key-translation-map", &Vglobal_key_translation_map,
+               doc: /* The parent keymap of all terminal-local `key-translation-map' instances.
+Key translations that are not specific to a display device flavour
+should go here.  */);
+  Vglobal_key_translation_map = Fmake_sparse_keymap (Qnil);
 
   DEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list,
               doc: /* List of deferred actions to be performed at a later time.
@@ -11493,6 +11707,8 @@ mark_kboards ()
       mark_object (kb->Vlast_kbd_macro);
       mark_object (kb->Vsystem_key_alist);
       mark_object (kb->system_key_syms);
+      mark_object (kb->Vfunction_key_map);
+      mark_object (kb->Vkey_translation_map);
       mark_object (kb->Vdefault_minibuffer_frame);
       mark_object (kb->echo_string);
     }
index f5be3f28cf4bc5fce9cee211cbecc2e45852047c..b95482762e79badd270c402e111cf72943ecbd36 100644 (file)
@@ -21,7 +21,7 @@ Boston, MA 02110-1301, USA.  */
 /* Length of echobuf field in each KBOARD.  */
 
 /* Each KBOARD represents one logical input stream from which Emacs gets input.
-   If we are using an ordinary terminal, it has one KBOARD object.
+   If we are using ordinary terminals, it has one KBOARD object for each terminal device.
    Usually each X display screen has its own KBOARD,
    but when two of them are on the same X server,
    we assume they share a keyboard and give them one KBOARD in common.
@@ -120,6 +120,14 @@ struct kboard
     /* Cache for modify_event_symbol.  */
     Lisp_Object system_key_syms;
 
+    /* Keymap mapping ASCII function key sequences onto their
+       preferred forms.  Initialized by the terminal-specific lisp
+       files.  See the DEFVAR for more documentation.  */
+    Lisp_Object Vfunction_key_map;
+    
+    /* Keymap of key translations that can override keymaps.  */
+    Lisp_Object Vkey_translation_map;
+
     /* Minibufferless frames on this display use this frame's minibuffer.  */
     Lisp_Object Vdefault_minibuffer_frame;
 
@@ -152,7 +160,7 @@ struct kboard
   };
 
 #ifdef MULTI_KBOARD
-/* Temporarily used before a frame has been opened, and for termcap frames */
+/* Temporarily used before a frame has been opened. */
 extern KBOARD *initial_kboard;
 
 /* In the single-kboard state, this is the kboard
@@ -187,10 +195,6 @@ extern EMACS_INT num_nonmacro_input_events;
 /* Nonzero means polling for input is temporarily suppressed.  */
 extern int poll_suppress_count;
 
-/* Keymap mapping ASCII function key sequences onto their preferred forms.
-   Initialized by the terminal-specific lisp files.  */
-extern Lisp_Object Vfunction_key_map;
-
 /* Vector holding the key sequence that invoked the current command.
    It is reused for each command, and it may be longer than the current
    sequence; this_command_key_count indicates how many elements
@@ -300,6 +304,9 @@ extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
 /* User-supplied string to translate input characters through.  */
 extern Lisp_Object Vkeyboard_translate_table;
 
+/* Parent keymap of terminal-local key-translation-map instances.  */
+extern Lisp_Object Vglobal_key_translation_map;
+
 
 extern int parse_menu_item P_ ((Lisp_Object, int, int));
 
@@ -308,6 +315,7 @@ extern void init_kboard P_ ((KBOARD *));
 extern void delete_kboard P_ ((KBOARD *));
 extern void single_kboard_state P_ ((void));
 extern void not_single_kboard_state P_ ((KBOARD *));
+extern void push_display_kboard P_ ((struct display *));
 extern void push_frame_kboard P_ ((struct frame *));
 extern void pop_frame_kboard P_ ((void));
 extern void record_asynch_buffer_change P_ ((void));
@@ -342,5 +350,8 @@ extern void kbd_buffer_store_help_event P_ ((Lisp_Object, Lisp_Object));
 extern Lisp_Object menu_item_eval_property P_ ((Lisp_Object));
 extern int  kbd_buffer_events_waiting P_ ((int));
 
+extern int tty_read_avail_input P_ ((struct display *, int,
+                                     struct input_event *));
+
 /* arch-tag: 769cbade-1ba9-4950-b886-db265b061aa3
    (do not change this comment) */
index 9dee14eff4226e3af99a79a960684e48e3803c8f..b9247122ccdd02ce27af5dce0e655fcd320d5178 100644 (file)
@@ -27,6 +27,7 @@ Boston, MA 02110-1301, USA.  */
 #include "buffer.h"
 #include "charset.h"
 #include "keyboard.h"
+#include "frame.h"
 #include "termhooks.h"
 #include "blockinput.h"
 #include "puresize.h"
@@ -78,14 +79,6 @@ Lisp_Object Vminor_mode_overriding_map_alist;
 /* List of emulation mode keymap alists.  */
 Lisp_Object Vemulation_mode_map_alists;
 
-/* Keymap mapping ASCII function key sequences onto their preferred forms.
-   Initialized by the terminal-specific lisp files.  See DEFVAR for more
-   documentation.  */
-Lisp_Object Vfunction_key_map;
-
-/* Keymap mapping ASCII function key sequences onto their preferred forms.  */
-Lisp_Object Vkey_translation_map;
-
 /* A list of all commands given new bindings since a certain time
    when nil was stored here.
    This is used to speed up recomputation of menu key equivalents
@@ -2848,8 +2841,8 @@ You type        Translation\n\
       insert ("\n", 1);
     }
 
-  if (!NILP (Vkey_translation_map))
-    describe_map_tree (Vkey_translation_map, 0, Qnil, prefix,
+  if (!NILP (current_kboard->Vkey_translation_map))
+    describe_map_tree (current_kboard->Vkey_translation_map, 0, Qnil, prefix,
                       "Key translations", nomenu, 1, 0, 0);
 
 
@@ -2938,8 +2931,8 @@ You type        Translation\n\
                     "\f\nGlobal Bindings", nomenu, 0, 1, 0);
 
   /* Print the function-key-map translations under this prefix.  */
-  if (!NILP (Vfunction_key_map))
-    describe_map_tree (Vfunction_key_map, 0, Qnil, prefix,
+  if (!NILP (current_kboard->Vfunction_key_map))
+    describe_map_tree (current_kboard->Vfunction_key_map, 0, Qnil, prefix,
                       "\f\nFunction key map translations", nomenu, 1, 0, 0);
 
   UNGCPRO;
@@ -3801,34 +3794,6 @@ the same way.  The "active" keymaps in each alist are used before
 `minor-mode-map-alist' and `minor-mode-overriding-map-alist'.  */);
   Vemulation_mode_map_alists = Qnil;
 
-
-  DEFVAR_LISP ("function-key-map", &Vfunction_key_map,
-              doc: /* Keymap mapping ASCII function key sequences onto their preferred forms.
-This allows Emacs to recognize function keys sent from ASCII
-terminals at any point in a key sequence.
-
-The `read-key-sequence' function replaces any subsequence bound by
-`function-key-map' with its binding.  More precisely, when the active
-keymaps have no binding for the current key sequence but
-`function-key-map' binds a suffix of the sequence to a vector or string,
-`read-key-sequence' replaces the matching suffix with its binding, and
-continues with the new sequence.
-
-The events that come from bindings in `function-key-map' are not
-themselves looked up in `function-key-map'.
-
-For example, suppose `function-key-map' binds `ESC O P' to [f1].
-Typing `ESC O P' to `read-key-sequence' would return [f1].  Typing
-`C-x ESC O P' would return [?\\C-x f1].  If [f1] were a prefix
-key, typing `ESC O P x' would return [f1 x].  */);
-  Vfunction_key_map = Fmake_sparse_keymap (Qnil);
-
-  DEFVAR_LISP ("key-translation-map", &Vkey_translation_map,
-              doc: /* Keymap of key translations that can override keymaps.
-This keymap works like `function-key-map', but comes after that,
-and its non-prefix bindings override ordinary bindings.  */);
-  Vkey_translation_map = Qnil;
-
   staticpro (&Vmouse_events);
   Vmouse_events = Fcons (intern ("menu-bar"),
                  Fcons (intern ("tool-bar"),
index 871667cf0ab160d0cc5e82bb01d3994dc9ff674d..b51d535f025a8add3e5996d17f508c97b9a82b17 100644 (file)
@@ -84,14 +84,14 @@ extern void die P_((const char *, const char *, int));
 
 #ifdef ENABLE_CHECKING
 
-#define CHECK(check,msg) (((check) || suppress_checking                \
-                          ? (void) 0                           \
-                          : die ((msg), __FILE__, __LINE__)),  \
+#define CHECK(check,msg) ((void)((check) || suppress_checking           \
+                                 ? (void) 0                             \
+                                 : die ((msg), __FILE__, __LINE__)),   \
                          0)
 #else
 
 /* Produce same side effects and result, but don't complain.  */
-#define CHECK(check,msg) ((check),0)
+#define CHECK(check,msg) ((void)(check),0)
 
 #endif
 
@@ -3104,26 +3104,28 @@ EXFUN (Fx_popup_menu, 2);
 EXFUN (Fx_popup_dialog, 3);
 extern void syms_of_xmenu P_ ((void));
 
+/* defined in termchar.h */
+struct tty_display_info;
+
+/* defined in termhooks.h */
+struct display;
+
 /* defined in sysdep.c */
 extern void stuff_char P_ ((char c));
 extern void init_sigio P_ ((int));
-extern void request_sigio P_ ((void));
-extern void unrequest_sigio P_ ((void));
-extern void reset_sys_modes P_ ((void));
 extern void sys_subshell P_ ((void));
 extern void sys_suspend P_ ((void));
 extern void discard_tty_input P_ ((void));
-extern void init_sys_modes P_ ((void));
-extern void reset_sys_modes P_ ((void));
-extern void get_frame_size P_ ((int *, int *));
+extern void init_sys_modes P_ ((struct tty_display_info *));
+extern void reset_sys_modes P_ ((struct tty_display_info *));
+extern void init_all_sys_modes P_ ((void));
+extern void reset_all_sys_modes P_ ((void));
 extern void wait_for_termination P_ ((int));
 extern void flush_pending_output P_ ((int));
 extern void child_setup_tty P_ ((int));
 extern void setup_pty P_ ((int));
 extern int set_window_size P_ ((int, int, int));
 extern void create_process P_ ((Lisp_Object, char **, Lisp_Object));
-extern int tabs_safe_p P_ ((void));
-extern void init_baud_rate P_ ((void));
 extern int emacs_open P_ ((const char *, int, int));
 extern int emacs_close P_ ((int));
 extern int emacs_read P_ ((int, char *, unsigned int));
index 03bea849b823e75842a477dcae4ea9000f86fa76..f159e98d4e9529301626ab85b5c745c2baaf670b 100644 (file)
@@ -33,6 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include <epaths.h>
 #include "commands.h"
 #include "keyboard.h"
+#include "frame.h"
 #include "termhooks.h"
 #include "coding.h"
 
index 3b3924fe833cadfb0599ef4f6ad16915220060f4..ab43a7bda43ce633cd6a6ccddf13bbb2816cdd89 100644 (file)
@@ -10150,12 +10150,13 @@ mac_initialize ()
   redeem_scroll_bar_hook = XTredeem_scroll_bar;
   judge_scroll_bars_hook = XTjudge_scroll_bars;
 
-  scroll_region_ok = 1;         /* we'll scroll partial frames */
-  char_ins_del_ok = 1;
-  line_ins_del_ok = 1;          /* we'll just blt 'em */
-  fast_clear_end_of_line = 1;   /* X does this well */
-  memory_below_frame = 0;       /* we don't remember what scrolls
-                                  off the bottom */
+  TTY_SCROLL_REGION_OK (CURTTY ()) = 1; /* we'll scroll partial frames */
+  TTY_CHAR_INS_DEL_OK (CURTTY ()) = 1;
+  TTY_LINE_INS_DEL_OK (CURTTY ()) = 1; /* we'll just blt 'em */
+  TTY_FAST_CLEAR_END_OF_LINE (CURTTY ()) = 1; /* X does this well */
+  TTY_MEMORY_BELOW_FRAME (CURTTY ()) = 0; /* we don't remember what
+                                                         scrolls off the
+                                                         bottom */
   baud_rate = 19200;
 
   x_noop_count = 0;
index f0846b10fa4747235e5d3c861cb83e3b3edbd8e8..ea5f7db60844335ebe1805c2840ea3b663a8e29d 100644 (file)
@@ -411,9 +411,6 @@ typedef struct mac_output mac_output;
 #define FRAME_MAC_WINDOW(f) ((f)->output_data.mac->mWP)
 #define FRAME_X_WINDOW(f) ((f)->output_data.mac->mWP)
 
-#define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_pixel)
-#define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_pixel)
-
 #define FRAME_FONT(f) ((f)->output_data.mac->font)
 #define FRAME_FONTSET(f) ((f)->output_data.mac->fontset)
 
index 870daca020ddded394cefc5b80ebf97ae37c132b..e04be1465ede2b32277fc1c70ee546647385de2c 100644 (file)
@@ -34,6 +34,7 @@ Boston, MA 02110-1301, USA.  */
 #include "syntax.h"
 #include "intervals.h"
 #include "keymap.h"
+#include "termhooks.h"
 
 extern int quit_char;
 
@@ -708,8 +709,12 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
       XWINDOW (minibuf_window)->cursor.x = 0;
       XWINDOW (minibuf_window)->must_be_updated_p = 1;
       update_frame (XFRAME (selected_frame), 1, 1);
-      if (rif && rif->flush_display)
-       rif->flush_display (XFRAME (XWINDOW (minibuf_window)->frame));
+      {
+        struct frame *f = XFRAME (XWINDOW (minibuf_window)->frame);
+        struct redisplay_interface *rif = FRAME_RIF (f);
+        if (rif && rif->flush_display)
+          rif->flush_display (f);
+      }
     }
 
   /* Make minibuffer contents into a string.  */
index 6dec71e0a3292c11e3b912b2e0492a4eacb8c385..07ee522f98fda784a0db79079090b5e79d298978 100644 (file)
@@ -2583,7 +2583,7 @@ internal_terminal_init ()
   set_terminal_modes_hook = IT_set_terminal_modes;
   reset_terminal_modes_hook = IT_reset_terminal_modes;
   set_terminal_window_hook = IT_set_terminal_window;
-  char_ins_del_ok = 0;
+  TTY_CHAR_INS_DEL_OK (CURTTY ()) = 0;
 #endif
 }
 
@@ -4880,7 +4880,7 @@ croak (badfunc)
      char *badfunc;
 {
   fprintf (stderr, "%s not yet implemented\r\n", badfunc);
-  reset_sys_modes ();
+  reset_all_sys_modes ();
   exit (1);
 }
 \f
index 389c6b06e93d269c63dec8ca28119a41b281f6a9..3879821c2fa2fe738071627c915c865a0fc0811e 100644 (file)
@@ -126,11 +126,11 @@ Boston, MA 02110-1301, USA.  */
 #include "charset.h"
 #include "coding.h"
 #include "process.h"
+#include "frame.h"
 #include "termhooks.h"
 #include "termopts.h"
 #include "commands.h"
 #include "keyboard.h"
-#include "frame.h"
 #include "blockinput.h"
 #include "dispextern.h"
 #include "composite.h"
@@ -305,11 +305,11 @@ extern int keyboard_bit_set P_ ((SELECT_TYPE *));
 
 static SELECT_TYPE input_wait_mask;
 
-/* Mask that excludes keyboard input descriptor (s).  */
+/* Mask that excludes keyboard input descriptor(s).  */
 
 static SELECT_TYPE non_keyboard_wait_mask;
 
-/* Mask that excludes process input descriptor (s).  */
+/* Mask that excludes process input descriptor(s).  */
 
 static SELECT_TYPE non_process_wait_mask;
 
@@ -6590,20 +6590,12 @@ DEFUN ("process-filter-multibyte-p", Fprocess_filter_multibyte_p,
 
 
 \f
-/* The first time this is called, assume keyboard input comes from DESC
-   instead of from where we used to expect it.
-   Subsequent calls mean assume input keyboard can come from DESC
-   in addition to other places.  */
-
-static int add_keyboard_wait_descriptor_called_flag;
+/* Add DESC to the set of keyboard input descriptors.  */
 
 void
 add_keyboard_wait_descriptor (desc)
      int desc;
 {
-  if (! add_keyboard_wait_descriptor_called_flag)
-    FD_CLR (0, &input_wait_mask);
-  add_keyboard_wait_descriptor_called_flag = 1;
   FD_SET (desc, &input_wait_mask);
   FD_SET (desc, &non_process_wait_mask);
   if (desc > max_keyboard_desc)
@@ -6673,7 +6665,12 @@ init_process ()
   process_output_skip = 0;
 #endif
 
+  /* Don't do this, it caused infinite select loops.  The display
+     method should call add_keyboard_wait_descriptor on stdin if it
+     needs that.  */
+#if 0
   FD_SET (0, &input_wait_mask);
+#endif
 
   Vprocess_alist = Qnil;
   for (i = 0; i < MAXDESC; i++)
index 5e51ae3b1ba9e7bca14174b49b6cab7ba4dcdb37..2e7637c6724ccca48a30075fa433695ce15d1e0a 100644 (file)
@@ -42,7 +42,7 @@ Boston, MA 02110-1301, USA.  */
 #endif
 
 #ifndef BASE_PURESIZE
-#define BASE_PURESIZE (1100000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
+#define BASE_PURESIZE (1200000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA)
 #endif
 
 /* Increase BASE_PURESIZE by a ratio depending on the machine's word size.  */
index 48a50e59983d1ba7bfd8ac44145ca9e5755d9843..f73f6f4fa80530692275cd9aa0d49236c9a5ed04 100644 (file)
@@ -22,12 +22,13 @@ Boston, MA 02110-1301, USA.  */
 #include <config.h>
 #include <stdio.h>
 #include <string.h>
-#include "termchar.h"
 #include "lisp.h"
+#include "termchar.h"
 #include "dispextern.h"
 #include "keyboard.h"
 #include "frame.h"
 #include "window.h"
+#include "termhooks.h"
 
 /* All costs measured in characters.
    So no cost can exceed the area of a frame, measured in characters.
@@ -57,10 +58,12 @@ struct matrix_elt
     unsigned char writecount;
   };
 
-static void do_direct_scrolling P_ ((struct glyph_matrix *,
+static void do_direct_scrolling P_ ((struct frame *,
+                                     struct glyph_matrix *,
                                     struct matrix_elt *,
                                     int, int));
-static void do_scrolling P_ ((struct glyph_matrix *,
+static void do_scrolling P_ ((struct frame *,
+                              struct glyph_matrix *,
                              struct matrix_elt *,
                              int, int));
 
@@ -100,7 +103,8 @@ calculate_scrolling (frame, matrix, window_size, lines_below,
   register struct matrix_elt *p, *p1;
   register int cost, cost1;
 
-  int lines_moved = window_size + (scroll_region_ok ? 0 : lines_below);
+  int lines_moved = window_size
+    + (FRAME_SCROLL_REGION_OK (frame) ? 0 : lines_below);
   /* first_insert_cost[I] is the cost of doing the first insert-line
      at the i'th line of the lines we are considering,
      where I is origin 1 (as it is below).  */
@@ -240,7 +244,8 @@ calculate_scrolling (frame, matrix, window_size, lines_below,
    of lines.  */
 
 static void
-do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
+do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top)
+     struct frame *frame;
      struct glyph_matrix *current_matrix;
      struct matrix_elt *matrix;
      int window_size;
@@ -307,12 +312,12 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
          /* Set the terminal window, if not done already.  */
          if (! terminal_window_p)
            {
-             set_terminal_window (window_size + unchanged_at_top);
+             set_terminal_window (frame, window_size + unchanged_at_top);
              terminal_window_p = 1;
            }
 
          /* Delete lines on the terminal.  */
-         ins_del_lines (j + unchanged_at_top, - p->deletecount);
+         ins_del_lines (frame, j + unchanged_at_top, - p->deletecount);
        }
       else
        {
@@ -337,7 +342,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
       /* Set the terminal window if not yet done.  */
       if (!terminal_window_p)
        {
-         set_terminal_window (window_size + unchanged_at_top);
+         set_terminal_window (frame, window_size + unchanged_at_top);
          terminal_window_p = 1;
        }
 
@@ -346,7 +351,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
          --queue;
 
          /* Do the deletion on the terminal.  */
-         ins_del_lines (queue->pos, queue->count);
+         ins_del_lines (frame, queue->pos, queue->count);
 
          /* All lines in the range deleted become empty in the glyph
             matrix.  Assign to them glyph rows that are not retained.
@@ -379,7 +384,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
   CHECK_MATRIX (current_matrix);
 
   if (terminal_window_p)
-    set_terminal_window (0);
+    set_terminal_window (frame, 0);
 }
 
 \f
@@ -466,7 +471,8 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below,
   /* Overhead of setting the scroll window, plus the extra cost
      cost of scrolling by a distance of one.  The extra cost is
      added once for consistency with the cost vectors */
-  scroll_overhead = scroll_region_cost + extra_cost;
+  scroll_overhead
+    = FRAME_SCROLL_REGION_COST (frame) + extra_cost;
 
   /* initialize the top left corner of the matrix */
   matrix->writecost = 0;
@@ -649,8 +655,9 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below,
    the cost matrix for this approach is constructed. */
 
 static void
-do_direct_scrolling (current_matrix, cost_matrix, window_size,
-                    unchanged_at_top)
+do_direct_scrolling (frame, current_matrix, cost_matrix,
+                     window_size, unchanged_at_top)
+     struct frame *frame;
      struct glyph_matrix *current_matrix;
      struct matrix_elt *cost_matrix;
      int window_size;
@@ -741,9 +748,9 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
          if (i > j)
            {
              /* Immediately insert lines */
-             set_terminal_window (i + unchanged_at_top);
+             set_terminal_window (frame, i + unchanged_at_top);
              terminal_window_p = 1;
-             ins_del_lines (j - n_to_write + unchanged_at_top, i - j);
+             ins_del_lines (frame, j - n_to_write + unchanged_at_top, i - j);
            }
          else if (i < j)
            {
@@ -773,9 +780,9 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
          --queue;
          if (queue->count)
            {
-             set_terminal_window (queue->window);
+             set_terminal_window (frame, queue->window);
              terminal_window_p = 1;
-             ins_del_lines (queue->pos, queue->count);
+             ins_del_lines (frame, queue->pos, queue->count);
            }
          else
            {
@@ -798,7 +805,7 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
                       copy_from, retained_p);
 
   if (terminal_window_p)
-    set_terminal_window (0);
+    set_terminal_window (frame, 0);
 }
 
 
@@ -818,13 +825,13 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
   matrix = ((struct matrix_elt *)
            alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix));
 
-  if (scroll_region_ok)
+  if (FRAME_SCROLL_REGION_OK (frame))
     {
       calculate_direct_scrolling (frame, matrix, window_size,
                                  unchanged_at_bottom,
                                  draw_cost, old_draw_cost,
                                  old_hash, new_hash, free_at_end);
-      do_direct_scrolling (frame->current_matrix,
+      do_direct_scrolling (frame, frame->current_matrix,
                           matrix, window_size, unchanged_at_top);
     }
   else
@@ -832,7 +839,8 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
       calculate_scrolling (frame, matrix, window_size, unchanged_at_bottom,
                           draw_cost, old_hash, new_hash,
                           free_at_end);
-      do_scrolling (frame->current_matrix, matrix, window_size,
+      do_scrolling (frame,
+                    frame->current_matrix, matrix, window_size,
                    unchanged_at_top);
     }
 }
@@ -914,7 +922,7 @@ scroll_cost (frame, from, to, amount)
   if (amount == 0)
     return 0;
 
-  if (! scroll_region_ok)
+  if (! FRAME_SCROLL_REGION_OK (frame))
     limit = height;
   else if (amount > 0)
     limit += amount;
index 8e8d02b844ef50cf7758662a90d7807b15bdbe71..06adc855f7c327d5a4ccc90f293741e0044f411a 100644 (file)
@@ -46,6 +46,8 @@ extern void srandom P_ ((unsigned int));
 #endif
 #endif
 
+#include "sysselect.h"
+
 #include "blockinput.h"
 #undef NULL
 
@@ -180,6 +182,7 @@ extern int quit_char;
 #include "termopts.h"
 #include "dispextern.h"
 #include "process.h"
+#include "cm.h"  /* for reset_sys_modes */
 
 #ifdef WINDOWSNT
 #include <direct.h>
@@ -242,16 +245,11 @@ static int baud_convert[] =
 
 int emacs_ospeed;
 
-/* The file descriptor for Emacs's input terminal.
-   Under Unix, this is normally zero except when using X;
-   under VMS, we place the input channel number here.  */
-int input_fd;
-
 void croak P_ ((char *));
 
 #ifdef AIXHFT
-void hft_init ();
-void hft_reset ();
+void hft_init P_ ((struct tty_display_info *));
+void hft_reset P_ ((struct tty_display_info *));
 #endif
 
 /* Temporary used by `sigblock' when defined in terms of signprocmask.  */
@@ -259,16 +257,7 @@ void hft_reset ();
 SIGMASKTYPE sigprocmask_set;
 
 \f
-/* Specify a different file descriptor for further input operations.  */
-
-void
-change_input_fd (fd)
-     int fd;
-{
-  input_fd = fd;
-}
-
-/* Discard pending input on descriptor input_fd.  */
+/* Discard pending input on all input descriptors.  */
 
 void
 discard_tty_input ()
@@ -279,54 +268,61 @@ discard_tty_input ()
   if (noninteractive)
     return;
 
-  /* Discarding input is not safe when the input could contain
-     replies from the X server.  So don't do it.  */
-  if (read_socket_hook)
-    return;
-
 #ifdef VMS
   end_kbd_input ();
-  SYS$QIOW (0, input_fd, IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0,
+  SYS$QIOW (0, fileno (CURTTY()->input), IO$_READVBLK|IO$M_PURGE, input_iosb, 0, 0,
            &buf.main, 0, 0, terminator_mask, 0, 0);
   queue_kbd_input ();
 #else /* not VMS */
 #ifdef APOLLO
   {
-    int zero = 0;
-    ioctl (input_fd, TIOCFLUSH, &zero);
+    struct tty_display_info *tty;
+    for (tty = tty_list; tty; tty = tty->next)
+      {
+        int zero = 0;
+        if (tty->input)
+          ioctl (fileno (tty->input), TIOCFLUSH, &zero);
+      }
   }
 #else /* not Apollo */
 #ifdef MSDOS    /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
   while (dos_keyread () != -1)
     ;
 #else /* not MSDOS */
-  EMACS_GET_TTY (input_fd, &buf);
-  EMACS_SET_TTY (input_fd, &buf, 0);
+  {
+    struct tty_display_info *tty;
+    for (tty = tty_list; tty; tty = tty->next)
+      {
+        if (tty->input)         /* Is the device suspended? */
+          {
+            EMACS_GET_TTY (fileno (tty->input), &buf);
+            EMACS_SET_TTY (fileno (tty->input), &buf, 0);
+          }
+      }
+  }
 #endif /* not MSDOS */
 #endif /* not Apollo */
 #endif /* not VMS */
 #endif /* not WINDOWSNT */
 }
 
+\f
 #ifdef SIGTSTP
 
 /* Arrange for character C to be read as the next input from
-   the terminal.  */
+   the terminal.
+   XXX What if we have multiple ttys?
+*/
 
 void
-#ifdef PROTOTYPES
 stuff_char (char c)
-#else
-stuff_char (c)
-     char c;
-#endif
 {
-  if (read_socket_hook)
+  if (! FRAME_TERMCAP_P (SELECTED_FRAME ()))
     return;
 
 /* Should perhaps error if in batch mode */
 #ifdef TIOCSTI
-  ioctl (input_fd, TIOCSTI, &c);
+  ioctl (fileno (CURTTY()->input), TIOCSTI, &c);
 #else /* no TIOCSTI */
   error ("Cannot stuff terminal input characters in this version of Unix");
 #endif /* no TIOCSTI */
@@ -335,7 +331,7 @@ stuff_char (c)
 #endif /* SIGTSTP */
 \f
 void
-init_baud_rate ()
+init_baud_rate (int fd)
 {
   if (noninteractive)
     emacs_ospeed = 0;
@@ -350,7 +346,7 @@ init_baud_rate ()
 #ifdef VMS
       struct sensemode sg;
 
-      SYS$QIOW (0, input_fd, IO$_SENSEMODE, &sg, 0, 0,
+      SYS$QIOW (0, fd, IO$_SENSEMODE, &sg, 0, 0,
                &sg.class, 12, 0, 0, 0, 0 );
       emacs_ospeed = sg.xmit_baud;
 #else /* not VMS */
@@ -358,7 +354,7 @@ init_baud_rate ()
       struct termios sg;
 
       sg.c_cflag = B9600;
-      tcgetattr (input_fd, &sg);
+      tcgetattr (fd, &sg);
       emacs_ospeed = cfgetospeed (&sg);
 #if defined (USE_GETOBAUD) && defined (getobaud)
       /* m88k-motorola-sysv3 needs this (ghazi@noc.rutgers.edu) 9/1/94. */
@@ -371,16 +367,16 @@ init_baud_rate ()
 
       sg.c_cflag = B9600;
 #ifdef HAVE_TCATTR
-      tcgetattr (input_fd, &sg);
+      tcgetattr (fd, &sg);
 #else
-      ioctl (input_fd, TCGETA, &sg);
+      ioctl (fd, TCGETA, &sg);
 #endif
       emacs_ospeed = sg.c_cflag & CBAUD;
 #else /* neither VMS nor TERMIOS nor TERMIO */
       struct sgttyb sg;
 
       sg.sg_ospeed = B9600;
-      if (ioctl (input_fd, TIOCGETP, &sg) < 0)
+      if (ioctl (fd, TIOCGETP, &sg) < 0)
        abort ();
       emacs_ospeed = sg.sg_ospeed;
 #endif /* not HAVE_TERMIO */
@@ -396,6 +392,7 @@ init_baud_rate ()
     baud_rate = 1200;
 }
 
+\f
 /*ARGSUSED*/
 void
 set_exclusive_use (fd)
@@ -657,7 +654,7 @@ child_setup_tty (out)
 
 #ifdef BSD4_1
   if (interrupt_input)
-    reset_sigio ();
+    reset_sigio (0);
 #endif /* BSD4_1 */
 #ifdef RTU
   {
@@ -914,53 +911,88 @@ restore_signal_handlers (saved_handlers)
     }
 }
 \f
+#ifndef SIGIO
+/* If SIGIO is broken, don't do anything. */
+void
+init_sigio (int fd)
+{
+}
+
+void
+reset_sigio (int fd)
+{
+}
+
+void
+request_sigio (void)
+{
+}
+
+void
+unrequest_sigio (void)
+{
+}
+
+#else
 #ifdef F_SETFL
 
-int old_fcntl_flags;
+int old_fcntl_flags[MAXDESC];
 
 void
 init_sigio (fd)
      int fd;
 {
 #ifdef FASYNC
-  old_fcntl_flags = fcntl (fd, F_GETFL, 0) & ~FASYNC;
-  fcntl (fd, F_SETFL, old_fcntl_flags | FASYNC);
+  old_fcntl_flags[fd] = fcntl (fd, F_GETFL, 0) & ~FASYNC;
+  fcntl (fd, F_SETFL, old_fcntl_flags[fd] | FASYNC);
 #endif
   interrupts_deferred = 0;
 }
 
 void
-reset_sigio ()
+reset_sigio (fd)
+     int fd;
 {
-  unrequest_sigio ();
+#ifdef FASYNC
+  fcntl (fd, F_SETFL, old_fcntl_flags[fd]);
+#endif
 }
 
 #ifdef FASYNC          /* F_SETFL does not imply existence of FASYNC */
+/* XXX Uhm, FASYNC is not used anymore here. */
 
 void
 request_sigio ()
 {
+  /* XXX read_socket_hook is not global anymore.  Is blocking SIGIO
+     bad under X? */
+#if 0
   if (read_socket_hook)
     return;
+#endif
 
 #ifdef SIGWINCH
   sigunblock (sigmask (SIGWINCH));
 #endif
-  fcntl (input_fd, F_SETFL, old_fcntl_flags | FASYNC);
+  sigunblock (sigmask (SIGIO));
 
   interrupts_deferred = 0;
 }
 
 void
-unrequest_sigio ()
-{
+unrequest_sigio (void)
+{ 
+  /* XXX read_socket_hook is not global anymore.  Is blocking SIGIO
+     bad under X? */
+#if 0
   if (read_socket_hook)
     return;
-
+#endif
+  
 #ifdef SIGWINCH
   sigblock (sigmask (SIGWINCH));
 #endif
-  fcntl (input_fd, F_SETFL, old_fcntl_flags);
+  sigblock (sigmask (SIGIO));
   interrupts_deferred = 1;
 }
 
@@ -975,7 +1007,8 @@ request_sigio ()
   if (read_socket_hook)
     return;
 
-  ioctl (input_fd, FIOASYNC, &on);
+  /* XXX CURTTY() is bogus here. */
+  ioctl (fileno (CURTTY ()->input), FIOASYNC, &on);
   interrupts_deferred = 0;
 }
 
@@ -987,7 +1020,8 @@ unrequest_sigio ()
   if (read_socket_hook)
     return;
 
-  ioctl (input_fd, FIOASYNC, &off);
+  /* XXX CURTTY() is bogus here. */
+  ioctl (fileno (CURTTY ()->input), FIOASYNC, &off);
   interrupts_deferred = 1;
 }
 
@@ -1008,7 +1042,7 @@ request_sigio ()
 
   sigemptyset (&st);
   sigaddset (&st, SIGIO);
-  ioctl (input_fd, FIOASYNC, &on);
+  ioctl (0, FIOASYNC, &on);     /* XXX This fails for multiple ttys. */
   interrupts_deferred = 0;
   sigprocmask (SIG_UNBLOCK, &st, (sigset_t *)0);
 }
@@ -1021,7 +1055,7 @@ unrequest_sigio ()
   if (read_socket_hook)
     return;
 
-  ioctl (input_fd, FIOASYNC, &off);
+  ioctl (0, FIOASYNC, &off);  /* XXX This fails for multiple ttys. */
   interrupts_deferred = 1;
 }
 
@@ -1051,6 +1085,7 @@ unrequest_sigio ()
 #endif /* STRIDE */
 #endif /* FASYNC */
 #endif /* F_SETFL */
+#endif /* SIGIO */
 \f
 /* Saving and restoring the process group of Emacs's terminal.  */
 
@@ -1073,30 +1108,39 @@ unrequest_sigio ()
    the tty's pgroup just like any other terminal setting.  If
    inherited_group was not the tty's pgroup, then we'll get a
    SIGTTmumble when we try to change the tty's pgroup, and a CONT if
-   it goes foreground in the future, which is what should happen.  */
+   it goes foreground in the future, which is what should happen.
+
+   This variable is initialized in emacs.c.  */
 int inherited_pgroup;
 
-/* Split off the foreground process group to Emacs alone.
-   When we are in the foreground, but not started in our own process
-   group, redirect the TTY to point to our own process group.  We need
-   to be in our own process group to receive SIGIO properly.  */
+/* Split off the foreground process group to Emacs alone.  When we are
+   in the foreground, but not started in our own process group,
+   redirect the tty device handle FD to point to our own process
+   group.  We need to be in our own process group to receive SIGIO
+   properly.  */
 void
-narrow_foreground_group ()
+narrow_foreground_group (int fd)
 {
   int me = getpid ();
 
   setpgrp (0, inherited_pgroup);
+#if 0
+  /* XXX inherited_pgroup should not be zero here, but GTK seems to
+     mess this up. */
+  if (! inherited_pgroup)
+    abort ();                   /* Should not happen. */
+#endif
   if (inherited_pgroup != me)
-    EMACS_SET_TTY_PGRP (input_fd, &me);
+      EMACS_SET_TTY_PGRP (fd, &me); /* XXX This only works on the controlling tty. */
   setpgrp (0, me);
 }
 
 /* Set the tty to our original foreground group.  */
 void
-widen_foreground_group ()
+widen_foreground_group (int fd)
 {
   if (inherited_pgroup != getpid ())
-    EMACS_SET_TTY_PGRP (input_fd, &inherited_pgroup);
+    EMACS_SET_TTY_PGRP (fd, &inherited_pgroup);
   setpgrp (0, inherited_pgroup);
 }
 
@@ -1254,14 +1298,6 @@ emacs_set_tty (fd, settings, flushp)
 }
 
 \f
-/* The initial tty mode bits */
-struct emacs_tty old_tty;
-
-/* 1 if we have been through init_sys_modes.  */
-int term_initted;
-
-/* 1 if outer tty status has been recorded.  */
-int old_tty_valid;
 
 #ifdef BSD4_1
 /* BSD 4.1 needs to keep track of the lmode bits in order to start
@@ -1271,7 +1307,7 @@ int lmode;
 
 #ifndef F_SETOWN_BUG
 #ifdef F_SETOWN
-int old_fcntl_owner;
+int old_fcntl_owner[MAXDESC];
 #endif /* F_SETOWN */
 #endif /* F_SETOWN_BUG */
 
@@ -1296,8 +1332,22 @@ static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};
 static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};
 #endif
 
+/* Initialize the terminal mode on all tty devices that are currently
+   open. */
+
+void
+init_all_sys_modes (void)
+{
+  struct tty_display_info *tty;
+  for (tty = tty_list; tty; tty = tty->next)
+    init_sys_modes (tty);
+}
+
+/* Initialize the terminal mode on the given tty device. */
+
 void
-init_sys_modes ()
+init_sys_modes (tty_out)
+     struct tty_display_info *tty_out;
 {
   struct emacs_tty tty;
 
@@ -1323,6 +1373,9 @@ nil means don't delete them until `list-processes' is run.  */);
   if (noninteractive)
     return;
 
+  if (!tty_out->output)
+    return;                     /* The tty is suspended. */
+  
 #ifdef VMS
   if (!input_ef)
     input_ef = get_kbd_event_flag ();
@@ -1353,266 +1406,287 @@ nil means don't delete them until `list-processes' is run.  */);
 #ifndef VMS4_4
   sys_access_reinit ();
 #endif
-#endif /* not VMS */
+#endif /* VMS */
 
 #ifdef BSD_PGRPS
-  if (! read_socket_hook && EQ (Vwindow_system, Qnil))
-    narrow_foreground_group ();
+#if 0
+  /* read_socket_hook is not global anymore.  I think doing this
+     unconditionally will not cause any problems. */
+  if (! read_socket_hook && EQ (Vinitial_window_system, Qnil))
 #endif
-
-#ifdef HAVE_WINDOW_SYSTEM
-  /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
-     needs the initialization code below.  */
-  if (!read_socket_hook && EQ (Vwindow_system, Qnil))
+    narrow_foreground_group (fileno (tty_out->input));
 #endif
-    {
-      EMACS_GET_TTY (input_fd, &old_tty);
 
-      old_tty_valid = 1;
+  if (! tty_out->old_tty)
+    tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
+      
+  EMACS_GET_TTY (fileno (tty_out->input), tty_out->old_tty);
 
-      tty = old_tty;
+  tty = *tty_out->old_tty;
 
 #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
-      XSETINT (Vtty_erase_char, old_tty.main.c_cc[VERASE]);
+  XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]);
 
 #ifdef DGUX
-      /* This allows meta to be sent on 8th bit.  */
-      tty.main.c_iflag &= ~INPCK;      /* don't check input for parity */
+  /* This allows meta to be sent on 8th bit.  */
+  tty.main.c_iflag &= ~INPCK;  /* don't check input for parity */
 #endif
-      tty.main.c_iflag |= (IGNBRK);    /* Ignore break condition */
-      tty.main.c_iflag &= ~ICRNL;      /* Disable map of CR to NL on input */
+  tty.main.c_iflag |= (IGNBRK);        /* Ignore break condition */
+  tty.main.c_iflag &= ~ICRNL;  /* Disable map of CR to NL on input */
 #ifdef INLCR  /* I'm just being cautious,
                 since I can't check how widespread INLCR is--rms.  */
-      tty.main.c_iflag &= ~INLCR;      /* Disable map of NL to CR on input */
+  tty.main.c_iflag &= ~INLCR;  /* Disable map of NL to CR on input */
 #endif
 #ifdef ISTRIP
-      tty.main.c_iflag &= ~ISTRIP;     /* don't strip 8th bit on input */
+  tty.main.c_iflag &= ~ISTRIP; /* don't strip 8th bit on input */
 #endif
-      tty.main.c_lflag &= ~ECHO;       /* Disable echo */
-      tty.main.c_lflag &= ~ICANON;     /* Disable erase/kill processing */
+  tty.main.c_lflag &= ~ECHO;   /* Disable echo */
+  tty.main.c_lflag &= ~ICANON; /* Disable erase/kill processing */
 #ifdef IEXTEN
-      tty.main.c_lflag &= ~IEXTEN;     /* Disable other editing characters.  */
+  tty.main.c_lflag &= ~IEXTEN; /* Disable other editing characters.  */
 #endif
-      tty.main.c_lflag |= ISIG;        /* Enable signals */
-      if (flow_control)
-       {
-         tty.main.c_iflag |= IXON;     /* Enable start/stop output control */
+  tty.main.c_lflag |= ISIG;    /* Enable signals */
+  if (tty_out->flow_control)
+    {
+      tty.main.c_iflag |= IXON;        /* Enable start/stop output control */
 #ifdef IXANY
-         tty.main.c_iflag &= ~IXANY;
+      tty.main.c_iflag &= ~IXANY;
 #endif /* IXANY */
-       }
-      else
-       tty.main.c_iflag &= ~IXON;      /* Disable start/stop output control */
-      tty.main.c_oflag &= ~ONLCR;      /* Disable map of NL to CR-NL
-                                          on output */
-      tty.main.c_oflag &= ~TAB3;       /* Disable tab expansion */
+    }
+  else
+    tty.main.c_iflag &= ~IXON; /* Disable start/stop output control */
+  tty.main.c_oflag &= ~ONLCR;  /* Disable map of NL to CR-NL
+                                   on output */
+  tty.main.c_oflag &= ~TAB3;   /* Disable tab expansion */
 #ifdef CS8
-      if (meta_key)
-       {
-         tty.main.c_cflag |= CS8;      /* allow 8th bit on input */
-         tty.main.c_cflag &= ~PARENB;/* Don't check parity */
-       }
+  if (tty_out->meta_key)
+    {
+      tty.main.c_cflag |= CS8; /* allow 8th bit on input */
+      tty.main.c_cflag &= ~PARENB;/* Don't check parity */
+    }
 #endif
+  if (tty_out->input == stdin)
+    {
       tty.main.c_cc[VINTR] = quit_char;        /* C-g (usually) gives SIGINT */
       /* Set up C-g for both SIGQUIT and SIGINT.
-        We don't know which we will get, but we handle both alike
-        so which one it really gives us does not matter.  */
+         We don't know which we will get, but we handle both alike
+         so which one it really gives us does not matter.  */
       tty.main.c_cc[VQUIT] = quit_char;
-      tty.main.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */
-      tty.main.c_cc[VTIME] = 0;        /* no matter how long that takes.  */
+    }
+  else
+    {
+      /* We normally don't get interrupt or quit signals from tty
+         devices other than our controlling terminal; therefore,
+         we must handle C-g as normal input.  Unfortunately, this
+         means that the interrupt and quit feature must be
+         disabled on secondary ttys, or we would not even see the
+         keypress.
+         
+         Note that even though emacsclient could have special code
+         to pass SIGINT to Emacs, we should _not_ enable
+         interrupt/quit keys for emacsclient frames.  This means
+         that we can't break out of loops in C code from a
+         secondary tty frame, but we can always decide what
+         display the C-g came from, which is more important from a
+         usability point of view.  (Consider the case when two
+         people work together using the same Emacs instance.)  */
+      tty.main.c_cc[VINTR] = CDISABLE;
+      tty.main.c_cc[VQUIT] = CDISABLE;
+    }
+  tty.main.c_cc[VMIN] = 1;     /* Input should wait for at least 1 char */
+  tty.main.c_cc[VTIME] = 0;    /* no matter how long that takes.  */
 #ifdef VSWTCH
-      tty.main.c_cc[VSWTCH] = CDISABLE;        /* Turn off shell layering use
+  tty.main.c_cc[VSWTCH] = CDISABLE;    /* Turn off shell layering use
                                           of C-z */
 #endif /* VSWTCH */
-
+  
 #if defined (mips) || defined (HAVE_TCATTR)
 #ifdef VSUSP
-      tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z.  */
+  tty.main.c_cc[VSUSP] = CDISABLE;     /* Turn off mips handling of C-z.  */
 #endif /* VSUSP */
 #ifdef V_DSUSP
-      tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y.  */
+  tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y.  */
 #endif /* V_DSUSP */
 #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP.  */
-      tty.main.c_cc[VDSUSP] = CDISABLE;
+  tty.main.c_cc[VDSUSP] = CDISABLE;
 #endif /* VDSUSP */
 #ifdef VLNEXT
-      tty.main.c_cc[VLNEXT] = CDISABLE;
+  tty.main.c_cc[VLNEXT] = CDISABLE;
 #endif /* VLNEXT */
 #ifdef VREPRINT
-      tty.main.c_cc[VREPRINT] = CDISABLE;
+  tty.main.c_cc[VREPRINT] = CDISABLE;
 #endif /* VREPRINT */
 #ifdef VWERASE
-      tty.main.c_cc[VWERASE] = CDISABLE;
+  tty.main.c_cc[VWERASE] = CDISABLE;
 #endif /* VWERASE */
 #ifdef VDISCARD
-      tty.main.c_cc[VDISCARD] = CDISABLE;
+  tty.main.c_cc[VDISCARD] = CDISABLE;
 #endif /* VDISCARD */
 
-      if (flow_control)
-       {
+  if (tty_out->flow_control)
+    {
 #ifdef VSTART
-         tty.main.c_cc[VSTART] = '\021';
+      tty.main.c_cc[VSTART] = '\021';
 #endif /* VSTART */
 #ifdef VSTOP
-         tty.main.c_cc[VSTOP] = '\023';
+      tty.main.c_cc[VSTOP] = '\023';
 #endif /* VSTOP */
-       }
-      else
-       {
+    }
+  else
+    {
 #ifdef VSTART
-         tty.main.c_cc[VSTART] = CDISABLE;
+      tty.main.c_cc[VSTART] = CDISABLE;
 #endif /* VSTART */
 #ifdef VSTOP
-         tty.main.c_cc[VSTOP] = CDISABLE;
+      tty.main.c_cc[VSTOP] = CDISABLE;
 #endif /* VSTOP */
-       }
+    }
 #endif /* mips or HAVE_TCATTR */
 
 #ifdef SET_LINE_DISCIPLINE
-      /* Need to explicitly request TERMIODISC line discipline or
-         Ultrix's termios does not work correctly.  */
-      tty.main.c_line = SET_LINE_DISCIPLINE;
+  /* Need to explicitly request TERMIODISC line discipline or
+     Ultrix's termios does not work correctly.  */
+  tty.main.c_line = SET_LINE_DISCIPLINE;
 #endif
 #ifdef AIX
 #ifndef IBMR2AIX
-      /* AIX enhanced edit loses NULs, so disable it.  */
-      tty.main.c_line = 0;
-      tty.main.c_iflag &= ~ASCEDIT;
+  /* AIX enhanced edit loses NULs, so disable it.  */
+  tty.main.c_line = 0;
+  tty.main.c_iflag &= ~ASCEDIT;
 #else
-      tty.main.c_cc[VSTRT] = CDISABLE;
-      tty.main.c_cc[VSTOP] = CDISABLE;
-      tty.main.c_cc[VSUSP] = CDISABLE;
-      tty.main.c_cc[VDSUSP] = CDISABLE;
+  tty.main.c_cc[VSTRT] = CDISABLE;
+  tty.main.c_cc[VSTOP] = CDISABLE;
+  tty.main.c_cc[VSUSP] = CDISABLE;
+  tty.main.c_cc[VDSUSP] = CDISABLE;
 #endif /* IBMR2AIX */
-      if (flow_control)
-       {
+  if (tty_out->flow_control)
+    {
 #ifdef VSTART
-         tty.main.c_cc[VSTART] = '\021';
+      tty.main.c_cc[VSTART] = '\021';
 #endif /* VSTART */
 #ifdef VSTOP
-         tty.main.c_cc[VSTOP] = '\023';
+      tty.main.c_cc[VSTOP] = '\023';
 #endif /* VSTOP */
-       }
-      /* Also, PTY overloads NUL and BREAK.
-        don't ignore break, but don't signal either, so it looks like NUL.
-        This really serves a purpose only if running in an XTERM window
-        or via TELNET or the like, but does no harm elsewhere.  */
-      tty.main.c_iflag &= ~IGNBRK;
-      tty.main.c_iflag &= ~BRKINT;
+    }
+  /* Also, PTY overloads NUL and BREAK.
+     don't ignore break, but don't signal either, so it looks like NUL.
+     This really serves a purpose only if running in an XTERM window
+     or via TELNET or the like, but does no harm elsewhere.  */
+  tty.main.c_iflag &= ~IGNBRK;
+  tty.main.c_iflag &= ~BRKINT;
 #endif
 #else /* if not HAVE_TERMIO */
 #ifdef VMS
-      tty.main.tt_char |= TT$M_NOECHO;
-      if (meta_key)
-       tty.main.tt_char |= TT$M_EIGHTBIT;
-      if (flow_control)
-       tty.main.tt_char |= TT$M_TTSYNC;
-      else
-       tty.main.tt_char &= ~TT$M_TTSYNC;
-      tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON;
+  tty.main.tt_char |= TT$M_NOECHO;
+  if (meta_key)
+    tty.main.tt_char |= TT$M_EIGHTBIT;
+  if (tty_out->flow_control)
+    tty.main.tt_char |= TT$M_TTSYNC;
+  else
+    tty.main.tt_char &= ~TT$M_TTSYNC;
+  tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON;
 #else /* not VMS (BSD, that is) */
 #ifndef DOS_NT
-      XSETINT (Vtty_erase_char, tty.main.sg_erase);
-      tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
-      if (meta_key)
-       tty.main.sg_flags |= ANYP;
-      tty.main.sg_flags |= interrupt_input ? RAW : CBREAK;
+  XSETINT (Vtty_erase_char, tty.main.sg_erase);
+  tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
+  if (meta_key)
+    tty.main.sg_flags |= ANYP;
+  tty.main.sg_flags |= interrupt_input ? RAW : CBREAK;
 #endif /* not DOS_NT */
 #endif /* not VMS (BSD, that is) */
 #endif /* not HAVE_TERMIO */
 
-      /* If going to use CBREAK mode, we must request C-g to interrupt
-        and turn off start and stop chars, etc.  If not going to use
-        CBREAK mode, do this anyway so as to turn off local flow
-        control for user coming over network on 4.2; in this case,
-        only t_stopc and t_startc really matter.  */
+  /* If going to use CBREAK mode, we must request C-g to interrupt
+     and turn off start and stop chars, etc.  If not going to use
+     CBREAK mode, do this anyway so as to turn off local flow
+     control for user coming over network on 4.2; in this case,
+     only t_stopc and t_startc really matter.  */
 #ifndef HAVE_TERMIO
 #ifdef HAVE_TCHARS
-      /* Note: if not using CBREAK mode, it makes no difference how we
-        set this */
-      tty.tchars = new_tchars;
-      tty.tchars.t_intrc = quit_char;
-      if (flow_control)
-       {
-         tty.tchars.t_startc = '\021';
-         tty.tchars.t_stopc = '\023';
-       }
-
-      tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | old_tty.lmode;
+  /* Note: if not using CBREAK mode, it makes no difference how we
+     set this */
+  tty.tchars = new_tchars;
+  tty.tchars.t_intrc = quit_char;
+  if (tty_out->flow_control)
+    {
+      tty.tchars.t_startc = '\021';
+      tty.tchars.t_stopc = '\023';
+    }
+  
+  tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode;
 #ifdef ultrix
-      /* Under Ultrix 4.2a, leaving this out doesn't seem to hurt
-        anything, and leaving it in breaks the meta key.  Go figure.  */
-      tty.lmode &= ~LLITOUT;
+  /* Under Ultrix 4.2a, leaving this out doesn't seem to hurt
+     anything, and leaving it in breaks the meta key.  Go figure.  */
+  tty.lmode &= ~LLITOUT;
 #endif
-
+  
 #ifdef BSD4_1
-      lmode = tty.lmode;
+  lmode = tty.lmode;
 #endif
 
 #endif /* HAVE_TCHARS */
 #endif /* not HAVE_TERMIO */
 
 #ifdef HAVE_LTCHARS
-      tty.ltchars = new_ltchars;
+  tty.ltchars = new_ltchars;
 #endif /* HAVE_LTCHARS */
 #ifdef MSDOS   /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
-      if (!term_initted)
-       internal_terminal_init ();
-      dos_ttraw ();
+  if (!tty_out->term_initted)
+    internal_terminal_init ();
+  dos_ttraw ();
 #endif
 
-      EMACS_SET_TTY (input_fd, &tty, 0);
+  EMACS_SET_TTY (fileno (tty_out->input), &tty, 0);
 
-      /* This code added to insure that, if flow-control is not to be used,
-        we have an unlocked terminal at the start. */
+  /* This code added to insure that, if flow-control is not to be used,
+     we have an unlocked terminal at the start. */
 
 #ifdef TCXONC
-      if (!flow_control) ioctl (input_fd, TCXONC, 1);
+  if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TCXONC, 1);
 #endif
 #ifndef APOLLO
 #ifdef TIOCSTART
-      if (!flow_control) ioctl (input_fd, TIOCSTART, 0);
+  if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0);
 #endif
 #endif
 
 #if defined (HAVE_TERMIOS) || defined (HPUX9)
 #ifdef TCOON
-      if (!flow_control) tcflow (input_fd, TCOON);
+  if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON);
 #endif
 #endif
 
 #ifdef AIXHFT
-      hft_init ();
+  hft_init (tty_out);
 #ifdef IBMR2AIX
-      {
-       /* IBM's HFT device usually thinks a ^J should be LF/CR.  We need it
-          to be only LF.  This is the way that is done. */
-       struct termio tty;
-
-       if (ioctl (1, HFTGETID, &tty) != -1)
-         write (1, "\033[20l", 5);
-      }
+  {
+    /* IBM's HFT device usually thinks a ^J should be LF/CR.  We need it
+       to be only LF.  This is the way that is done. */
+    struct termio tty;
+    
+    if (ioctl (1, HFTGETID, &tty) != -1)
+      write (1, "\033[20l", 5);
+  }
 #endif
 #endif /* AIXHFT */
 
 #ifdef VMS
 /*  Appears to do nothing when in PASTHRU mode.
-      SYS$QIOW (0, input_fd, IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0,
+      SYS$QIOW (0, fileno (tty_out->input), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0,
                interrupt_signal, oob_chars, 0, 0, 0, 0);
 */
-      queue_kbd_input (0);
+  queue_kbd_input (0);
 #endif /* VMS */
-    }
 
 #ifdef F_SETFL
 #ifndef F_SETOWN_BUG
 #ifdef F_GETOWN                /* F_SETFL does not imply existence of F_GETOWN */
-  if (interrupt_input
-      && ! read_socket_hook && EQ (Vwindow_system, Qnil))
+  if (interrupt_input)
     {
-      old_fcntl_owner = fcntl (input_fd, F_GETOWN, 0);
-      fcntl (input_fd, F_SETOWN, getpid ());
-      init_sigio (input_fd);
+      old_fcntl_owner[fileno (tty_out->input)] =
+        fcntl (fileno (tty_out->input), F_GETOWN, 0);
+      fcntl (fileno (tty_out->input), F_SETOWN, getpid ());
+      init_sigio (fileno (tty_out->input));
     }
 #endif /* F_GETOWN */
 #endif /* F_SETOWN_BUG */
@@ -1620,7 +1694,7 @@ nil means don't delete them until `list-processes' is run.  */);
 
 #ifdef BSD4_1
   if (interrupt_input)
-    init_sigio (input_fd);
+    init_sigio (fileno (tty_out->input));
 #endif
 
 #ifdef VMS  /* VMS sometimes has this symbol but lacks setvbuf.  */
@@ -1630,53 +1704,56 @@ nil means don't delete them until `list-processes' is run.  */);
   /* This symbol is defined on recent USG systems.
      Someone says without this call USG won't really buffer the file
      even with a call to setbuf. */
-  setvbuf (stdout, (char *) _sobuf, _IOFBF, sizeof _sobuf);
+  setvbuf (tty_out->output, (char *) _sobuf, _IOFBF, sizeof _sobuf);
 #else
-  setbuf (stdout, (char *) _sobuf);
-#endif
-#ifdef HAVE_WINDOW_SYSTEM
-  /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
-     needs the initialization code below.  */
-  if (EQ (Vwindow_system, Qnil)
-#ifndef WINDOWSNT
-      /* When running in tty mode on NT/Win95, we have a read_socket
-        hook, but still need the rest of the initialization code below.  */
-      && (! read_socket_hook)
+  setbuf (tty_out->output, (char *) _sobuf);
 #endif
-      )
-#endif
-    set_terminal_modes ();
 
-  if (!term_initted
-      && FRAMEP (Vterminal_frame)
-      && FRAME_TERMCAP_P (XFRAME (Vterminal_frame)))
-    init_frame_faces (XFRAME (Vterminal_frame));
+  tty_set_terminal_modes (tty_out->display);
+
+  if (!tty_out->term_initted)
+    {
+      Lisp_Object tail, frame;
+      FOR_EACH_FRAME (tail, frame)
+        {
+          /* XXX This needs to be revised. */
+          if (FRAME_TERMCAP_P (XFRAME (frame))
+              && FRAME_TTY (XFRAME (frame)) == tty_out)
+            init_frame_faces (XFRAME (frame));
+        }
+    }
 
-  if (term_initted && no_redraw_on_reenter)
+  if (tty_out->term_initted && no_redraw_on_reenter)
     {
+      /* XXX This seems wrong on multi-tty. */
       if (display_completed)
        direct_output_forward_char (0);
     }
   else
     {
+      Lisp_Object tail, frame;
       frame_garbaged = 1;
-      if (FRAMEP (Vterminal_frame))
-       FRAME_GARBAGED_P (XFRAME (Vterminal_frame)) = 1;
+      FOR_EACH_FRAME (tail, frame)
+        {
+          if (FRAME_TERMCAP_P (XFRAME (frame))
+              && FRAME_TTY (XFRAME (frame)) == tty_out)
+            FRAME_GARBAGED_P (XFRAME (frame)) = 1;
+        }
     }
 
-  term_initted = 1;
+  tty_out->term_initted = 1;
 }
 
 /* Return nonzero if safe to use tabs in output.
    At the time this is called, init_sys_modes has not been done yet.  */
 
 int
-tabs_safe_p ()
+tabs_safe_p (int fd)
 {
-  struct emacs_tty tty;
+  struct emacs_tty etty;
 
-  EMACS_GET_TTY (input_fd, &tty);
-  return EMACS_TTY_TABS_OK (&tty);
+  EMACS_GET_TTY (fd, &etty);
+  return EMACS_TTY_TABS_OK (&etty);
 }
 \f
 /* Get terminal size from system.
@@ -1684,8 +1761,7 @@ tabs_safe_p ()
    We store 0 if there's no valid information.  */
 
 void
-get_frame_size (widthp, heightp)
-     int *widthp, *heightp;
+get_tty_size (int fd, int *widthp, int *heightp)
 {
 
 #ifdef TIOCGWINSZ
@@ -1693,7 +1769,7 @@ get_frame_size (widthp, heightp)
   /* BSD-style.  */
   struct winsize size;
 
-  if (ioctl (input_fd, TIOCGWINSZ, &size) == -1)
+  if (ioctl (fd, TIOCGWINSZ, &size) == -1)
     *widthp = *heightp = 0;
   else
     {
@@ -1707,7 +1783,7 @@ get_frame_size (widthp, heightp)
   /* SunOS - style.  */
   struct ttysize size;
 
-  if (ioctl (input_fd, TIOCGSIZE, &size) == -1)
+  if (ioctl (fd, TIOCGSIZE, &size) == -1)
     *widthp = *heightp = 0;
   else
     {
@@ -1739,7 +1815,6 @@ get_frame_size (widthp, heightp)
   *widthp = 0;
   *heightp = 0;
 #endif
-
 #endif /* not VMS */
 #endif /* not SunOS-style */
 #endif /* not BSD-style */
@@ -1783,37 +1858,58 @@ set_window_size (fd, height, width)
 }
 
 \f
-/* Prepare the terminal for exiting Emacs; move the cursor to the
-   bottom of the frame, turn off interrupt-driven I/O, etc.  */
+
+/* Prepare all terminal devices for exiting Emacs. */
+
 void
-reset_sys_modes ()
+reset_all_sys_modes (void)
 {
-  struct frame *sf;
+  struct tty_display_info *tty;
+  for (tty = tty_list; tty; tty = tty->next)
+    reset_sys_modes (tty);
+}
 
+/* Prepare the terminal for closing it; move the cursor to the
+   bottom of the frame, turn off interrupt-driven I/O, etc.  */
+
+void
+reset_sys_modes (tty_out)
+     struct tty_display_info *tty_out;
+{
   if (noninteractive)
     {
       fflush (stdout);
       return;
     }
-  if (!term_initted)
-    return;
-#ifdef HAVE_WINDOW_SYSTEM
-  /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
-     needs the clean-up code below.  */
-  if (!EQ (Vwindow_system, Qnil)
-#ifndef WINDOWSNT
-      /* When running in tty mode on NT/Win95, we have a read_socket
-        hook, but still need the rest of the clean-up code below.  */
-      || read_socket_hook
-#endif
-      )
+  if (!tty_out->term_initted)
     return;
-#endif
-  sf = SELECTED_FRAME ();
-  cursor_to (FRAME_LINES (sf) - 1, 0);
-  clear_end_of_line (FRAME_COLS (sf));
-  /* clear_end_of_line may move the cursor */
-  cursor_to (FRAME_LINES (sf) - 1, 0);
+
+  if (!tty_out->output)
+    return;                     /* The tty is suspended. */
+  
+  /* Go to and clear the last line of the terminal. */
+
+  cmgoto (tty_out, FrameRows (tty_out) - 1, 0);
+  
+  /* Code adapted from tty_clear_end_of_line. */
+  if (tty_out->TS_clr_line)
+    {
+      emacs_tputs (tty_out, tty_out->TS_clr_line, 1, cmputc);
+    }
+  else
+    {                  /* have to do it the hard way */
+      int i;
+      turn_off_insert (tty_out);
+      
+      for (i = curX (tty_out); i < FrameCols (tty_out) - 1; i++)
+        {
+          fputc (' ', tty_out->output);
+        }
+    }
+  
+  cmgoto (tty_out, FrameRows (tty_out) - 1, 0);
+  fflush (tty_out->output);
+  
 #if defined (IBMR2AIX) && defined (AIXHFT)
   {
     /* HFT devices normally use ^J as a LF/CR.  We forced it to
@@ -1825,12 +1921,12 @@ reset_sys_modes ()
   }
 #endif
 
-  reset_terminal_modes ();
-  fflush (stdout);
+  tty_reset_terminal_modes (tty_out->display);
+
 #ifdef BSD_SYSTEM
 #ifndef BSD4_1
   /* Avoid possible loss of output when changing terminal modes.  */
-  fsync (fileno (stdout));
+  fsync (fileno (tty_out->output));
 #endif
 #endif
 
@@ -1839,22 +1935,25 @@ reset_sys_modes ()
 #ifdef F_SETOWN                /* F_SETFL does not imply existence of F_SETOWN */
   if (interrupt_input)
     {
-      reset_sigio ();
-      fcntl (input_fd, F_SETOWN, old_fcntl_owner);
+      reset_sigio (fileno (tty_out->input));
+      fcntl (fileno (tty_out->input), F_SETOWN,
+             old_fcntl_owner[fileno (tty_out->input)]);
     }
 #endif /* F_SETOWN */
 #endif /* F_SETOWN_BUG */
 #ifdef O_NDELAY
-  fcntl (input_fd, F_SETFL, fcntl (input_fd, F_GETFL, 0) & ~O_NDELAY);
+  fcntl (fileno (tty_out->input), F_SETFL,
+         fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NDELAY);
 #endif
 #endif /* F_SETFL */
 #ifdef BSD4_1
   if (interrupt_input)
-    reset_sigio ();
+    reset_sigio (fileno (tty_out->input));
 #endif /* BSD4_1 */
 
-  if (old_tty_valid)
-    while (EMACS_SET_TTY (input_fd, &old_tty, 0) < 0 && errno == EINTR)
+  if (tty_out->old_tty)
+    while (EMACS_SET_TTY (fileno (tty_out->input),
+                          tty_out->old_tty, 0) < 0 && errno == EINTR)
       ;
 
 #ifdef MSDOS   /* Demacs 1.1.2 91/10/20 Manabu Higashida */
@@ -1865,7 +1964,7 @@ reset_sys_modes ()
   /* Ultrix's termios *ignores* any line discipline except TERMIODISC.
      A different old line discipline is therefore not restored, yet.
      Restore the old line discipline by hand.  */
-  ioctl (0, TIOCSETD, &old_tty.main.c_line);
+  ioctl (0, TIOCSETD, &tty_out->old_tty.main.c_line);
 #endif
 
 #ifdef AIXHFT
@@ -1873,7 +1972,7 @@ reset_sys_modes ()
 #endif
 
 #ifdef BSD_PGRPS
-  widen_foreground_group ();
+  widen_foreground_group (fileno (tty_out->input));
 #endif
 }
 \f
@@ -1938,9 +2037,9 @@ init_vms_input ()
 {
   int status;
 
-  if (input_fd == 0)
+  if (fileno (CURTTY ()->input)) == 0)
     {
-      status = SYS$ASSIGN (&input_dsc, &input_fd, 0, 0);
+      status = SYS$ASSIGN (&input_dsc, &fileno (CURTTY ()->input)), 0, 0);
       if (! (status & 1))
        LIB$STOP (status);
     }
@@ -1951,7 +2050,7 @@ init_vms_input ()
 void
 stop_vms_input ()
 {
-  return SYS$DASSGN (input_fd);
+  return SYS$DASSGN (fileno (CURTTY ()->input)));
 }
 
 short input_buffer;
@@ -1967,7 +2066,7 @@ queue_kbd_input ()
 
   waiting_for_ast = 0;
   stop_input = 0;
-  status = SYS$QIO (0, input_fd, IO$_READVBLK,
+  status = SYS$QIO (0, fileno (CURTTY()->input), IO$_READVBLK,
                    &input_iosb, kbd_input_ast, 1,
                    &input_buffer, 1, 0, terminator_mask, 0, 0);
 }
@@ -2084,7 +2183,7 @@ end_kbd_input ()
 #endif
   if (LIB$AST_IN_PROG ())  /* Don't wait if suspending from kbd_buffer_store_event! */
     {
-      SYS$CANCEL (input_fd);
+      SYS$CANCEL (fileno (CURTTY()->input));
       return;
     }
 
@@ -2093,7 +2192,7 @@ end_kbd_input ()
   SYS$CLREF (input_ef);
   waiting_for_ast = 1;
   stop_input = 1;
-  SYS$CANCEL (input_fd);
+  SYS$CANCEL (fileno (CURTTY()->input));
   SYS$SETAST (1);
   SYS$WAITFR (input_ef);
   waiting_for_ast = 0;
@@ -2155,7 +2254,8 @@ init_sigio (fd)
   request_sigio ();
 }
 
-reset_sigio ()
+reset_sigio (fd)
+     int fd;
 {
   unrequest_sigio ();
 }
@@ -2491,7 +2591,9 @@ sys_select (nfds, rfds, wfds, efds, timeout)
      SELECT_TYPE *rfds, *wfds, *efds;
      EMACS_TIME *timeout;
 {
-  int ravail = 0;
+  /* XXX This needs to be updated for multi-tty support.  Is there
+     anybody who needs to emulate select these days?  */ 
+ int ravail = 0;
   SELECT_TYPE orfds;
   int timeoutval;
   int *local_timeout;
@@ -2506,7 +2608,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
 #if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS)
   /* If we're using X, then the native select will work; we only need the
      emulation for non-X usage.  */
-  if (!NILP (Vwindow_system))
+  if (!NILP (Vinitial_window_system))
     return select (nfds, rfds, wfds, efds, timeout);
 #endif
   timeoutval = timeout ? EMACS_SECS (*timeout) : 100000;
@@ -2615,7 +2717,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
     }
   return ravail;
 }
-#endif /* not WINDOWSNT */
+#endif not WINDOWSNT
 
 /* Read keyboard input into the standard buffer,
    waiting for at least one character.  */
@@ -2623,6 +2725,8 @@ sys_select (nfds, rfds, wfds, efds, timeout)
 void
 read_input_waiting ()
 {
+  /* XXX This needs to be updated for multi-tty support.  Is there
+     anybody who needs to emulate select these days?  */
   int nread, i;
   extern int quit_char;
 
@@ -2676,6 +2780,10 @@ read_input_waiting ()
     }
 }
 
+#if !defined (HAVE_SELECT) || defined (BROKEN_SELECT_NON_X)
+#define select sys_select
+#endif
+
 #endif /* not HAVE_SELECT */
 #endif /* not VMS */
 #endif /* not MSDOS */
@@ -2692,12 +2800,13 @@ init_sigio (fd)
 }
 
 void
-reset_sigio ()
+reset_sigio (fd)
+     int fd;
 {
   if (noninteractive)
     return;
   lmode = ~LINTRUP & lmode;
-  ioctl (0, TIOCLSET, &lmode);
+  ioctl (fd, TIOCLSET, &lmode);
 }
 
 void
@@ -3149,7 +3258,7 @@ sys_getenv (name)
 #undef abort
 sys_abort ()
 {
-  reset_sys_modes ();
+  reset_all_sys_modes ();
   LIB$SIGNAL (SS$_DEBUG);
 }
 #endif /* abort */
@@ -3476,7 +3585,7 @@ croak (badfunc)
      char *badfunc;
 {
   printf ("%s not yet implemented\r\n", badfunc);
-  reset_sys_modes ();
+  reset_all_sys_modes ();
   exit (1);
 }
 
@@ -5063,7 +5172,7 @@ croak (badfunc)
      char *badfunc;
 {
   printf ("%s not yet implemented\r\n", badfunc);
-  reset_sys_modes ();
+  reset_all_sys_modes ();
   exit (1);
 }
 
@@ -5085,7 +5194,7 @@ srandom (seed)
 
 /* Called from init_sys_modes.  */
 void
-hft_init ()
+hft_init (struct tty_display_info *tty_out)
 {
   int junk;
 
@@ -5131,15 +5240,12 @@ hft_init ()
     keymap.hfkey[1].hf_char = 127;
     hftctl (0, HFSKBD, &buf);
   }
-  /* The HFT system on AIX doesn't optimize for scrolling, so it's really ugly
-     at times.  */
-  line_ins_del_ok = char_ins_del_ok = 0;
 }
 
 /* Reset the rubout key to backspace.  */
 
 void
-hft_reset ()
+hft_reset (struct tty_display_info *tty_out)
 {
   struct hfbuf buf;
   struct hfkeymap keymap;
index dd13e3764aa2cb62c3d5be2d0dd865a71b189765..2f8aa43f2f6c814c21ff8b3a4983e30b81fb9da8 100644 (file)
@@ -32,6 +32,7 @@ extern pthread_t main_thread;
    indicate that SIGIO doesn't work by #undef-ing SIGIO.  If this file
    #includes <signal.h>, then that will re-#define SIGIO and confuse
    things.  */
+/* XXX This is not correct anymore, there is a BROKEN_SIGIO macro. */
 
 #define SIGMASKTYPE sigset_t
 
index 658cc97d804cb45ad6c356939235a0191c988b94..ac1ef073318f82a573d2f73ee4ffcc5bbac24b33 100644 (file)
@@ -26,9 +26,19 @@ Boston, MA 02110-1301, USA.  */
 #include <ctype.h>
 #include <string.h>
 
+#include <sys/file.h>
+
+#include <unistd.h>             /* For isatty. */
+
+#if HAVE_TERMIOS_H
+#include <termios.h>           /* For TIOCNOTTY. */
+#endif
+
+#include <signal.h>
+
+#include "lisp.h"
 #include "termchar.h"
 #include "termopts.h"
-#include "lisp.h"
 #include "charset.h"
 #include "coding.h"
 #include "keyboard.h"
@@ -38,6 +48,8 @@ Boston, MA 02110-1301, USA.  */
 #include "dispextern.h"
 #include "window.h"
 #include "keymap.h"
+#include "syssignal.h"
+#include "systty.h"
 
 /* For now, don't try to include termcap.h.  On some systems,
    configure finds a non-standard termcap.h that the main build
@@ -60,24 +72,44 @@ extern int tgetnum P_ ((char *id));
 #include "macterm.h"
 #endif
 
+#ifndef O_RDWR
+#define O_RDWR 2
+#endif
+
+#ifndef O_NOCTTY
+#define O_NOCTTY 0
+#endif
+
 static void turn_on_face P_ ((struct frame *, int face_id));
 static void turn_off_face P_ ((struct frame *, int face_id));
-static void tty_show_cursor P_ ((void));
-static void tty_hide_cursor P_ ((void));
+static void tty_show_cursor P_ ((struct tty_display_info *));
+static void tty_hide_cursor P_ ((struct tty_display_info *));
+
+static struct display *get_tty_display (Lisp_Object display);
 
-#define OUTPUT(a) \
-     tputs (a, (int) (FRAME_LINES (XFRAME (selected_frame)) - curY), cmputc)
-#define OUTPUT1(a) tputs (a, 1, cmputc)
-#define OUTPUTL(a, lines) tputs (a, lines, cmputc)
+void delete_initial_display P_ ((struct display *));
+void create_tty_output P_ ((struct frame *));
+void delete_tty_output P_ ((struct frame *));
 
-#define OUTPUT_IF(a)                                                   \
-     do {                                                              \
-       if (a)                                                          \
-         tputs (a, (int) (FRAME_LINES (XFRAME (selected_frame))        \
-                         - curY), cmputc);                             \
-     } while (0)
+#define OUTPUT(tty, a)                                          \
+  emacs_tputs ((tty), a,                                        \
+               (int) (FRAME_LINES (XFRAME (selected_frame))     \
+                      - curY (tty)),                            \
+               cmputc)
 
-#define OUTPUT1_IF(a) do { if (a) tputs (a, 1, cmputc); } while (0)
+#define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc)
+#define OUTPUTL(tty, a, lines) emacs_tputs ((tty), a, lines, cmputc)
+
+#define OUTPUT_IF(tty, a)                                               \
+  do {                                                                  \
+    if (a)                                                              \
+      emacs_tputs ((tty), a,                                            \
+                   (int) (FRAME_LINES (XFRAME (selected_frame))         \
+                          - curY (tty) ),                               \
+                   cmputc);                                             \
+  } while (0)
+
+#define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0)
 
 /* Display space properties */
 
@@ -87,203 +119,27 @@ extern Lisp_Object Qspace, QCalign_to, QCwidth;
 
 Lisp_Object Vring_bell_function;
 
-/* Terminal characteristics that higher levels want to look at.
-   These are all extern'd in termchar.h */
+/* Functions to call after suspending a tty. */
+Lisp_Object Vsuspend_tty_functions;
 
-int must_write_spaces;         /* Nonzero means spaces in the text
-                                  must actually be output; can't just skip
-                                  over some columns to leave them blank.  */
-int min_padding_speed;         /* Speed below which no padding necessary */
+/* Functions to call after resuming a tty. */
+Lisp_Object Vresume_tty_functions;
 
-int line_ins_del_ok;           /* Terminal can insert and delete lines */
-int char_ins_del_ok;           /* Terminal can insert and delete chars */
-int scroll_region_ok;          /* Terminal supports setting the
-                                  scroll window */
-int scroll_region_cost;                /* Cost of setting a scroll window,
-                                  measured in characters */
-int memory_below_frame;                /* Terminal remembers lines
-                                  scrolled off bottom */
-int fast_clear_end_of_line;    /* Terminal has a `ce' string */
+/* Chain of all displays currently in use. */
+struct display *display_list;
 
-/* Nonzero means no need to redraw the entire frame on resuming
-   a suspended Emacs.  This is useful on terminals with multiple pages,
-   where one page is used for Emacs and another for all else. */
+/* The initial display device, created by initial_term_init. */
+struct display *initial_display;
 
-int no_redraw_on_reenter;
+/* Chain of all tty device parameters. */
+struct tty_display_info *tty_list;
 
-/* Hook functions that you can set to snap out the functions in this file.
-   These are all extern'd in termhooks.h  */
-
-void (*cursor_to_hook) P_ ((int, int));
-void (*raw_cursor_to_hook) P_ ((int, int));
-void (*clear_to_end_hook) P_ ((void));
-void (*clear_frame_hook) P_ ((void));
-void (*clear_end_of_line_hook) P_ ((int));
-
-void (*ins_del_lines_hook) P_ ((int, int));
-
-void (*delete_glyphs_hook) P_ ((int));
-
-void (*ring_bell_hook) P_ ((void));
-
-void (*reset_terminal_modes_hook) P_ ((void));
-void (*set_terminal_modes_hook) P_ ((void));
-void (*update_begin_hook) P_ ((struct frame *));
-void (*update_end_hook) P_ ((struct frame *));
-void (*set_terminal_window_hook) P_ ((int));
-void (*insert_glyphs_hook) P_ ((struct glyph *, int));
-void (*write_glyphs_hook) P_ ((struct glyph *, int));
-void (*delete_glyphs_hook) P_ ((int));
-
-int (*read_socket_hook) P_ ((int, int, struct input_event *));
-
-void (*frame_up_to_date_hook) P_ ((struct frame *));
-
-/* Return the current position of the mouse.
-
-   Set *f to the frame the mouse is in, or zero if the mouse is in no
-   Emacs frame.  If it is set to zero, all the other arguments are
-   garbage.
-
-   If the motion started in a scroll bar, set *bar_window to the
-   scroll bar's window, *part to the part the mouse is currently over,
-   *x to the position of the mouse along the scroll bar, and *y to the
-   overall length of the scroll bar.
-
-   Otherwise, set *bar_window to Qnil, and *x and *y to the column and
-   row of the character cell the mouse is over.
-
-   Set *time to the time the mouse was at the returned position.
+/* Nonzero means no need to redraw the entire frame on resuming a
+   suspended Emacs.  This is useful on terminals with multiple
+   pages, where one page is used for Emacs and another for all
+   else. */
+int no_redraw_on_reenter;
 
-   This should clear mouse_moved until the next motion
-   event arrives.  */
-
-void (*mouse_position_hook) P_ ((FRAME_PTR *f, int insist,
-                                Lisp_Object *bar_window,
-                                enum scroll_bar_part *part,
-                                Lisp_Object *x,
-                                Lisp_Object *y,
-                                unsigned long *time));
-
-/* When reading from a minibuffer in a different frame, Emacs wants
-   to shift the highlight from the selected frame to the mini-buffer's
-   frame; under X, this means it lies about where the focus is.
-   This hook tells the window system code to re-decide where to put
-   the highlight.  */
-
-void (*frame_rehighlight_hook) P_ ((FRAME_PTR f));
-
-/* If we're displaying frames using a window system that can stack
-   frames on top of each other, this hook allows you to bring a frame
-   to the front, or bury it behind all the other windows.  If this
-   hook is zero, that means the device we're displaying on doesn't
-   support overlapping frames, so there's no need to raise or lower
-   anything.
-
-   If RAISE is non-zero, F is brought to the front, before all other
-   windows.  If RAISE is zero, F is sent to the back, behind all other
-   windows.  */
-
-void (*frame_raise_lower_hook) P_ ((FRAME_PTR f, int raise));
-
-/* Set the vertical scroll bar for WINDOW to have its upper left corner
-   at (TOP, LEFT), and be LENGTH rows high.  Set its handle to
-   indicate that we are displaying PORTION characters out of a total
-   of WHOLE characters, starting at POSITION.  If WINDOW doesn't yet
-   have a scroll bar, create one for it.  */
-
-void (*set_vertical_scroll_bar_hook)
-     P_ ((struct window *window,
-         int portion, int whole, int position));
-
-
-/* The following three hooks are used when we're doing a thorough
-   redisplay of the frame.  We don't explicitly know which scroll bars
-   are going to be deleted, because keeping track of when windows go
-   away is a real pain - can you say set-window-configuration?
-   Instead, we just assert at the beginning of redisplay that *all*
-   scroll bars are to be removed, and then save scroll bars from the
-   fiery pit when we actually redisplay their window.  */
-
-/* Arrange for all scroll bars on FRAME to be removed at the next call
-   to `*judge_scroll_bars_hook'.  A scroll bar may be spared if
-   `*redeem_scroll_bar_hook' is applied to its window before the judgment.
-
-   This should be applied to each frame each time its window tree is
-   redisplayed, even if it is not displaying scroll bars at the moment;
-   if the HAS_SCROLL_BARS flag has just been turned off, only calling
-   this and the judge_scroll_bars_hook will get rid of them.
-
-   If non-zero, this hook should be safe to apply to any frame,
-   whether or not it can support scroll bars, and whether or not it is
-   currently displaying them.  */
-
-void (*condemn_scroll_bars_hook) P_ ((FRAME_PTR frame));
-
-/* Unmark WINDOW's scroll bar for deletion in this judgement cycle.
-   Note that it's okay to redeem a scroll bar that is not condemned.  */
-
-void (*redeem_scroll_bar_hook) P_ ((struct window *window));
-
-/* Remove all scroll bars on FRAME that haven't been saved since the
-   last call to `*condemn_scroll_bars_hook'.
-
-   This should be applied to each frame after each time its window
-   tree is redisplayed, even if it is not displaying scroll bars at the
-   moment; if the HAS_SCROLL_BARS flag has just been turned off, only
-   calling this and condemn_scroll_bars_hook will get rid of them.
-
-   If non-zero, this hook should be safe to apply to any frame,
-   whether or not it can support scroll bars, and whether or not it is
-   currently displaying them.  */
-
-void (*judge_scroll_bars_hook) P_ ((FRAME_PTR FRAME));
-
-/* Strings, numbers and flags taken from the termcap entry.  */
-
-char *TS_ins_line;             /* "al" */
-char *TS_ins_multi_lines;      /* "AL" (one parameter, # lines to insert) */
-char *TS_bell;                 /* "bl" */
-char *TS_clr_to_bottom;                /* "cd" */
-char *TS_clr_line;             /* "ce", clear to end of line */
-char *TS_clr_frame;            /* "cl" */
-char *TS_set_scroll_region;    /* "cs" (2 params, first line and last line) */
-char *TS_set_scroll_region_1;   /* "cS" (4 params: total lines,
-                                  lines above scroll region, lines below it,
-                                  total lines again) */
-char *TS_del_char;             /* "dc" */
-char *TS_del_multi_chars;      /* "DC" (one parameter, # chars to delete) */
-char *TS_del_line;             /* "dl" */
-char *TS_del_multi_lines;      /* "DL" (one parameter, # lines to delete) */
-char *TS_delete_mode;          /* "dm", enter character-delete mode */
-char *TS_end_delete_mode;      /* "ed", leave character-delete mode */
-char *TS_end_insert_mode;      /* "ei", leave character-insert mode */
-char *TS_ins_char;             /* "ic" */
-char *TS_ins_multi_chars;      /* "IC" (one parameter, # chars to insert) */
-char *TS_insert_mode;          /* "im", enter character-insert mode */
-char *TS_pad_inserted_char;    /* "ip".  Just padding, no commands.  */
-char *TS_end_keypad_mode;      /* "ke" */
-char *TS_keypad_mode;          /* "ks" */
-char *TS_pad_char;             /* "pc", char to use as padding */
-char *TS_repeat;               /* "rp" (2 params, # times to repeat
-                                  and character to be repeated) */
-char *TS_end_standout_mode;    /* "se" */
-char *TS_fwd_scroll;           /* "sf" */
-char *TS_standout_mode;                /* "so" */
-char *TS_rev_scroll;           /* "sr" */
-char *TS_end_termcap_modes;    /* "te" */
-char *TS_termcap_modes;                /* "ti" */
-char *TS_visible_bell;         /* "vb" */
-char *TS_cursor_normal;                /* "ve" */
-char *TS_cursor_visible;       /* "vs" */
-char *TS_cursor_invisible;     /* "vi" */
-char *TS_set_window;           /* "wi" (4 params, start and end of window,
-                                  each as vpos and hpos) */
-
-/* Value of the "NC" (no_color_video) capability, or 0 if not
-   present.  */
-
-static int TN_no_color_video;
 
 /* Meaning of bits in no_color_video.  Each bit set means that the
    corresponding attribute cannot be combined with colors.  */
@@ -301,68 +157,6 @@ enum no_color_bit
   NC_ALT_CHARSET = 1 << 8
 };
 
-/* "md" -- turn on bold (extra bright mode).  */
-
-char *TS_enter_bold_mode;
-
-/* "mh" -- turn on half-bright mode.  */
-
-char *TS_enter_dim_mode;
-
-/* "mb" -- enter blinking mode.  */
-
-char *TS_enter_blink_mode;
-
-/* "mr" -- enter reverse video mode.  */
-
-char *TS_enter_reverse_mode;
-
-/* "us"/"ue" -- start/end underlining.  */
-
-char *TS_exit_underline_mode, *TS_enter_underline_mode;
-
-/* "as"/"ae" -- start/end alternate character set.  Not really
-   supported, yet.  */
-
-char *TS_enter_alt_charset_mode, *TS_exit_alt_charset_mode;
-
-/* "me" -- switch appearances off.  */
-
-char *TS_exit_attribute_mode;
-
-/* "Co" -- number of colors.  */
-
-int TN_max_colors;
-
-/* "pa" -- max. number of color pairs on screen.  Not handled yet.
-   Could be a problem if not equal to TN_max_colors * TN_max_colors.  */
-
-int TN_max_pairs;
-
-/* "op" -- SVr4 set default pair to its original value.  */
-
-char *TS_orig_pair;
-
-/* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color.
-   1 param, the color index.  */
-
-char *TS_set_foreground, *TS_set_background;
-
-int TF_hazeltine;      /* termcap hz flag. */
-int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */
-int TF_standout_motion;        /* termcap mi flag: can move while in standout mode. */
-int TF_underscore;     /* termcap ul flag: _ underlines if over-struck on
-                          non-blank position.  Must clear before writing _.  */
-int TF_teleray;                /* termcap xt flag: many weird consequences.
-                          For t1061. */
-
-static int RPov;       /* # chars to start a TS_repeat */
-
-static int delete_in_insert_mode;      /* delete mode == insert mode */
-
-static int se_is_so;   /* 1 if same string both enters and leaves
-                          standout mode */
-
 /* internal state */
 
 /* The largest frame width in any call to calculate_costs.  */
@@ -373,33 +167,17 @@ int max_frame_cols;
 
 int max_frame_lines;
 
-static int costs_set;    /* Nonzero if costs have been calculated. */
-
-int insert_mode;                       /* Nonzero when in insert mode.  */
-int standout_mode;                     /* Nonzero when in standout mode.  */
-
-/* Size of window specified by higher levels.
-   This is the number of lines, from the top of frame downwards,
-   which can participate in insert-line/delete-line operations.
-
-   Effectively it excludes the bottom frame_lines - specified_window_size
-   lines from those operations.  */
+/* Non-zero if we have dropped our controlling tty and therefore
+   should not open a frame on stdout. */
+static int no_controlling_tty;
 
-int specified_window;
-
-/* Frame currently being redisplayed; 0 if not currently redisplaying.
-   (Direct output does not count).  */
-
-FRAME_PTR updating_frame;
+/* The first unallocated display id. */
+static int next_display_id;
 
 /* Provided for lisp packages.  */
 
 static int system_uses_terminfo;
 
-/* Flag used in tty_show/hide_cursor.  */
-
-static int tty_cursor_hidden;
-
 char *tparam ();
 
 extern char *tgetstr ();
@@ -417,7 +195,7 @@ extern char *tgetstr ();
 #endif /* WINDOWSNT */
 
 void
-ring_bell ()
+ring_bell (struct frame *f)
 {
   if (!NILP (Vring_bell_function))
     {
@@ -438,160 +216,191 @@ ring_bell ()
 
       Vring_bell_function = function;
     }
-  else if (!FRAME_TERMCAP_P (XFRAME (selected_frame)))
-    (*ring_bell_hook) ();
-  else
-    OUTPUT (TS_visible_bell && visible_bell ? TS_visible_bell : TS_bell);
+  else if (FRAME_DISPLAY (f)->ring_bell_hook)
+    (*FRAME_DISPLAY (f)->ring_bell_hook) (f);
 }
 
+/* Ring the bell on a tty. */
+
 void
-set_terminal_modes ()
+tty_ring_bell (struct frame *f)
 {
-  if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
+  struct tty_display_info *tty = FRAME_TTY (f);
+
+  if (tty->output)
     {
-      OUTPUT_IF (TS_termcap_modes);
-      OUTPUT_IF (TS_cursor_visible);
-      OUTPUT_IF (TS_keypad_mode);
-      losecursor ();
+      OUTPUT (tty, (tty->TS_visible_bell && visible_bell
+                    ? tty->TS_visible_bell
+                    : tty->TS_bell));
+      fflush (tty->output);
+    }
+}
+
+/* Set up termcap modes for Emacs. */
+
+void
+tty_set_terminal_modes (struct display *display)
+{
+  struct tty_display_info *tty = display->display_info.tty;
+  
+  if (tty->output)
+    {
+      OUTPUT_IF (tty, tty->TS_termcap_modes);
+      OUTPUT_IF (tty, tty->TS_cursor_visible);
+      OUTPUT_IF (tty, tty->TS_keypad_mode);
+      losecursor (tty);
+      fflush (tty->output);
     }
-  else
-    (*set_terminal_modes_hook) ();
 }
 
+/* Reset termcap modes before exiting Emacs. */
+
 void
-reset_terminal_modes ()
+tty_reset_terminal_modes (struct display *display)
 {
-  if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
+  struct tty_display_info *tty = display->display_info.tty;
+
+  if (tty->output)
     {
-      turn_off_highlight ();
-      turn_off_insert ();
-      OUTPUT_IF (TS_end_keypad_mode);
-      OUTPUT_IF (TS_cursor_normal);
-      OUTPUT_IF (TS_end_termcap_modes);
-      OUTPUT_IF (TS_orig_pair);
+      turn_off_highlight (tty);
+      turn_off_insert (tty);
+      OUTPUT_IF (tty, tty->TS_end_keypad_mode);
+      OUTPUT_IF (tty, tty->TS_cursor_normal);
+      OUTPUT_IF (tty, tty->TS_end_termcap_modes);
+      OUTPUT_IF (tty, tty->TS_orig_pair);
       /* Output raw CR so kernel can track the cursor hpos.  */
+      current_tty = tty;
       cmputc ('\r');
+      fflush (tty->output);
     }
-  else if (reset_terminal_modes_hook)
-    (*reset_terminal_modes_hook) ();
 }
 
 void
-update_begin (f)
-     struct frame *f;
+update_begin (struct frame *f)
 {
-  updating_frame = f;
-  if (!FRAME_TERMCAP_P (f))
-    update_begin_hook (f);
+  if (FRAME_DISPLAY (f)->update_begin_hook)
+    (*FRAME_DISPLAY (f)->update_begin_hook) (f);
 }
 
 void
-update_end (f)
-     struct frame *f;
+update_end (struct frame *f)
 {
-  if (FRAME_TERMCAP_P (f))
-    {
-      if (!XWINDOW (selected_window)->cursor_off_p)
-       tty_show_cursor ();
-      turn_off_insert ();
-      background_highlight ();
-    }
-  else
-    update_end_hook (f);
+  if (FRAME_DISPLAY (f)->update_end_hook)
+    (*FRAME_DISPLAY (f)->update_end_hook) (f);
+}
+
+/* Flag the end of a display update on a termcap display. */
+
+void
+tty_update_end (struct frame *f)
+{
+  struct tty_display_info *tty = FRAME_TTY (f);
+
+  if (!XWINDOW (selected_window)->cursor_off_p)
+    tty_show_cursor (tty);
+  turn_off_insert (tty);
+  background_highlight (tty);
+}
+
+/* Specify how many text lines, from the top of the window,
+   should be affected by insert-lines and delete-lines operations.
+   This, and those operations, are used only within an update
+   that is bounded by calls to update_begin and update_end.  */
 
-  updating_frame = NULL;
+void
+set_terminal_window (struct frame *f, int size)
+{
+  if (FRAME_DISPLAY (f)->set_terminal_window_hook)
+    (*FRAME_DISPLAY (f)->set_terminal_window_hook) (f, size);
 }
 
+/* The implementation of set_terminal_window for termcap frames. */
+
 void
-set_terminal_window (size)
-     int size;
+tty_set_terminal_window (struct frame *f, int size)
 {
-  if (FRAME_TERMCAP_P (updating_frame))
-    {
-      specified_window = size ? size : FRAME_LINES (updating_frame);
-      if (scroll_region_ok)
-       set_scroll_region (0, specified_window);
-    }
-  else
-    set_terminal_window_hook (size);
+  struct tty_display_info *tty = FRAME_TTY (f);
+
+  tty->specified_window = size ? size : FRAME_LINES (f);
+  if (FRAME_SCROLL_REGION_OK (f))
+    set_scroll_region (f, 0, tty->specified_window);
 }
 
 void
-set_scroll_region (start, stop)
-     int start, stop;
+set_scroll_region (struct frame *f, int start, int stop)
 {
   char *buf;
-  struct frame *sf = XFRAME (selected_frame);
-
-  if (TS_set_scroll_region)
-    buf = tparam (TS_set_scroll_region, 0, 0, start, stop - 1);
-  else if (TS_set_scroll_region_1)
-    buf = tparam (TS_set_scroll_region_1, 0, 0,
-                 FRAME_LINES (sf), start,
-                 FRAME_LINES (sf) - stop,
-                 FRAME_LINES (sf));
+  struct tty_display_info *tty = FRAME_TTY (f);
+
+  if (tty->TS_set_scroll_region)
+    buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1);
+  else if (tty->TS_set_scroll_region_1)
+    buf = tparam (tty->TS_set_scroll_region_1, 0, 0,
+                 FRAME_LINES (f), start,
+                 FRAME_LINES (f) - stop,
+                 FRAME_LINES (f));
   else
-    buf = tparam (TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (sf));
+    buf = tparam (tty->TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f));
 
-  OUTPUT (buf);
+  OUTPUT (tty, buf);
   xfree (buf);
-  losecursor ();
+  losecursor (tty);
 }
 
 \f
 static void
-turn_on_insert ()
+turn_on_insert (struct tty_display_info *tty)
 {
-  if (!insert_mode)
-    OUTPUT (TS_insert_mode);
-  insert_mode = 1;
+  if (!tty->insert_mode)
+    OUTPUT (tty, tty->TS_insert_mode);
+  tty->insert_mode = 1;
 }
 
 void
-turn_off_insert ()
+turn_off_insert (struct tty_display_info *tty)
 {
-  if (insert_mode)
-    OUTPUT (TS_end_insert_mode);
-  insert_mode = 0;
+  if (tty->insert_mode)
+    OUTPUT (tty, tty->TS_end_insert_mode);
+  tty->insert_mode = 0;
 }
 \f
 /* Handle highlighting.  */
 
 void
-turn_off_highlight ()
+turn_off_highlight (struct tty_display_info *tty)
 {
-  if (standout_mode)
-    OUTPUT_IF (TS_end_standout_mode);
-  standout_mode = 0;
+  if (tty->standout_mode)
+    OUTPUT_IF (tty, tty->TS_end_standout_mode);
+  tty->standout_mode = 0;
 }
 
 static void
-turn_on_highlight ()
+turn_on_highlight (struct tty_display_info *tty)
 {
-  if (!standout_mode)
-    OUTPUT_IF (TS_standout_mode);
-  standout_mode = 1;
+  if (!tty->standout_mode)
+    OUTPUT_IF (tty, tty->TS_standout_mode);
+  tty->standout_mode = 1;
 }
 
 static void
-toggle_highlight ()
+toggle_highlight (struct tty_display_info *tty)
 {
-  if (standout_mode)
-    turn_off_highlight ();
+  if (tty->standout_mode)
+    turn_off_highlight (tty);
   else
-    turn_on_highlight ();
+    turn_on_highlight (tty);
 }
 
 
 /* Make cursor invisible.  */
 
 static void
-tty_hide_cursor ()
+tty_hide_cursor (struct tty_display_info *tty)
 {
-  if (tty_cursor_hidden == 0)
+  if (tty->cursor_hidden == 0)
     {
-      tty_cursor_hidden = 1;
-      OUTPUT_IF (TS_cursor_invisible);
+      tty->cursor_hidden = 1;
+      OUTPUT_IF (tty, tty->TS_cursor_invisible);
     }
 }
 
@@ -599,13 +408,13 @@ tty_hide_cursor ()
 /* Ensure that cursor is visible.  */
 
 static void
-tty_show_cursor ()
+tty_show_cursor (struct tty_display_info *tty)
 {
-  if (tty_cursor_hidden)
+  if (tty->cursor_hidden)
     {
-      tty_cursor_hidden = 0;
-      OUTPUT_IF (TS_cursor_normal);
-      OUTPUT_IF (TS_cursor_visible);
+      tty->cursor_hidden = 0;
+      OUTPUT_IF (tty, tty->TS_cursor_normal);
+      OUTPUT_IF (tty, tty->TS_cursor_visible);
     }
 }
 
@@ -615,23 +424,23 @@ tty_show_cursor ()
    depends on the user option inverse-video.  */
 
 void
-background_highlight ()
+background_highlight (struct tty_display_info *tty)
 {
   if (inverse_video)
-    turn_on_highlight ();
+    turn_on_highlight (tty);
   else
-    turn_off_highlight ();
+    turn_off_highlight (tty);
 }
 
 /* Set standout mode to the mode specified for the text to be output.  */
 
 static void
-highlight_if_desired ()
+highlight_if_desired (struct tty_display_info *tty)
 {
   if (inverse_video)
-    turn_on_highlight ();
+    turn_on_highlight (tty);
   else
-    turn_off_highlight ();
+    turn_off_highlight (tty);
 }
 \f
 
@@ -639,76 +448,85 @@ highlight_if_desired ()
    frame-relative coordinates.  */
 
 void
-cursor_to (vpos, hpos)
-     int vpos, hpos;
+cursor_to (struct frame *f, int vpos, int hpos)
 {
-  struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame);
+  if (FRAME_DISPLAY (f)->cursor_to_hook)
+    (*FRAME_DISPLAY (f)->cursor_to_hook) (f, vpos, hpos);
+}
 
-  if (! FRAME_TERMCAP_P (f) && cursor_to_hook)
-    {
-      (*cursor_to_hook) (vpos, hpos);
-      return;
-    }
+void
+tty_cursor_to (struct frame *f, int vpos, int hpos)
+{
+  struct tty_display_info *tty = FRAME_TTY (f);
 
   /* Detect the case where we are called from reset_sys_modes
      and the costs have never been calculated.  Do nothing.  */
-  if (! costs_set)
+  if (! tty->costs_set)
     return;
 
-  if (curY == vpos && curX == hpos)
+  if (curY (tty) == vpos
+      && curX (tty) == hpos)
     return;
-  if (!TF_standout_motion)
-    background_highlight ();
-  if (!TF_insmode_motion)
-    turn_off_insert ();
-  cmgoto (vpos, hpos);
+  if (!tty->TF_standout_motion)
+    background_highlight (tty);
+  if (!tty->TF_insmode_motion)
+    turn_off_insert (tty);
+  cmgoto (tty, vpos, hpos);
 }
 
 /* Similar but don't take any account of the wasted characters.  */
 
 void
-raw_cursor_to (row, col)
-     int row, col;
+raw_cursor_to (struct frame *f, int row, int col)
 {
-  struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame);
-  if (! FRAME_TERMCAP_P (f))
-    {
-      (*raw_cursor_to_hook) (row, col);
-      return;
-    }
-  if (curY == row && curX == col)
+  if (FRAME_DISPLAY (f)->raw_cursor_to_hook)
+    (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (f, row, col);  
+}
+
+void
+tty_raw_cursor_to (struct frame *f, int row, int col)
+{
+  struct tty_display_info *tty = FRAME_TTY (f);
+
+  if (curY (tty) == row
+      && curX (tty) == col)
     return;
-  if (!TF_standout_motion)
-    background_highlight ();
-  if (!TF_insmode_motion)
-    turn_off_insert ();
-  cmgoto (row, col);
+  if (!tty->TF_standout_motion)
+    background_highlight (tty);
+  if (!tty->TF_insmode_motion)
+    turn_off_insert (tty);
+  cmgoto (tty, row, col);
 }
 \f
 /* Erase operations */
 
-/* clear from cursor to end of frame */
+/* Clear from cursor to end of frame. */
+void
+clear_to_end (struct frame *f)
+{
+  if (FRAME_DISPLAY (f)->clear_to_end_hook)
+    (*FRAME_DISPLAY (f)->clear_to_end_hook) (f);
+}
+
+/* Clear from cursor to end of frame on a termcap device. */
+
 void
-clear_to_end ()
+tty_clear_to_end (struct frame *f)
 {
   register int i;
+  struct tty_display_info *tty = FRAME_TTY (f);
 
-  if (clear_to_end_hook && ! FRAME_TERMCAP_P (updating_frame))
-    {
-      (*clear_to_end_hook) ();
-      return;
-    }
-  if (TS_clr_to_bottom)
+  if (tty->TS_clr_to_bottom)
     {
-      background_highlight ();
-      OUTPUT (TS_clr_to_bottom);
+      background_highlight (tty);
+      OUTPUT (tty, tty->TS_clr_to_bottom);
     }
   else
     {
-      for (i = curY; i < FRAME_LINES (XFRAME (selected_frame)); i++)
+      for (i = curY (tty); i < FRAME_LINES (f); i++)
        {
-         cursor_to (i, 0);
-         clear_end_of_line (FRAME_COLS (XFRAME (selected_frame)));
+         cursor_to (f, i, 0);
+         clear_end_of_line (f, FRAME_COLS (f));
        }
     }
 }
@@ -716,26 +534,29 @@ clear_to_end ()
 /* Clear entire frame */
 
 void
-clear_frame ()
+clear_frame (struct frame *f)
 {
-  struct frame *sf = XFRAME (selected_frame);
+  if (FRAME_DISPLAY (f)->clear_frame_hook)
+    (*FRAME_DISPLAY (f)->clear_frame_hook) (f);
+}
 
-  if (clear_frame_hook
-      && ! FRAME_TERMCAP_P ((updating_frame ? updating_frame : sf)))
-    {
-      (*clear_frame_hook) ();
-      return;
-    }
-  if (TS_clr_frame)
+/* Clear an entire termcap frame. */
+
+void
+tty_clear_frame (struct frame *f)
+{
+  struct tty_display_info *tty = FRAME_TTY (f);
+
+  if (tty->TS_clr_frame)
     {
-      background_highlight ();
-      OUTPUT (TS_clr_frame);
-      cmat (0, 0);
+      background_highlight (tty);
+      OUTPUT (tty, tty->TS_clr_frame);
+      cmat (tty, 0, 0);
     }
   else
     {
-      cursor_to (0, 0);
-      clear_to_end ();
+      cursor_to (f, 0, 0);
+      clear_to_end (f);
     }
 }
 
@@ -745,49 +566,51 @@ clear_frame ()
    Note that the cursor may be moved, on terminals lacking a `ce' string.  */
 
 void
-clear_end_of_line (first_unused_hpos)
-     int first_unused_hpos;
+clear_end_of_line (struct frame *f, int first_unused_hpos)
 {
-  register int i;
+  if (FRAME_DISPLAY (f)->clear_end_of_line_hook)
+    (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (f, first_unused_hpos);
+}
 
-  if (clear_end_of_line_hook
-      && ! FRAME_TERMCAP_P ((updating_frame
-                              ? updating_frame
-                            : XFRAME (selected_frame))))
-    {
-      (*clear_end_of_line_hook) (first_unused_hpos);
-      return;
-    }
+/* An implementation of clear_end_of_line for termcap frames.
+
+   Note that the cursor may be moved, on terminals lacking a `ce' string.  */
+
+void
+tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
+{
+  register int i;
+  struct tty_display_info *tty = FRAME_TTY (f);
 
   /* Detect the case where we are called from reset_sys_modes
      and the costs have never been calculated.  Do nothing.  */
-  if (! costs_set)
+  if (! tty->costs_set)
     return;
 
-  if (curX >= first_unused_hpos)
+  if (curX (tty) >= first_unused_hpos)
     return;
-  background_highlight ();
-  if (TS_clr_line)
+  background_highlight (tty);
+  if (tty->TS_clr_line)
     {
-      OUTPUT1 (TS_clr_line);
+      OUTPUT1 (tty, tty->TS_clr_line);
     }
   else
     {                  /* have to do it the hard way */
-      struct frame *sf = XFRAME (selected_frame);
-      turn_off_insert ();
+      turn_off_insert (tty);
 
       /* Do not write in last row last col with Auto-wrap on. */
-      if (AutoWrap && curY == FRAME_LINES (sf) - 1
-         && first_unused_hpos == FRAME_COLS (sf))
+      if (AutoWrap (tty)
+          && curY (tty) == FrameRows (tty) - 1
+         && first_unused_hpos == FrameCols (tty))
        first_unused_hpos--;
 
-      for (i = curX; i < first_unused_hpos; i++)
+      for (i = curX (tty); i < first_unused_hpos; i++)
        {
-         if (termscript)
-           fputc (' ', termscript);
-         putchar (' ');
+         if (tty->termscript)
+           fputc (' ', tty->termscript);
+         fputc (' ', tty->output);
        }
-      cmplus (first_unused_hpos - curX);
+      cmplus (tty, first_unused_hpos - curX (tty));
     }
 }
 \f
@@ -909,43 +732,47 @@ encode_terminal_code (src, src_len, coding)
   return encode_terminal_buf + nbytes;
 }
 
+
+/* Output LEN glyphs starting at STRING at the nominal cursor position.
+   Advance the nominal cursor over the text.  */
+
 void
-write_glyphs (string, len)
-     register struct glyph *string;
-     register int len;
+write_glyphs (struct frame *f, struct glyph *string, int len)
+{
+  if (FRAME_DISPLAY (f)->write_glyphs_hook)
+    (*FRAME_DISPLAY (f)->write_glyphs_hook) (f, string, len);
+}
+
+/* An implementation of write_glyphs for termcap frames. */
+
+void
+tty_write_glyphs (struct frame *f, struct glyph *string, int len)
 {
-  struct frame *sf = XFRAME (selected_frame);
-  struct frame *f = updating_frame ? updating_frame : sf;
   unsigned char *conversion_buffer;
   struct coding_system *coding;
 
-  if (write_glyphs_hook
-      && ! FRAME_TERMCAP_P (f))
-    {
-      (*write_glyphs_hook) (string, len);
-      return;
-    }
+  struct tty_display_info *tty = FRAME_TTY (f);
 
-  turn_off_insert ();
-  tty_hide_cursor ();
+  turn_off_insert (tty);
+  tty_hide_cursor (tty);
 
   /* Don't dare write in last column of bottom line, if Auto-Wrap,
      since that would scroll the whole frame on some terminals.  */
 
-  if (AutoWrap
-      && curY + 1 == FRAME_LINES (sf)
-      && (curX + len) == FRAME_COLS (sf))
+  if (AutoWrap (tty)
+      && curY (tty) + 1 == FRAME_LINES (f)
+      && (curX (tty) + len) == FRAME_COLS (f))
     len --;
   if (len <= 0)
     return;
 
-  cmplus (len);
+  cmplus (tty, len);
 
   /* If terminal_coding does any conversion, use it, otherwise use
      safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
      because it always return 1 if the member src_multibyte is 1.  */
-  coding = (terminal_coding.common_flags & CODING_REQUIRE_ENCODING_MASK
-           ? &terminal_coding : &safe_terminal_coding);
+  coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
+           ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
   /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
      the tail.  */
   coding->mode &= ~CODING_MODE_LAST_BLOCK;
@@ -961,7 +788,7 @@ write_glyphs (string, len)
          break;
 
       /* Turn appearance modes of the face of the run on.  */
-      highlight_if_desired ();
+      highlight_if_desired (tty);
       turn_on_face (f, face_id);
 
       if (n == len)
@@ -970,61 +797,62 @@ write_glyphs (string, len)
       conversion_buffer = encode_terminal_code (string, n, coding);
       if (coding->produced > 0)
        {
-         fwrite (conversion_buffer, 1, coding->produced, stdout);
-         if (ferror (stdout))
-           clearerr (stdout);
-         if (termscript)
-           fwrite (conversion_buffer, 1, coding->produced, termscript);
+         fwrite (conversion_buffer, 1, coding->produced, tty->output);
+         if (ferror (tty->output))
+           clearerr (tty->output);
+         if (tty->termscript)
+           fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
        }
       len -= n;
       string += n;
 
       /* Turn appearance modes off.  */
       turn_off_face (f, face_id);
-      turn_off_highlight ();
+      turn_off_highlight (tty);
     }
 
-  cmcheckmagic ();
+  cmcheckmagic (tty);
+}
+
+/* Insert LEN glyphs from START at the nominal cursor position.
+
+   If start is zero, insert blanks instead of a string at start */
+
+void
+insert_glyphs (struct frame *f, struct glyph *start, int len)
+{
+  if (len <= 0)
+    return;
+
+  if (FRAME_DISPLAY (f)->insert_glyphs_hook)
+    (*FRAME_DISPLAY (f)->insert_glyphs_hook) (f, start, len);
 }
 
-/* If start is zero, insert blanks instead of a string at start */
+/* An implementation of insert_glyphs for termcap frames. */
 
 void
-insert_glyphs (start, len)
-     register struct glyph *start;
-     register int len;
+tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
 {
   char *buf;
   struct glyph *glyph = NULL;
-  struct frame *f, *sf;
   unsigned char *conversion_buffer;
   unsigned char space[1];
   struct coding_system *coding;
 
-  if (len <= 0)
-    return;
-
-  if (insert_glyphs_hook)
-    {
-      (*insert_glyphs_hook) (start, len);
-      return;
-    }
-
-  sf = XFRAME (selected_frame);
-  f = updating_frame ? updating_frame : sf;
+  struct tty_display_info *tty = FRAME_TTY (f);
 
-  if (TS_ins_multi_chars)
+  if (tty->TS_ins_multi_chars)
     {
-      buf = tparam (TS_ins_multi_chars, 0, 0, len);
-      OUTPUT1 (buf);
+      buf = tparam (tty->TS_ins_multi_chars, 0, 0, len);
+      OUTPUT1 (tty, buf);
       xfree (buf);
       if (start)
-       write_glyphs (start, len);
+       write_glyphs (f, start, len);
       return;
     }
 
-  turn_on_insert ();
-  cmplus (len);
+  turn_on_insert (tty);
+  cmplus (tty, len);
 
   if (! start)
     space[0] = SPACEGLYPH;
@@ -1032,15 +860,15 @@ insert_glyphs (start, len)
   /* If terminal_coding does any conversion, use it, otherwise use
      safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
      because it always return 1 if the member src_multibyte is 1.  */
-  coding = (terminal_coding.common_flags & CODING_REQUIRE_ENCODING_MASK
-           ? &terminal_coding : &safe_terminal_coding);
+  coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
+           ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
   /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
      the tail.  */
   coding->mode &= ~CODING_MODE_LAST_BLOCK;
 
   while (len-- > 0)
     {
-      OUTPUT1_IF (TS_ins_char);
+      OUTPUT1_IF (tty, tty->TS_ins_char);
       if (!start)
        {
          conversion_buffer = space;
@@ -1048,7 +876,7 @@ insert_glyphs (start, len)
        }
       else
        {
-         highlight_if_desired ();
+         highlight_if_desired (tty);
          turn_on_face (f, start->face_id);
          glyph = start;
          ++start;
@@ -1056,7 +884,7 @@ insert_glyphs (start, len)
             occupies more than one column.  */
          while (len && CHAR_GLYPH_PADDING_P (*start))
            {
-             OUTPUT1_IF (TS_ins_char);
+             OUTPUT1_IF (tty, tty->TS_ins_char);
              start++, len--;
            }
 
@@ -1064,86 +892,92 @@ insert_glyphs (start, len)
            /* This is the last glyph.  */
            coding->mode |= CODING_MODE_LAST_BLOCK;
 
-         conversion_buffer = encode_terminal_code (glyph, 1, coding);
+          conversion_buffer = encode_terminal_code (glyph, 1, coding);
        }
 
       if (coding->produced > 0)
        {
-         fwrite (conversion_buffer, 1, coding->produced, stdout);
-         if (ferror (stdout))
-           clearerr (stdout);
-         if (termscript)
-           fwrite (conversion_buffer, 1, coding->produced, termscript);
+         fwrite (conversion_buffer, 1, coding->produced, tty->output);
+         if (ferror (tty->output))
+           clearerr (tty->output);
+         if (tty->termscript)
+           fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
        }
 
-      OUTPUT1_IF (TS_pad_inserted_char);
+      OUTPUT1_IF (tty, tty->TS_pad_inserted_char);
       if (start)
        {
          turn_off_face (f, glyph->face_id);
-         turn_off_highlight ();
+         turn_off_highlight (tty);
        }
     }
 
-  cmcheckmagic ();
+  cmcheckmagic (tty);
+}
+
+/* Delete N glyphs at the nominal cursor position. */
+
+void
+delete_glyphs (struct frame *f, int n)
+{
+  if (FRAME_DISPLAY (f)->delete_glyphs_hook)
+    (*FRAME_DISPLAY (f)->delete_glyphs_hook) (f, n);
 }
 
+/* An implementation of delete_glyphs for termcap frames. */
+
 void
-delete_glyphs (n)
-     register int n;
+tty_delete_glyphs (struct frame *f, int n)
 {
   char *buf;
   register int i;
 
-  if (delete_glyphs_hook && ! FRAME_TERMCAP_P (updating_frame))
-    {
-      (*delete_glyphs_hook) (n);
-      return;
-    }
+  struct tty_display_info *tty = FRAME_TTY (f);
 
-  if (delete_in_insert_mode)
+  if (tty->delete_in_insert_mode)
     {
-      turn_on_insert ();
+      turn_on_insert (tty);
     }
   else
     {
-      turn_off_insert ();
-      OUTPUT_IF (TS_delete_mode);
+      turn_off_insert (tty);
+      OUTPUT_IF (tty, tty->TS_delete_mode);
     }
 
-  if (TS_del_multi_chars)
+  if (tty->TS_del_multi_chars)
     {
-      buf = tparam (TS_del_multi_chars, 0, 0, n);
-      OUTPUT1 (buf);
+      buf = tparam (tty->TS_del_multi_chars, 0, 0, n);
+      OUTPUT1 (tty, buf);
       xfree (buf);
     }
   else
     for (i = 0; i < n; i++)
-      OUTPUT1 (TS_del_char);
-  if (!delete_in_insert_mode)
-    OUTPUT_IF (TS_end_delete_mode);
+      OUTPUT1 (tty, tty->TS_del_char);
+  if (!tty->delete_in_insert_mode)
+    OUTPUT_IF (tty, tty->TS_end_delete_mode);
 }
 \f
 /* Insert N lines at vpos VPOS.  If N is negative, delete -N lines.  */
 
 void
-ins_del_lines (vpos, n)
-     int vpos, n;
+ins_del_lines (struct frame *f, int vpos, int n)
 {
-  char *multi = n > 0 ? TS_ins_multi_lines : TS_del_multi_lines;
-  char *single = n > 0 ? TS_ins_line : TS_del_line;
-  char *scroll = n > 0 ? TS_rev_scroll : TS_fwd_scroll;
-  struct frame *sf;
+  if (FRAME_DISPLAY (f)->ins_del_lines_hook)
+    (*FRAME_DISPLAY (f)->ins_del_lines_hook) (f, vpos, n);
+}
 
-  register int i = n > 0 ? n : -n;
-  register char *buf;
+/* An implementation of ins_del_lines for termcap frames. */
 
-  if (ins_del_lines_hook && ! FRAME_TERMCAP_P (updating_frame))
-    {
-      (*ins_del_lines_hook) (vpos, n);
-      return;
-    }
+void
+tty_ins_del_lines (struct frame *f, int vpos, int n)
+{
+  struct tty_display_info *tty = FRAME_TTY (f);
+  char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
+  char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
+  char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
 
-  sf = XFRAME (selected_frame);
+  register int i = n > 0 ? n : -n;
+  register char *buf;
 
   /* If the lines below the insertion are being pushed
      into the end of the window, this is the same as clearing;
@@ -1152,45 +986,49 @@ ins_del_lines (vpos, n)
   /* If the lines below the deletion are blank lines coming
      out of the end of the window, don't bother,
      as there will be a matching inslines later that will flush them. */
-  if (scroll_region_ok && vpos + i >= specified_window)
+  if (FRAME_SCROLL_REGION_OK (f)
+      && vpos + i >= tty->specified_window)
     return;
-  if (!memory_below_frame && vpos + i >= FRAME_LINES (sf))
+  if (!FRAME_MEMORY_BELOW_FRAME (f)
+      && vpos + i >= FRAME_LINES (f))
     return;
-
+  
   if (multi)
     {
-      raw_cursor_to (vpos, 0);
-      background_highlight ();
+      raw_cursor_to (f, vpos, 0);
+      background_highlight (tty);
       buf = tparam (multi, 0, 0, i);
-      OUTPUT (buf);
+      OUTPUT (tty, buf);
       xfree (buf);
     }
   else if (single)
     {
-      raw_cursor_to (vpos, 0);
-      background_highlight ();
+      raw_cursor_to (f, vpos, 0);
+      background_highlight (tty);
       while (--i >= 0)
-       OUTPUT (single);
-      if (TF_teleray)
-       curX = 0;
+        OUTPUT (tty, single);
+      if (tty->TF_teleray)
+        curX (tty) = 0;
     }
   else
     {
-      set_scroll_region (vpos, specified_window);
+      set_scroll_region (f, vpos, tty->specified_window);
       if (n < 0)
-       raw_cursor_to (specified_window - 1, 0);
+        raw_cursor_to (f, tty->specified_window - 1, 0);
       else
-       raw_cursor_to (vpos, 0);
-      background_highlight ();
+        raw_cursor_to (f, vpos, 0);
+      background_highlight (tty);
       while (--i >= 0)
-       OUTPUTL (scroll, specified_window - vpos);
-      set_scroll_region (0, specified_window);
+        OUTPUTL (tty, scroll, tty->specified_window - vpos);
+      set_scroll_region (f, 0, tty->specified_window);
     }
-
-  if (!scroll_region_ok && memory_below_frame && n < 0)
+  
+  if (!FRAME_SCROLL_REGION_OK (f)
+      && FRAME_MEMORY_BELOW_FRAME (f)
+      && n < 0)
     {
-      cursor_to (FRAME_LINES (sf) + n, 0);
-      clear_to_end ();
+      cursor_to (f, FRAME_LINES (f) + n, 0);
+      clear_to_end (f);
     }
 }
 \f
@@ -1198,8 +1036,7 @@ ins_del_lines (vpos, n)
    not counting any line-dependent padding.  */
 
 int
-string_cost (str)
-     char *str;
+string_cost (char *str)
 {
   cost = 0;
   if (str)
@@ -1211,8 +1048,7 @@ string_cost (str)
    counting any line-dependent padding at one line.  */
 
 static int
-string_cost_one_line (str)
-     char *str;
+string_cost_one_line (char *str)
 {
   cost = 0;
   if (str)
@@ -1224,8 +1060,7 @@ string_cost_one_line (str)
    in tenths of characters.  */
 
 int
-per_line_cost (str)
-     register char *str;
+per_line_cost (char *str)
 {
   cost = 0;
   if (str)
@@ -1248,26 +1083,26 @@ int *char_ins_del_vector;
 
 /* ARGSUSED */
 static void
-calculate_ins_del_char_costs (frame)
-     FRAME_PTR frame;
+calculate_ins_del_char_costs (struct frame *f)
 {
+  struct tty_display_info *tty = FRAME_TTY (f);
   int ins_startup_cost, del_startup_cost;
   int ins_cost_per_char, del_cost_per_char;
   register int i;
   register int *p;
 
-  if (TS_ins_multi_chars)
+  if (tty->TS_ins_multi_chars)
     {
       ins_cost_per_char = 0;
-      ins_startup_cost = string_cost_one_line (TS_ins_multi_chars);
+      ins_startup_cost = string_cost_one_line (tty->TS_ins_multi_chars);
     }
-  else if (TS_ins_char || TS_pad_inserted_char
-          || (TS_insert_mode && TS_end_insert_mode))
+  else if (tty->TS_ins_char || tty->TS_pad_inserted_char
+          || (tty->TS_insert_mode && tty->TS_end_insert_mode))
     {
-      ins_startup_cost = (30 * (string_cost (TS_insert_mode)
-                               + string_cost (TS_end_insert_mode))) / 100;
-      ins_cost_per_char = (string_cost_one_line (TS_ins_char)
-                          + string_cost_one_line (TS_pad_inserted_char));
+      ins_startup_cost = (30 * (string_cost (tty->TS_insert_mode)
+                               + string_cost (tty->TS_end_insert_mode))) / 100;
+      ins_cost_per_char = (string_cost_one_line (tty->TS_ins_char)
+                          + string_cost_one_line (tty->TS_pad_inserted_char));
     }
   else
     {
@@ -1275,18 +1110,18 @@ calculate_ins_del_char_costs (frame)
       ins_cost_per_char = 0;
     }
 
-  if (TS_del_multi_chars)
+  if (tty->TS_del_multi_chars)
     {
       del_cost_per_char = 0;
-      del_startup_cost = string_cost_one_line (TS_del_multi_chars);
+      del_startup_cost = string_cost_one_line (tty->TS_del_multi_chars);
     }
-  else if (TS_del_char)
+  else if (tty->TS_del_char)
     {
-      del_startup_cost = (string_cost (TS_delete_mode)
-                         + string_cost (TS_end_delete_mode));
-      if (delete_in_insert_mode)
+      del_startup_cost = (string_cost (tty->TS_delete_mode)
+                         + string_cost (tty->TS_end_delete_mode));
+      if (tty->delete_in_insert_mode)
        del_startup_cost /= 2;
-      del_cost_per_char = string_cost_one_line (TS_del_char);
+      del_cost_per_char = string_cost_one_line (tty->TS_del_char);
     }
   else
     {
@@ -1295,75 +1130,80 @@ calculate_ins_del_char_costs (frame)
     }
 
   /* Delete costs are at negative offsets */
-  p = &char_ins_del_cost (frame)[0];
-  for (i = FRAME_COLS (frame); --i >= 0;)
+  p = &char_ins_del_cost (f)[0];
+  for (i = FRAME_COLS (f); --i >= 0;)
     *--p = (del_startup_cost += del_cost_per_char);
 
   /* Doing nothing is free */
-  p = &char_ins_del_cost (frame)[0];
+  p = &char_ins_del_cost (f)[0];
   *p++ = 0;
 
   /* Insert costs are at positive offsets */
-  for (i = FRAME_COLS (frame); --i >= 0;)
+  for (i = FRAME_COLS (f); --i >= 0;)
     *p++ = (ins_startup_cost += ins_cost_per_char);
 }
 
 void
-calculate_costs (frame)
-     FRAME_PTR frame;
+calculate_costs (struct frame *frame)
 {
-  register char *f = (TS_set_scroll_region
-                     ? TS_set_scroll_region
-                     : TS_set_scroll_region_1);
-
   FRAME_COST_BAUD_RATE (frame) = baud_rate;
 
-  scroll_region_cost = string_cost (f);
+  if (FRAME_TERMCAP_P (frame))
+    {
+      struct tty_display_info *tty = FRAME_TTY (frame);
+      register char *f = (tty->TS_set_scroll_region
+                          ? tty->TS_set_scroll_region
+                          : tty->TS_set_scroll_region_1);
 
-  /* These variables are only used for terminal stuff.  They are allocated
-     once for the terminal frame of X-windows emacs, but not used afterwards.
+      FRAME_SCROLL_REGION_COST (frame) = string_cost (f);
 
-     char_ins_del_vector (i.e., char_ins_del_cost) isn't used because
-     X turns off char_ins_del_ok. */
+      tty->costs_set = 1;
 
-  max_frame_lines = max (max_frame_lines, FRAME_LINES (frame));
-  max_frame_cols = max (max_frame_cols, FRAME_COLS (frame));
+      /* These variables are only used for terminal stuff.  They are
+         allocated once for the terminal frame of X-windows emacs, but not
+         used afterwards.
 
-  costs_set = 1;
+         char_ins_del_vector (i.e., char_ins_del_cost) isn't used because
+         X turns off char_ins_del_ok. */
 
-  if (char_ins_del_vector != 0)
-    char_ins_del_vector
-      = (int *) xrealloc (char_ins_del_vector,
-                         (sizeof (int)
-                          + 2 * max_frame_cols * sizeof (int)));
-  else
-    char_ins_del_vector
-      = (int *) xmalloc (sizeof (int)
-                        + 2 * max_frame_cols * sizeof (int));
-
-  bzero (char_ins_del_vector, (sizeof (int)
-                              + 2 * max_frame_cols * sizeof (int)));
-
-  if (f && (!TS_ins_line && !TS_del_line))
-    do_line_insertion_deletion_costs (frame,
-                                     TS_rev_scroll, TS_ins_multi_lines,
-                                     TS_fwd_scroll, TS_del_multi_lines,
-                                     f, f, 1);
-  else
-    do_line_insertion_deletion_costs (frame,
-                                     TS_ins_line, TS_ins_multi_lines,
-                                     TS_del_line, TS_del_multi_lines,
-                                     0, 0, 1);
+      max_frame_lines = max (max_frame_lines, FRAME_LINES (frame));
+      max_frame_cols = max (max_frame_cols, FRAME_COLS (frame));
 
-  calculate_ins_del_char_costs (frame);
+      if (char_ins_del_vector != 0)
+        char_ins_del_vector
+          = (int *) xrealloc (char_ins_del_vector,
+                              (sizeof (int)
+                               + 2 * max_frame_cols * sizeof (int)));
+      else
+        char_ins_del_vector
+          = (int *) xmalloc (sizeof (int)
+                             + 2 * max_frame_cols * sizeof (int));
 
-  /* Don't use TS_repeat if its padding is worse than sending the chars */
-  if (TS_repeat && per_line_cost (TS_repeat) * baud_rate < 9000)
-    RPov = string_cost (TS_repeat);
-  else
-    RPov = FRAME_COLS (frame) * 2;
+      bzero (char_ins_del_vector, (sizeof (int)
+                                   + 2 * max_frame_cols * sizeof (int)));
+
+
+      if (f && (!tty->TS_ins_line && !tty->TS_del_line))
+        do_line_insertion_deletion_costs (frame,
+                                          tty->TS_rev_scroll, tty->TS_ins_multi_lines,
+                                          tty->TS_fwd_scroll, tty->TS_del_multi_lines,
+                                          f, f, 1);
+      else
+        do_line_insertion_deletion_costs (frame,
+                                          tty->TS_ins_line, tty->TS_ins_multi_lines,
+                                          tty->TS_del_line, tty->TS_del_multi_lines,
+                                          0, 0, 1);
+
+      calculate_ins_del_char_costs (frame);
+
+      /* Don't use TS_repeat if its padding is worse than sending the chars */
+      if (tty->TS_repeat && per_line_cost (tty->TS_repeat) * baud_rate < 9000)
+        tty->RPov = string_cost (tty->TS_repeat);
+      else
+        tty->RPov = FRAME_COLS (frame) * 2;
 
-  cmcostinit ();               /* set up cursor motion costs */
+      cmcostinit (FRAME_TTY (frame)); /* set up cursor motion costs */
+    }
 }
 \f
 struct fkey_table {
@@ -1473,7 +1313,8 @@ static struct fkey_table keys[] =
   {"!3", "S-undo"}       /*shifted undo key*/
   };
 
-static char **term_get_fkeys_arg;
+static char **term_get_fkeys_address;
+static KBOARD *term_get_fkeys_kboard;
 static Lisp_Object term_get_fkeys_1 ();
 
 /* Find the escape codes sent by the function keys for Vfunction_key_map.
@@ -1481,8 +1322,9 @@ static Lisp_Object term_get_fkeys_1 ();
    adds entries to Vfunction_key_map for each function key it finds.  */
 
 void
-term_get_fkeys (address)
+term_get_fkeys (address, kboard)
      char **address;
+     KBOARD *kboard;
 {
   /* We run the body of the function (term_get_fkeys_1) and ignore all Lisp
      errors during the call.  The only errors should be from Fdefine_key
@@ -1493,7 +1335,8 @@ term_get_fkeys (address)
      refusing to run at all on such a terminal.  */
 
   extern Lisp_Object Fidentity ();
-  term_get_fkeys_arg = address;
+  term_get_fkeys_address = address;
+  term_get_fkeys_kboard = kboard;
   internal_condition_case (term_get_fkeys_1, Qerror, Fidentity);
 }
 
@@ -1502,17 +1345,18 @@ term_get_fkeys_1 ()
 {
   int i;
 
-  char **address = term_get_fkeys_arg;
-
+  char **address = term_get_fkeys_address;
+  KBOARD *kboard = term_get_fkeys_kboard;
+  
   /* This can happen if CANNOT_DUMP or with strange options.  */
   if (!initialized)
-    Vfunction_key_map = Fmake_sparse_keymap (Qnil);
+    kboard->Vfunction_key_map = Fmake_sparse_keymap (Qnil);
 
   for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
     {
       char *sequence = tgetstr (keys[i].cap, address);
       if (sequence)
-       Fdefine_key (Vfunction_key_map, build_string (sequence),
+       Fdefine_key (kboard->Vfunction_key_map, build_string (sequence),
                     Fmake_vector (make_number (1),
                                   intern (keys[i].name)));
     }
@@ -1532,13 +1376,13 @@ term_get_fkeys_1 ()
        if (k0)
          /* Define f0 first, so that f10 takes precedence in case the
             key sequences happens to be the same.  */
-         Fdefine_key (Vfunction_key_map, build_string (k0),
+         Fdefine_key (kboard->Vfunction_key_map, build_string (k0),
                       Fmake_vector (make_number (1), intern ("f0")));
-       Fdefine_key (Vfunction_key_map, build_string (k_semi),
+       Fdefine_key (kboard->Vfunction_key_map, build_string (k_semi),
                     Fmake_vector (make_number (1), intern ("f10")));
       }
     else if (k0)
-      Fdefine_key (Vfunction_key_map, build_string (k0),
+      Fdefine_key (kboard->Vfunction_key_map, build_string (k0),
                   Fmake_vector (make_number (1), intern (k0_name)));
   }
 
@@ -1561,7 +1405,7 @@ term_get_fkeys_1 ()
          if (sequence)
            {
              sprintf (fkey, "f%d", i);
-             Fdefine_key (Vfunction_key_map, build_string (sequence),
+             Fdefine_key (kboard->Vfunction_key_map, build_string (sequence),
                           Fmake_vector (make_number (1),
                                         intern (fkey)));
            }
@@ -1577,10 +1421,10 @@ term_get_fkeys_1 ()
       if (!tgetstr (cap1, address))                                    \
        {                                                               \
          char *sequence = tgetstr (cap2, address);                     \
-         if (sequence)                                                 \
-           Fdefine_key (Vfunction_key_map, build_string (sequence),    \
-                        Fmake_vector (make_number (1), \
-                                      intern (sym)));  \
+         if (sequence)                                                 \
+           Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), \
+                        Fmake_vector (make_number (1),                 \
+                                      intern (sym)));                  \
        }
 
       /* if there's no key_next keycap, map key_npage to `next' keysym */
@@ -1915,10 +1759,10 @@ produce_special_glyphs (it, what)
    from them.  Some display attributes may not be used together with
    color; the termcap capability `NC' specifies which ones.  */
 
-#define MAY_USE_WITH_COLORS_P(ATTR)            \
-     (TN_max_colors > 0                                \
-      ? (TN_no_color_video & (ATTR)) == 0      \
-      : 1)
+#define MAY_USE_WITH_COLORS_P(tty, ATTR)                \
+  (tty->TN_max_colors > 0                              \
+   ? (tty->TN_no_color_video & (ATTR)) == 0             \
+   : 1)
 
 /* Turn appearances of face FACE_ID on tty frame F on.
    FACE_ID is a realized face ID number, in the face cache.  */
@@ -1931,12 +1775,13 @@ turn_on_face (f, face_id)
   struct face *face = FACE_FROM_ID (f, face_id);
   long fg = face->foreground;
   long bg = face->background;
+  struct tty_display_info *tty = FRAME_TTY (f);
 
   /* Do this first because TS_end_standout_mode may be the same
      as TS_exit_attribute_mode, which turns all appearances off. */
-  if (MAY_USE_WITH_COLORS_P (NC_REVERSE))
+  if (MAY_USE_WITH_COLORS_P (tty, NC_REVERSE))
     {
-      if (TN_max_colors > 0)
+      if (tty->TN_max_colors > 0)
        {
          if (fg >= 0 && bg >= 0)
            {
@@ -1950,13 +1795,13 @@ turn_on_face (f, face_id)
            {
              if (fg == FACE_TTY_DEFAULT_FG_COLOR
                  || bg == FACE_TTY_DEFAULT_BG_COLOR)
-               toggle_highlight ();
+               toggle_highlight (tty);
            }
          else
            {
              if (fg == FACE_TTY_DEFAULT_BG_COLOR
                  || bg == FACE_TTY_DEFAULT_FG_COLOR)
-               toggle_highlight ();
+               toggle_highlight (tty);
            }
        }
       else
@@ -1967,59 +1812,59 @@ turn_on_face (f, face_id)
            {
              if (fg == FACE_TTY_DEFAULT_FG_COLOR
                  || bg == FACE_TTY_DEFAULT_BG_COLOR)
-               toggle_highlight ();
+               toggle_highlight (tty);
            }
          else
            {
              if (fg == FACE_TTY_DEFAULT_BG_COLOR
                  || bg == FACE_TTY_DEFAULT_FG_COLOR)
-               toggle_highlight ();
+               toggle_highlight (tty);
            }
        }
     }
 
   if (face->tty_bold_p)
     {
-      if (MAY_USE_WITH_COLORS_P (NC_BOLD))
-       OUTPUT1_IF (TS_enter_bold_mode);
+      if (MAY_USE_WITH_COLORS_P (tty, NC_BOLD))
+       OUTPUT1_IF (tty, tty->TS_enter_bold_mode);
     }
   else if (face->tty_dim_p)
-    if (MAY_USE_WITH_COLORS_P (NC_DIM))
-      OUTPUT1_IF (TS_enter_dim_mode);
+    if (MAY_USE_WITH_COLORS_P (tty, NC_DIM))
+      OUTPUT1_IF (tty, tty->TS_enter_dim_mode);
 
   /* Alternate charset and blinking not yet used.  */
   if (face->tty_alt_charset_p
-      && MAY_USE_WITH_COLORS_P (NC_ALT_CHARSET))
-    OUTPUT1_IF (TS_enter_alt_charset_mode);
+      && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET))
+    OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode);
 
   if (face->tty_blinking_p
-      && MAY_USE_WITH_COLORS_P (NC_BLINK))
-    OUTPUT1_IF (TS_enter_blink_mode);
+      && MAY_USE_WITH_COLORS_P (tty, NC_BLINK))
+    OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
 
-  if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (NC_UNDERLINE))
-    OUTPUT1_IF (TS_enter_underline_mode);
+  if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
+    OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
 
-  if (TN_max_colors > 0)
+  if (tty->TN_max_colors > 0)
     {
       char *p;
 
-      if (fg >= 0 && TS_set_foreground)
+      if (fg >= 0 && tty->TS_set_foreground)
        {
-         if (standout_mode)
-           p = tparam (TS_set_background, NULL, 0, (int) fg);
-         else
-           p = tparam (TS_set_foreground, NULL, 0, (int) fg);
-         OUTPUT (p);
+          if (tty->standout_mode)
+            p = tparam (tty->TS_set_background, NULL, 0, (int) fg);
+          else
+            p = tparam (tty->TS_set_foreground, NULL, 0, (int) fg);
+         OUTPUT (tty, p);
          xfree (p);
        }
 
-      if (bg >= 0 && TS_set_background)
+      if (bg >= 0 && tty->TS_set_background)
        {
-         if (standout_mode)
-           p = tparam (TS_set_foreground, NULL, 0, (int) bg);
-         else
-           p = tparam (TS_set_background, NULL, 0, (int) bg);
-         OUTPUT (p);
+          if (tty->standout_mode)
+            p = tparam (tty->TS_set_foreground, NULL, 0, (int) bg);
+          else
+            p = tparam (tty->TS_set_background, NULL, 0, (int) bg);
+         OUTPUT (tty, p);
          xfree (p);
        }
     }
@@ -2034,10 +1879,11 @@ turn_off_face (f, face_id)
      int face_id;
 {
   struct face *face = FACE_FROM_ID (f, face_id);
+  struct tty_display_info *tty = FRAME_TTY (f);
 
   xassert (face != NULL);
 
-  if (TS_exit_attribute_mode)
+  if (tty->TS_exit_attribute_mode)
     {
       /* Capability "me" will turn off appearance modes double-bright,
         half-bright, reverse-video, standout, underline.  It may or
@@ -2049,32 +1895,32 @@ turn_off_face (f, face_id)
          || face->tty_blinking_p
          || face->tty_underline_p)
        {
-         OUTPUT1_IF (TS_exit_attribute_mode);
-         if (strcmp (TS_exit_attribute_mode, TS_end_standout_mode) == 0)
-           standout_mode = 0;
+         OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
+         if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
+           tty->standout_mode = 0;
        }
 
       if (face->tty_alt_charset_p)
-       OUTPUT_IF (TS_exit_alt_charset_mode);
+       OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
     }
   else
     {
       /* If we don't have "me" we can only have those appearances
         that have exit sequences defined.  */
       if (face->tty_alt_charset_p)
-       OUTPUT_IF (TS_exit_alt_charset_mode);
+       OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
 
       if (face->tty_underline_p)
-       OUTPUT_IF (TS_exit_underline_mode);
+       OUTPUT_IF (tty, tty->TS_exit_underline_mode);
     }
 
   /* Switch back to default colors.  */
-  if (TN_max_colors > 0
+  if (tty->TN_max_colors > 0
       && ((face->foreground != FACE_TTY_DEFAULT_COLOR
           && face->foreground != FACE_TTY_DEFAULT_FG_COLOR)
          || (face->background != FACE_TTY_DEFAULT_COLOR
              && face->background != FACE_TTY_DEFAULT_BG_COLOR)))
-    OUTPUT1_IF (TS_orig_pair);
+    OUTPUT1_IF (tty, tty->TS_orig_pair);
 }
 
 
@@ -2083,46 +1929,53 @@ turn_off_face (f, face_id)
    colors FG and BG.  */
 
 int
-tty_capable_p (f, caps, fg, bg)
-     struct frame *f;
+tty_capable_p (tty, caps, fg, bg)
+     struct tty_display_info *tty;
      unsigned caps;
      unsigned long fg, bg;
 {
-#define TTY_CAPABLE_P_TRY(cap, TS, NC_bit)                             \
-  if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(NC_bit)))     \
+#define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit)                                \
+  if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit)))        \
     return 0;
 
-  TTY_CAPABLE_P_TRY (TTY_CAP_INVERSE,  TS_standout_mode,        NC_REVERSE);
-  TTY_CAPABLE_P_TRY (TTY_CAP_UNDERLINE, TS_enter_underline_mode, NC_UNDERLINE);
-  TTY_CAPABLE_P_TRY (TTY_CAP_BOLD,     TS_enter_bold_mode,      NC_BOLD);
-  TTY_CAPABLE_P_TRY (TTY_CAP_DIM,      TS_enter_dim_mode,       NC_DIM);
-  TTY_CAPABLE_P_TRY (TTY_CAP_BLINK,    TS_enter_blink_mode,     NC_BLINK);
-  TTY_CAPABLE_P_TRY (TTY_CAP_ALT_CHARSET, TS_enter_alt_charset_mode, NC_ALT_CHARSET);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,     tty->TS_standout_mode,          NC_REVERSE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE,   tty->TS_enter_underline_mode,   NC_UNDERLINE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD,        tty->TS_enter_bold_mode,        NC_BOLD);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM,                 tty->TS_enter_dim_mode,         NC_DIM);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK,       tty->TS_enter_blink_mode,       NC_BLINK);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET,         tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET);
 
   /* We can do it!  */
   return 1;
 }
 
-
 /* Return non-zero if the terminal is capable to display colors.  */
 
 DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
        0, 1, 0,
-       doc: /* Return non-nil if TTY can display colors on DISPLAY.  */)
+       doc: /* Return non-nil if the tty device that DISPLAY uses can display colors. */)
      (display)
      Lisp_Object display;
 {
-  return TN_max_colors > 0 ? Qt : Qnil;
+  struct display *d = get_tty_display (display);
+  if (!d)
+    return Qnil;
+  else
+    return d->display_info.tty->TN_max_colors > 0 ? Qt : Qnil;
 }
 
 /* Return the number of supported colors.  */
 DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
        Stty_display_color_cells, 0, 1, 0,
-       doc: /* Return the number of colors supported by TTY on DISPLAY.  */)
+       doc: /* Return the number of colors supported by the tty device that DISPLAY uses.  */)
      (display)
      Lisp_Object display;
 {
-  return make_number (TN_max_colors);
+  struct display *d = get_tty_display (display);
+  if (!d)
+    return make_number (0);
+  else
+    return make_number (d->display_info.tty->TN_max_colors);
 }
 
 #ifndef WINDOWSNT
@@ -2130,8 +1983,7 @@ DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
 /* Save or restore the default color-related capabilities of this
    terminal.  */
 static void
-tty_default_color_capabilities (save)
-     int save;
+tty_default_color_capabilities (struct tty_display_info *tty, int save)
 {
   static char
     *default_orig_pair, *default_set_foreground, *default_set_background;
@@ -2141,30 +1993,30 @@ tty_default_color_capabilities (save)
     {
       if (default_orig_pair)
        xfree (default_orig_pair);
-      default_orig_pair = TS_orig_pair ? xstrdup (TS_orig_pair) : NULL;
+      default_orig_pair = tty->TS_orig_pair ? xstrdup (tty->TS_orig_pair) : NULL;
 
       if (default_set_foreground)
        xfree (default_set_foreground);
-      default_set_foreground = TS_set_foreground ? xstrdup (TS_set_foreground)
+      default_set_foreground = tty->TS_set_foreground ? xstrdup (tty->TS_set_foreground)
                               : NULL;
 
       if (default_set_background)
        xfree (default_set_background);
-      default_set_background = TS_set_background ? xstrdup (TS_set_background)
+      default_set_background = tty->TS_set_background ? xstrdup (tty->TS_set_background)
                               : NULL;
 
-      default_max_colors = TN_max_colors;
-      default_max_pairs = TN_max_pairs;
-      default_no_color_video = TN_no_color_video;
+      default_max_colors = tty->TN_max_colors;
+      default_max_pairs = tty->TN_max_pairs;
+      default_no_color_video = tty->TN_no_color_video;
     }
   else
     {
-      TS_orig_pair = default_orig_pair;
-      TS_set_foreground = default_set_foreground;
-      TS_set_background = default_set_background;
-      TN_max_colors = default_max_colors;
-      TN_max_pairs = default_max_pairs;
-      TN_no_color_video = default_no_color_video;
+      tty->TS_orig_pair = default_orig_pair;
+      tty->TS_set_foreground = default_set_foreground;
+      tty->TS_set_background = default_set_background;
+      tty->TN_max_colors = default_max_colors;
+      tty->TN_max_pairs = default_max_pairs;
+      tty->TN_no_color_video = default_no_color_video;
     }
 }
 
@@ -2173,8 +2025,7 @@ tty_default_color_capabilities (save)
    support; zero means set up for the default capabilities, the ones
    we saw at term_init time; -1 means turn off color support.  */
 void
-tty_setup_colors (mode)
-     int mode;
+tty_setup_colors (struct tty_display_info *tty, int mode)
 {
   /* Canonicalize all negative values of MODE.  */
   if (mode < -1)
@@ -2183,27 +2034,27 @@ tty_setup_colors (mode)
   switch (mode)
     {
       case -1:  /* no colors at all */
-       TN_max_colors = 0;
-       TN_max_pairs = 0;
-       TN_no_color_video = 0;
-       TS_set_foreground = TS_set_background = TS_orig_pair = NULL;
+       tty->TN_max_colors = 0;
+       tty->TN_max_pairs = 0;
+       tty->TN_no_color_video = 0;
+       tty->TS_set_foreground = tty->TS_set_background = tty->TS_orig_pair = NULL;
        break;
       case 0:   /* default colors, if any */
       default:
-       tty_default_color_capabilities (0);
+       tty_default_color_capabilities (tty, 0);
        break;
       case 8:  /* 8 standard ANSI colors */
-       TS_orig_pair = "\033[0m";
+       tty->TS_orig_pair = "\033[0m";
 #ifdef TERMINFO
-       TS_set_foreground = "\033[3%p1%dm";
-       TS_set_background = "\033[4%p1%dm";
+       tty->TS_set_foreground = "\033[3%p1%dm";
+       tty->TS_set_background = "\033[4%p1%dm";
 #else
-       TS_set_foreground = "\033[3%dm";
-       TS_set_background = "\033[4%dm";
+       tty->TS_set_foreground = "\033[3%dm";
+       tty->TS_set_background = "\033[4%dm";
 #endif
-       TN_max_colors = 8;
-       TN_max_pairs = 64;
-       TN_no_color_video = 0;
+       tty->TN_max_colors = 8;
+       tty->TN_max_pairs = 64;
+       tty->TN_no_color_video = 0;
        break;
     }
 }
@@ -2254,7 +2105,7 @@ set_tty_color_mode (f, val)
 
   if (mode != old_mode)
     {
-      tty_setup_colors (mode);
+      tty_setup_colors (FRAME_TTY (f), mode);
       /*  This recomputes all the faces given the new color
          definitions.  */
       call0 (intern ("tty-set-up-initial-frame-faces"));
@@ -2264,14 +2115,248 @@ set_tty_color_mode (f, val)
 
 #endif /* !WINDOWSNT */
 
+\f
+
+/* Return the display object specified by DISPLAY.  DISPLAY may be a
+   display id, a frame, or nil for the display device of the current
+   frame.  If THROW is zero, return NULL for failure, otherwise throw
+   an error.  */
+
+struct display *
+get_display (Lisp_Object display, int throw)
+{
+  struct display *result = NULL;
+
+  if (NILP (display))
+    display = selected_frame;
+
+  if (INTEGERP (display))
+    {
+      struct display *d;
+
+      for (d = display_list; d; d = d->next_display)
+        {
+          if (d->id == XINT (display))
+            {
+              result = d;
+              break;
+            }
+        }
+    }
+  else if (FRAMEP (display))
+    {
+      result = FRAME_DISPLAY (XFRAME (display));
+    }
+
+  if (result == NULL && throw)
+    wrong_type_argument (Qdisplay_live_p, display);
+
+  return result;
+}
+
+/* Return the tty display object specified by DISPLAY. */
+
+static struct display *
+get_tty_display (Lisp_Object display)
+{
+  struct display *d = get_display (display, 0);
+  
+  if (d && d->type == output_initial)
+    d = NULL;
+
+  if (d && d->type != output_termcap)
+    {
+#if 0   /* XXX We need a predicate as the first argument; find one. */
+      wrong_type_argument ("Not a termcap display", display);
+#else /* Until we fix the wrong_type_argument call above, simply throw
+         a dumb error. */
+      error ("DISPLAY is not a termcap display");
+#endif
+    }
+
+  return d;
+}
+
+/* Return the active termcap display that uses the tty device with the
+   given name.  If NAME is NULL, return the display corresponding to
+   our controlling terminal.
+
+   This function ignores suspended displays.
+
+   Returns NULL if the named terminal device is not opened.  */
+struct display *
+get_named_tty_display (name)
+     char *name;
+{
+  struct display *d;
+
+  for (d = display_list; d; d = d->next_display) {
+    if (d->type == output_termcap
+        && ((d->display_info.tty->name == 0 && name == 0)
+            || (name && d->display_info.tty->name
+                && !strcmp (d->display_info.tty->name, name)))
+        && DISPLAY_ACTIVE_P (d))
+      return d;
+  };
+
+  return 0;
+}
+
+\f
+
+DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0,
+       doc: /* Return the name of the device that DISPLAY uses.
+It is not guaranteed that the returned value is unique among opened displays.
+
+DISPLAY may be a display, a frame, or nil (meaning the selected
+frame's display). */)
+  (display)
+     Lisp_Object display;
+{
+  struct display *d = get_display (display, 1);
+
+  if (d->name)
+    return build_string (d->name);
+  else
+    return Qnil;
+}
+
+DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0,
+       doc: /* Return the type of the TTY device that DISPLAY uses.
+
+DISPLAY may be a display, a frame, or nil (meaning the selected
+frame's display).  */)
+  (display)
+     Lisp_Object display;
+{
+  struct display *d = get_display (display, 1);
+
+  if (d->type != output_termcap)
+    error ("Display %d is not a termcap display", d->id);
+           
+  if (d->display_info.tty->type)
+    return build_string (d->display_info.tty->type);
+  else
+    return Qnil;
+}
+
+DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0,
+       doc: /* Return non-nil if DISPLAY is on the controlling tty of the Emacs process.
+
+DISPLAY may be a display, a frame, or nil (meaning the selected
+frame's display).  */)
+  (display)
+     Lisp_Object display;
+{
+  struct display *d = get_display (display, 1);
+
+  if (d->type != output_termcap || d->display_info.tty->name)
+    return Qnil;
+  else
+    return Qt;
+}
+
+DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
+       doc: /* Declare that the tty used by DISPLAY does not handle underlining.
+This is used to override the terminfo data, for certain terminals that
+do not really do underlining, but say that they do.  This function has
+no effect if used on a non-tty display.
+
+DISPLAY may be a display, a frame, or nil (meaning the selected
+frame's display).  */)
+  (display)
+     Lisp_Object display;
+{
+  struct display *d = get_display (display, 1);
+
+  if (d->type == output_termcap)
+    d->display_info.tty->TS_enter_underline_mode = 0;
+  return Qnil;
+}
+
+
 \f
 /***********************************************************************
                            Initialization
  ***********************************************************************/
 
+/* Create the bootstrap display device for the initial frame.
+   Returns a display of type output_initial. */
+
+struct display *
+init_initial_display (void)
+{
+  if (initialized || display_list || tty_list)
+    abort ();
+
+  initial_display = create_display ();
+  initial_display->type = output_initial;
+  initial_display->name = xstrdup ("initial_display");
+  initial_display->kboard = initial_kboard;
+
+  initial_display->delete_display_hook = &delete_initial_display;
+  /* All other hooks are NULL. */
+
+  return initial_display;
+}
+
+/* Deletes the bootstrap display device.
+   Called through delete_display_hook. */
+
+void
+delete_initial_display (struct display *display)
+{
+  if (display != initial_display)
+    abort ();
+
+  delete_display (display);
+  initial_display = NULL;
+}
+
+/* Drop the controlling terminal if fd is the same device. */
 void
-term_init (terminal_type)
-     char *terminal_type;
+dissociate_if_controlling_tty (int fd)
+{
+  int pgid;
+  EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */
+  if (pgid != -1)
+    {
+#if defined (USG) && !defined (BSD_PGRPS)
+      setpgrp ();
+      no_controlling_tty = 1;
+#else
+#ifdef TIOCNOTTY                /* Try BSD ioctls. */
+      sigblock (sigmask (SIGTTOU));
+      fd = emacs_open ("/dev/tty", O_RDWR, 0);
+      if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1)
+        {
+          no_controlling_tty = 1;
+        }
+      if (fd != -1)
+        emacs_close (fd);
+      sigunblock (sigmask (SIGTTOU));
+#else
+      /* Unknown system. */
+      croak ();
+#endif  /* ! TIOCNOTTY */
+#endif  /* ! USG */
+    }
+}
+
+/* Create a termcap display on the tty device with the given name and
+   type.
+
+   If NAME is NULL, then use the controlling tty, i.e., stdin/stdout.
+   Otherwise NAME should be a path to the tty device file,
+   e.g. "/dev/pts/7".
+
+   TERMINAL_TYPE is the termcap type of the device, e.g. "vt100".
+
+   If MUST_SUCCEED is true, then all errors are fatal. */
+
+struct display *
+term_init (char *name, char *terminal_type, int must_succeed)
 {
   char *area;
   char **address = &area;
@@ -2279,71 +2364,209 @@ term_init (terminal_type)
   int buffer_size = 4096;
   register char *p;
   int status;
-  struct frame *sf = XFRAME (selected_frame);
+  struct tty_display_info *tty;
+  struct display *display;
+
+  static void maybe_fatal();
+
+  if (!terminal_type)
+    maybe_fatal (must_succeed, 0, 0,
+                 "Unknown terminal type",
+                 "Unknown terminal type");
+
+  /* If we already have an active display on the given device, use that.
+     If all displays are suspended, create a new one instead.  */
+  /* XXX Perhaps this should be made explicit by having term_init
+     always create a new display and separating display and frame
+     creation on Lisp level.  */
+  display = get_named_tty_display (name);
+  if (display)
+    return display;
+
+  display = create_display ();
+  tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
+  bzero (tty, sizeof (struct tty_display_info));
+  tty->next = tty_list;
+  tty_list = tty;
+
+  display->type = output_termcap;
+  display->display_info.tty = tty;
+  tty->display = display;
+
+  tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
+  Wcm_clear (tty);
+
+  display->rif = 0; /* ttys don't support window-based redisplay. */
+
+  display->cursor_to_hook = &tty_cursor_to;
+  display->raw_cursor_to_hook = &tty_raw_cursor_to;
+
+  display->clear_to_end_hook = &tty_clear_to_end;
+  display->clear_frame_hook = &tty_clear_frame;
+  display->clear_end_of_line_hook = &tty_clear_end_of_line;
+
+  display->ins_del_lines_hook = &tty_ins_del_lines;
+
+  display->insert_glyphs_hook = &tty_insert_glyphs;
+  display->write_glyphs_hook = &tty_write_glyphs;
+  display->delete_glyphs_hook = &tty_delete_glyphs;
+
+  display->ring_bell_hook = &tty_ring_bell;
+  
+  display->reset_terminal_modes_hook = &tty_reset_terminal_modes;
+  display->set_terminal_modes_hook = &tty_set_terminal_modes;
+  display->update_begin_hook = 0; /* Not needed. */
+  display->update_end_hook = &tty_update_end;
+  display->set_terminal_window_hook = &tty_set_terminal_window;
+
+  display->mouse_position_hook = 0; /* Not needed. */
+  display->frame_rehighlight_hook = 0; /* Not needed. */
+  display->frame_raise_lower_hook = 0; /* Not needed. */
+
+  display->set_vertical_scroll_bar_hook = 0; /* Not needed. */
+  display->condemn_scroll_bars_hook = 0; /* Not needed. */
+  display->redeem_scroll_bar_hook = 0; /* Not needed. */
+  display->judge_scroll_bars_hook = 0; /* Not needed. */
+
+  display->read_socket_hook = &tty_read_avail_input; /* keyboard.c */
+  display->frame_up_to_date_hook = 0; /* Not needed. */
+  
+  display->delete_frame_hook = &delete_tty_output;
+  display->delete_display_hook = &delete_tty;
+  
+  if (name)
+    {
+      int fd;
+      FILE *file;
+
+#ifdef O_IGNORE_CTTY
+      /* Open the terminal device.  Don't recognize it as our
+         controlling terminal, and don't make it the controlling tty
+         if we don't have one at the moment.  */
+      fd = emacs_open (name, O_RDWR | O_IGNORE_CTTY | O_NOCTTY, 0);
+#else
+      /* Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
+         defined on Hurd.  On other systems, we need to dissociate
+         ourselves from the controlling tty when we want to open a
+         frame on the same terminal.  */
+
+      fd = emacs_open (name, O_RDWR | O_NOCTTY, 0);
+
+#endif /* O_IGNORE_CTTY */
+
+      if (fd < 0)
+        {
+          delete_tty (display);
+          error ("Could not open file: %s", name);
+        }
+      if (!isatty (fd))
+        {
+          close (fd);
+          error ("Not a tty device: %s", name);
+        }
+
+      dissociate_if_controlling_tty (fd);
+      
+      file = fdopen (fd, "w+");
+      tty->name = xstrdup (name);
+      display->name = xstrdup (name);
+      tty->input = file;
+      tty->output = file;
+    }
+  else
+    {
+      if (no_controlling_tty)
+        {
+          /* Opening a frame on stdout is unsafe if we have
+             disconnected our controlling terminal. */
+          error ("There is no controlling terminal any more");
+        }
+      tty->name = 0;
+      display->name = xstrdup (ttyname (0));
+      tty->input = stdin;
+      tty->output = stdout;
+    }
+
+  tty->type = xstrdup (terminal_type);
+
+  add_keyboard_wait_descriptor (fileno (tty->input));
 
   encode_terminal_bufsize = 0;
 
 #ifdef WINDOWSNT
   initialize_w32_display ();
 
-  Wcm_clear ();
+  Wcm_clear (tty);
 
   area = (char *) xmalloc (2044);
 
-  FrameRows = FRAME_LINES (sf);
-  FrameCols = FRAME_COLS (sf);
-  specified_window = FRAME_LINES (sf);
+  FrameRows (tty) = FRAME_LINES (f); /* XXX */
+  FrameCols (tty) = FRAME_COLS (f);  /* XXX */
+  tty->specified_window = FRAME_LINES (f); /* XXX */
 
-  delete_in_insert_mode = 1;
+  tty->display->delete_in_insert_mode = 1;
 
-  UseTabs = 0;
-  scroll_region_ok = 0;
+  UseTabs (tty) = 0;
+  display->scroll_region_ok = 0;
 
   /* Seems to insert lines when it's not supposed to, messing
      up the display.  In doing a trace, it didn't seem to be
      called much, so I don't think we're losing anything by
      turning it off.  */
-
-  line_ins_del_ok = 0;
-  char_ins_del_ok = 1;
+  display->line_ins_del_ok = 0;
+  display->char_ins_del_ok = 1;
 
   baud_rate = 19200;
 
-  FRAME_CAN_HAVE_SCROLL_BARS (sf) = 0;
-  FRAME_VERTICAL_SCROLL_BAR_TYPE (sf) = vertical_scroll_bar_none;
+  FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; /* XXX */
+  FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */
   TN_max_colors = 16;  /* Required to be non-zero for tty-display-color-p */
 
-  return;
+  return display;
 #else  /* not WINDOWSNT */
 
-  Wcm_clear ();
+  Wcm_clear (tty);
 
   buffer = (char *) xmalloc (buffer_size);
+  
+  /* On some systems, tgetent tries to access the controlling
+     terminal. */
+  sigblock (sigmask (SIGTTOU));
   status = tgetent (buffer, terminal_type);
+  sigunblock (sigmask (SIGTTOU));
+  
   if (status < 0)
     {
 #ifdef TERMINFO
-      fatal ("Cannot open terminfo database file");
+      maybe_fatal (must_succeed, buffer, display,
+                   "Cannot open terminfo database file",
+                   "Cannot open terminfo database file");
 #else
-      fatal ("Cannot open termcap database file");
+      maybe_fatal (must_succeed, buffer, display,
+                   "Cannot open termcap database file",
+                   "Cannot open termcap database file");
 #endif
     }
   if (status == 0)
     {
 #ifdef TERMINFO
-      fatal ("Terminal type %s is not defined.\n\
+      maybe_fatal (must_succeed, buffer, display,
+                   "Terminal type %s is not defined",
+                   "Terminal type %s is not defined.\n\
 If that is not the actual type of terminal you have,\n\
 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
 `setenv TERM ...') to specify the correct type.  It may be necessary\n\
 to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
-            terminal_type);
+                   terminal_type);
 #else
-      fatal ("Terminal type %s is not defined.\n\
+      maybe_fatal (must_succeed, buffer, display,
+                   "Terminal type %s is not defined",
+                   "Terminal type %s is not defined.\n\
 If that is not the actual type of terminal you have,\n\
 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
 `setenv TERM ...') to specify the correct type.  It may be necessary\n\
 to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
-            terminal_type);
+                   terminal_type);
 #endif
     }
 
@@ -2354,219 +2577,234 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
 #endif
   area = (char *) xmalloc (buffer_size);
 
-  TS_ins_line = tgetstr ("al", address);
-  TS_ins_multi_lines = tgetstr ("AL", address);
-  TS_bell = tgetstr ("bl", address);
-  BackTab = tgetstr ("bt", address);
-  TS_clr_to_bottom = tgetstr ("cd", address);
-  TS_clr_line = tgetstr ("ce", address);
-  TS_clr_frame = tgetstr ("cl", address);
-  ColPosition = NULL; /* tgetstr ("ch", address); */
-  AbsPosition = tgetstr ("cm", address);
-  CR = tgetstr ("cr", address);
-  TS_set_scroll_region = tgetstr ("cs", address);
-  TS_set_scroll_region_1 = tgetstr ("cS", address);
-  RowPosition = tgetstr ("cv", address);
-  TS_del_char = tgetstr ("dc", address);
-  TS_del_multi_chars = tgetstr ("DC", address);
-  TS_del_line = tgetstr ("dl", address);
-  TS_del_multi_lines = tgetstr ("DL", address);
-  TS_delete_mode = tgetstr ("dm", address);
-  TS_end_delete_mode = tgetstr ("ed", address);
-  TS_end_insert_mode = tgetstr ("ei", address);
-  Home = tgetstr ("ho", address);
-  TS_ins_char = tgetstr ("ic", address);
-  TS_ins_multi_chars = tgetstr ("IC", address);
-  TS_insert_mode = tgetstr ("im", address);
-  TS_pad_inserted_char = tgetstr ("ip", address);
-  TS_end_keypad_mode = tgetstr ("ke", address);
-  TS_keypad_mode = tgetstr ("ks", address);
-  LastLine = tgetstr ("ll", address);
-  Right = tgetstr ("nd", address);
-  Down = tgetstr ("do", address);
-  if (!Down)
-    Down = tgetstr ("nl", address); /* Obsolete name for "do" */
+  tty->TS_ins_line = tgetstr ("al", address);
+  tty->TS_ins_multi_lines = tgetstr ("AL", address);
+  tty->TS_bell = tgetstr ("bl", address);
+  BackTab (tty) = tgetstr ("bt", address);
+  tty->TS_clr_to_bottom = tgetstr ("cd", address);
+  tty->TS_clr_line = tgetstr ("ce", address);
+  tty->TS_clr_frame = tgetstr ("cl", address);
+  ColPosition (tty) = NULL; /* tgetstr ("ch", address); */
+  AbsPosition (tty) = tgetstr ("cm", address);
+  CR (tty) = tgetstr ("cr", address);
+  tty->TS_set_scroll_region = tgetstr ("cs", address);
+  tty->TS_set_scroll_region_1 = tgetstr ("cS", address);
+  RowPosition (tty) = tgetstr ("cv", address);
+  tty->TS_del_char = tgetstr ("dc", address);
+  tty->TS_del_multi_chars = tgetstr ("DC", address);
+  tty->TS_del_line = tgetstr ("dl", address);
+  tty->TS_del_multi_lines = tgetstr ("DL", address);
+  tty->TS_delete_mode = tgetstr ("dm", address);
+  tty->TS_end_delete_mode = tgetstr ("ed", address);
+  tty->TS_end_insert_mode = tgetstr ("ei", address);
+  Home (tty) = tgetstr ("ho", address);
+  tty->TS_ins_char = tgetstr ("ic", address);
+  tty->TS_ins_multi_chars = tgetstr ("IC", address);
+  tty->TS_insert_mode = tgetstr ("im", address);
+  tty->TS_pad_inserted_char = tgetstr ("ip", address);
+  tty->TS_end_keypad_mode = tgetstr ("ke", address);
+  tty->TS_keypad_mode = tgetstr ("ks", address);
+  LastLine (tty) = tgetstr ("ll", address);
+  Right (tty) = tgetstr ("nd", address);
+  Down (tty) = tgetstr ("do", address);
+  if (!Down (tty))
+    Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */
 #ifdef VMS
   /* VMS puts a carriage return before each linefeed,
      so it is not safe to use linefeeds.  */
-  if (Down && Down[0] == '\n' && Down[1] == '\0')
-    Down = 0;
+  if (Down (tty) && Down (tty)[0] == '\n' && Down (tty)[1] == '\0')
+    Down (tty) = 0;
 #endif /* VMS */
   if (tgetflag ("bs"))
-    Left = "\b";                 /* can't possibly be longer! */
+    Left (tty) = "\b";           /* can't possibly be longer! */
   else                           /* (Actually, "bs" is obsolete...) */
-    Left = tgetstr ("le", address);
-  if (!Left)
-    Left = tgetstr ("bc", address); /* Obsolete name for "le" */
-  TS_pad_char = tgetstr ("pc", address);
-  TS_repeat = tgetstr ("rp", address);
-  TS_end_standout_mode = tgetstr ("se", address);
-  TS_fwd_scroll = tgetstr ("sf", address);
-  TS_standout_mode = tgetstr ("so", address);
-  TS_rev_scroll = tgetstr ("sr", address);
-  Wcm.cm_tab = tgetstr ("ta", address);
-  TS_end_termcap_modes = tgetstr ("te", address);
-  TS_termcap_modes = tgetstr ("ti", address);
-  Up = tgetstr ("up", address);
-  TS_visible_bell = tgetstr ("vb", address);
-  TS_cursor_normal = tgetstr ("ve", address);
-  TS_cursor_visible = tgetstr ("vs", address);
-  TS_cursor_invisible = tgetstr ("vi", address);
-  TS_set_window = tgetstr ("wi", address);
-
-  TS_enter_underline_mode = tgetstr ("us", address);
-  TS_exit_underline_mode = tgetstr ("ue", address);
-  TS_enter_bold_mode = tgetstr ("md", address);
-  TS_enter_dim_mode = tgetstr ("mh", address);
-  TS_enter_blink_mode = tgetstr ("mb", address);
-  TS_enter_reverse_mode = tgetstr ("mr", address);
-  TS_enter_alt_charset_mode = tgetstr ("as", address);
-  TS_exit_alt_charset_mode = tgetstr ("ae", address);
-  TS_exit_attribute_mode = tgetstr ("me", address);
-
-  MultiUp = tgetstr ("UP", address);
-  MultiDown = tgetstr ("DO", address);
-  MultiLeft = tgetstr ("LE", address);
-  MultiRight = tgetstr ("RI", address);
+    Left (tty) = tgetstr ("le", address);
+  if (!Left (tty))
+    Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le" */
+  tty->TS_pad_char = tgetstr ("pc", address);
+  tty->TS_repeat = tgetstr ("rp", address);
+  tty->TS_end_standout_mode = tgetstr ("se", address);
+  tty->TS_fwd_scroll = tgetstr ("sf", address);
+  tty->TS_standout_mode = tgetstr ("so", address);
+  tty->TS_rev_scroll = tgetstr ("sr", address);
+  tty->Wcm->cm_tab = tgetstr ("ta", address);
+  tty->TS_end_termcap_modes = tgetstr ("te", address);
+  tty->TS_termcap_modes = tgetstr ("ti", address);
+  Up (tty) = tgetstr ("up", address);
+  tty->TS_visible_bell = tgetstr ("vb", address);
+  tty->TS_cursor_normal = tgetstr ("ve", address);
+  tty->TS_cursor_visible = tgetstr ("vs", address);
+  tty->TS_cursor_invisible = tgetstr ("vi", address);
+  tty->TS_set_window = tgetstr ("wi", address);
+
+  tty->TS_enter_underline_mode = tgetstr ("us", address);
+  tty->TS_exit_underline_mode = tgetstr ("ue", address);
+  tty->TS_enter_bold_mode = tgetstr ("md", address);
+  tty->TS_enter_dim_mode = tgetstr ("mh", address);
+  tty->TS_enter_blink_mode = tgetstr ("mb", address);
+  tty->TS_enter_reverse_mode = tgetstr ("mr", address);
+  tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
+  tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
+  tty->TS_exit_attribute_mode = tgetstr ("me", address);
+
+  MultiUp (tty) = tgetstr ("UP", address);
+  MultiDown (tty) = tgetstr ("DO", address);
+  MultiLeft (tty) = tgetstr ("LE", address);
+  MultiRight (tty) = tgetstr ("RI", address);
 
   /* SVr4/ANSI color suppert.  If "op" isn't available, don't support
      color because we can't switch back to the default foreground and
      background.  */
-  TS_orig_pair = tgetstr ("op", address);
-  if (TS_orig_pair)
+  tty->TS_orig_pair = tgetstr ("op", address);
+  if (tty->TS_orig_pair)
     {
-      TS_set_foreground = tgetstr ("AF", address);
-      TS_set_background = tgetstr ("AB", address);
-      if (!TS_set_foreground)
+      tty->TS_set_foreground = tgetstr ("AF", address);
+      tty->TS_set_background = tgetstr ("AB", address);
+      if (!tty->TS_set_foreground)
        {
          /* SVr4.  */
-         TS_set_foreground = tgetstr ("Sf", address);
-         TS_set_background = tgetstr ("Sb", address);
+         tty->TS_set_foreground = tgetstr ("Sf", address);
+         tty->TS_set_background = tgetstr ("Sb", address);
        }
 
-      TN_max_colors = tgetnum ("Co");
-      TN_max_pairs = tgetnum ("pa");
+      tty->TN_max_colors = tgetnum ("Co");
+      tty->TN_max_pairs = tgetnum ("pa");
 
-      TN_no_color_video = tgetnum ("NC");
-      if (TN_no_color_video == -1)
-       TN_no_color_video = 0;
+      tty->TN_no_color_video = tgetnum ("NC");
+      if (tty->TN_no_color_video == -1)
+        tty->TN_no_color_video = 0;
     }
 
-  tty_default_color_capabilities (1);
+  tty_default_color_capabilities (tty, 1);
 
-  MagicWrap = tgetflag ("xn");
+  MagicWrap (tty) = tgetflag ("xn");
   /* Since we make MagicWrap terminals look like AutoWrap, we need to have
      the former flag imply the latter.  */
-  AutoWrap = MagicWrap || tgetflag ("am");
-  memory_below_frame = tgetflag ("db");
-  TF_hazeltine = tgetflag ("hz");
-  must_write_spaces = tgetflag ("in");
-  meta_key = tgetflag ("km") || tgetflag ("MT");
-  TF_insmode_motion = tgetflag ("mi");
-  TF_standout_motion = tgetflag ("ms");
-  TF_underscore = tgetflag ("ul");
-  TF_teleray = tgetflag ("xt");
-
-  term_get_fkeys (address);
+  AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am");
+  display->memory_below_frame = tgetflag ("db");
+  tty->TF_hazeltine = tgetflag ("hz");
+  display->must_write_spaces = tgetflag ("in");
+  tty->meta_key = tgetflag ("km") || tgetflag ("MT");
+  tty->TF_insmode_motion = tgetflag ("mi");
+  tty->TF_standout_motion = tgetflag ("ms");
+  tty->TF_underscore = tgetflag ("ul");
+  tty->TF_teleray = tgetflag ("xt");
+
+#ifdef MULTI_KBOARD
+  display->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+  init_kboard (display->kboard);
+  display->kboard->next_kboard = all_kboards;
+  all_kboards = display->kboard;
+  display->kboard->reference_count++;
+  /* Don't let the initial kboard remain current longer than necessary.
+     That would cause problems if a file loaded on startup tries to
+     prompt in the mini-buffer.  */
+  if (current_kboard == initial_kboard)
+    current_kboard = display->kboard;
+#endif
+
+  term_get_fkeys (address, display->kboard);
 
   /* Get frame size from system, or else from termcap.  */
   {
     int height, width;
-    get_frame_size (&width, &height);
-    FRAME_COLS (sf) = width;
-    FRAME_LINES (sf) = height;
+    get_tty_size (fileno (tty->input), &width, &height);
+    FrameCols (tty) = width;
+    FrameRows (tty) = height;
   }
 
-  if (FRAME_COLS (sf) <= 0)
-    SET_FRAME_COLS (sf, tgetnum ("co"));
-  else
-    /* Keep width and external_width consistent */
-    SET_FRAME_COLS (sf, FRAME_COLS (sf));
-  if (FRAME_LINES (sf) <= 0)
-    FRAME_LINES (sf) = tgetnum ("li");
+  if (FrameCols (tty) <= 0)
+    FrameCols (tty) = tgetnum ("co");
+  if (FrameRows (tty) <= 0)
+    FrameRows (tty) = tgetnum ("li");
 
-  if (FRAME_LINES (sf) < 3 || FRAME_COLS (sf) < 3)
-    fatal ("Screen size %dx%d is too small",
-          FRAME_LINES (sf), FRAME_COLS (sf));
+  if (FrameRows (tty) < 3 || FrameCols (tty) < 3)
+    maybe_fatal (must_succeed, NULL, display,
+                 "Screen size %dx%d is too small"
+                 "Screen size %dx%d is too small",
+                 FrameCols (tty), FrameRows (tty));
 
-  min_padding_speed = tgetnum ("pb");
-  TabWidth = tgetnum ("tw");
+#if 0  /* This is not used anywhere. */
+  tty->display->min_padding_speed = tgetnum ("pb");
+#endif
+
+  TabWidth (tty) = tgetnum ("tw");
 
 #ifdef VMS
   /* These capabilities commonly use ^J.
      I don't know why, but sending them on VMS does not work;
      it causes following spaces to be lost, sometimes.
      For now, the simplest fix is to avoid using these capabilities ever.  */
-  if (Down && Down[0] == '\n')
-    Down = 0;
+  if (Down (tty) && Down (tty)[0] == '\n')
+    Down (tty) = 0;
 #endif /* VMS */
 
-  if (!TS_bell)
-    TS_bell = "\07";
+  if (!tty->TS_bell)
+    tty->TS_bell = "\07";
 
-  if (!TS_fwd_scroll)
-    TS_fwd_scroll = Down;
+  if (!tty->TS_fwd_scroll)
+    tty->TS_fwd_scroll = Down (tty);
 
-  PC = TS_pad_char ? *TS_pad_char : 0;
+  PC = tty->TS_pad_char ? *tty->TS_pad_char : 0;
 
-  if (TabWidth < 0)
-    TabWidth = 8;
+  if (TabWidth (tty) < 0)
+    TabWidth (tty) = 8;
 
 /* Turned off since /etc/termcap seems to have :ta= for most terminals
    and newer termcap doc does not seem to say there is a default.
-  if (!Wcm.cm_tab)
-    Wcm.cm_tab = "\t";
+  if (!tty->Wcm->cm_tab)
+    tty->Wcm->cm_tab = "\t";
 */
 
   /* We don't support standout modes that use `magic cookies', so
      turn off any that do.  */
-  if (TS_standout_mode && tgetnum ("sg") >= 0)
+  if (tty->TS_standout_mode && tgetnum ("sg") >= 0)
     {
-      TS_standout_mode = 0;
-      TS_end_standout_mode = 0;
+      tty->TS_standout_mode = 0;
+      tty->TS_end_standout_mode = 0;
     }
-  if (TS_enter_underline_mode && tgetnum ("ug") >= 0)
+  if (tty->TS_enter_underline_mode && tgetnum ("ug") >= 0)
     {
-      TS_enter_underline_mode = 0;
-      TS_exit_underline_mode = 0;
+      tty->TS_enter_underline_mode = 0;
+      tty->TS_exit_underline_mode = 0;
     }
 
   /* If there's no standout mode, try to use underlining instead.  */
-  if (TS_standout_mode == 0)
+  if (tty->TS_standout_mode == 0)
     {
-      TS_standout_mode = TS_enter_underline_mode;
-      TS_end_standout_mode = TS_exit_underline_mode;
+      tty->TS_standout_mode = tty->TS_enter_underline_mode;
+      tty->TS_end_standout_mode = tty->TS_exit_underline_mode;
     }
 
   /* If no `se' string, try using a `me' string instead.
      If that fails, we can't use standout mode at all.  */
-  if (TS_end_standout_mode == 0)
+  if (tty->TS_end_standout_mode == 0)
     {
       char *s = tgetstr ("me", address);
       if (s != 0)
-       TS_end_standout_mode = s;
+        tty->TS_end_standout_mode = s;
       else
-       TS_standout_mode = 0;
+        tty->TS_standout_mode = 0;
     }
 
-  if (TF_teleray)
+  if (tty->TF_teleray)
     {
-      Wcm.cm_tab = 0;
+      tty->Wcm->cm_tab = 0;
       /* We can't support standout mode, because it uses magic cookies.  */
-      TS_standout_mode = 0;
+      tty->TS_standout_mode = 0;
       /* But that means we cannot rely on ^M to go to column zero! */
-      CR = 0;
+      CR (tty) = 0;
       /* LF can't be trusted either -- can alter hpos */
       /* if move at column 0 thru a line with TS_standout_mode */
-      Down = 0;
+      Down (tty) = 0;
     }
 
   /* Special handling for certain terminal types known to need it */
 
   if (!strcmp (terminal_type, "supdup"))
     {
-      memory_below_frame = 1;
-      Wcm.cm_losewrap = 1;
+      display->memory_below_frame = 1;
+      tty->Wcm->cm_losewrap = 1;
     }
   if (!strncmp (terminal_type, "c10", 3)
       || !strcmp (terminal_type, "perq"))
@@ -2583,102 +2821,139 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
         It would be simpler if the :wi string could go in the termcap
         entry, but it can't because it is not fully valid.
         If it were in the termcap entry, it would confuse other programs.  */
-      if (!TS_set_window)
+      if (!tty->TS_set_window)
        {
-         p = TS_termcap_modes;
+         p = tty->TS_termcap_modes;
          while (*p && strcmp (p, "\033v  "))
            p++;
          if (*p)
-           TS_set_window = "\033v%C %C %C %C ";
+           tty->TS_set_window = "\033v%C %C %C %C ";
        }
       /* Termcap entry often fails to have :in: flag */
-      must_write_spaces = 1;
+      display->must_write_spaces = 1;
       /* :ti string typically fails to have \E^G! in it */
       /* This limits scope of insert-char to one line.  */
-      strcpy (area, TS_termcap_modes);
+      strcpy (area, tty->TS_termcap_modes);
       strcat (area, "\033\007!");
-      TS_termcap_modes = area;
+      tty->TS_termcap_modes = area;
       area += strlen (area) + 1;
-      p = AbsPosition;
+      p = AbsPosition (tty);
       /* Change all %+ parameters to %C, to handle
-        values above 96 correctly for the C100.  */
+         values above 96 correctly for the C100.  */
       while (*p)
-       {
-         if (p[0] == '%' && p[1] == '+')
-           p[1] = 'C';
-         p++;
-       }
+        {
+          if (p[0] == '%' && p[1] == '+')
+            p[1] = 'C';
+          p++;
+        }
     }
 
-  FrameRows = FRAME_LINES (sf);
-  FrameCols = FRAME_COLS (sf);
-  specified_window = FRAME_LINES (sf);
+  tty->specified_window = FrameRows (tty);
 
-  if (Wcm_init () == -1)       /* can't do cursor motion */
+  if (Wcm_init (tty) == -1)    /* can't do cursor motion */
+    {
+      maybe_fatal (must_succeed, NULL, display,
+                   "Terminal type \"%s\" is not powerful enough to run Emacs",
 #ifdef VMS
-    fatal ("Terminal type \"%s\" is not powerful enough to run Emacs.\n\
+                   "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
 It lacks the ability to position the cursor.\n\
 If that is not the actual type of terminal you have, use either the\n\
 DCL command `SET TERMINAL/DEVICE= ...' for DEC-compatible terminals,\n\
 or `define EMACS_TERM \"terminal type\"' for non-DEC terminals.",
-           terminal_type);
 #else /* not VMS */
 # ifdef TERMINFO
-    fatal ("Terminal type \"%s\" is not powerful enough to run Emacs.\n\
+                   "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
 It lacks the ability to position the cursor.\n\
 If that is not the actual type of terminal you have,\n\
 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
 `setenv TERM ...') to specify the correct type.  It may be necessary\n\
 to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
-          terminal_type);
 # else /* TERMCAP */
-    fatal ("Terminal type \"%s\" is not powerful enough to run Emacs.\n\
+                   "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
 It lacks the ability to position the cursor.\n\
 If that is not the actual type of terminal you have,\n\
 use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
 `setenv TERM ...') to specify the correct type.  It may be necessary\n\
 to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
-          terminal_type);
 # endif /* TERMINFO */
 #endif /*VMS */
-  if (FRAME_LINES (sf) <= 0
-      || FRAME_COLS (sf) <= 0)
-    fatal ("The frame size has not been specified");
+                   terminal_type);
+    }
 
-  delete_in_insert_mode
-    = TS_delete_mode && TS_insert_mode
-      && !strcmp (TS_delete_mode, TS_insert_mode);
+  if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0)
+    maybe_fatal (must_succeed, NULL, display,
+                 "Could not determine the frame size",
+                 "Could not determine the frame size");
 
-  se_is_so = (TS_standout_mode
-             && TS_end_standout_mode
-             && !strcmp (TS_standout_mode, TS_end_standout_mode));
+  tty->delete_in_insert_mode
+    = tty->TS_delete_mode && tty->TS_insert_mode
+    && !strcmp (tty->TS_delete_mode, tty->TS_insert_mode);
 
-  UseTabs = tabs_safe_p () && TabWidth == 8;
+  tty->se_is_so = (tty->TS_standout_mode
+              && tty->TS_end_standout_mode
+              && !strcmp (tty->TS_standout_mode, tty->TS_end_standout_mode));
 
-  scroll_region_ok
-    = (Wcm.cm_abs
-       && (TS_set_window || TS_set_scroll_region || TS_set_scroll_region_1));
+  UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
 
-  line_ins_del_ok = (((TS_ins_line || TS_ins_multi_lines)
-                     && (TS_del_line || TS_del_multi_lines))
-                    || (scroll_region_ok && TS_fwd_scroll && TS_rev_scroll));
+  display->scroll_region_ok
+    = (tty->Wcm->cm_abs
+       && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1));
 
-  char_ins_del_ok = ((TS_ins_char || TS_insert_mode
-                     || TS_pad_inserted_char || TS_ins_multi_chars)
-                    && (TS_del_char || TS_del_multi_chars));
+  display->line_ins_del_ok
+    = (((tty->TS_ins_line || tty->TS_ins_multi_lines)
+        && (tty->TS_del_line || tty->TS_del_multi_lines))
+       || (display->scroll_region_ok
+           && tty->TS_fwd_scroll && tty->TS_rev_scroll));
 
-  fast_clear_end_of_line = TS_clr_line != 0;
+  display->char_ins_del_ok
+    = ((tty->TS_ins_char || tty->TS_insert_mode
+        || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars)
+       && (tty->TS_del_char || tty->TS_del_multi_chars));
 
-  init_baud_rate ();
-  if (read_socket_hook)                /* Baudrate is somewhat */
-                               /* meaningless in this case */
-    baud_rate = 9600;
+  display->fast_clear_end_of_line = tty->TS_clr_line != 0;
 
-  FRAME_CAN_HAVE_SCROLL_BARS (sf) = 0;
-  FRAME_VERTICAL_SCROLL_BAR_TYPE (sf) = vertical_scroll_bar_none;
-#endif /* WINDOWSNT */
+  init_baud_rate (fileno (tty->input));
+
+#ifdef AIXHFT
+  /* The HFT system on AIX doesn't optimize for scrolling, so it's
+     really ugly at times.  */
+  display->line_ins_del_ok = 0;
+  display->char_ins_del_ok = 0;
+#endif
+
+  /* Don't do this.  I think termcap may still need the buffer. */
+  /* xfree (buffer); */
 
-  xfree (buffer);
+  /* Init system terminal modes (RAW or CBREAK, etc.).  */
+  init_sys_modes (tty);
+
+  return display;
+#endif /* not WINDOWSNT */
+}
+
+/* Auxiliary error-handling function for term_init.
+   Free BUFFER and delete DISPLAY, then call error or fatal
+   with str1 or str2, respectively, according to MUST_SUCCEED.  */
+
+static void
+maybe_fatal (must_succeed, buffer, display, str1, str2, arg1, arg2)
+     int must_succeed;
+     char *buffer;
+     struct display *display;
+     char *str1, *str2, *arg1, *arg2;
+{
+  if (buffer)
+    xfree (buffer);
+
+  if (display)
+    delete_tty (display);
+  
+  if (must_succeed)
+    fatal (str2, arg1, arg2);
+  else
+    error (str1, arg1, arg2);
+
+  abort ();
 }
 
 /* VARARGS 1 */
@@ -2693,16 +2968,428 @@ fatal (str, arg1, arg2)
   exit (1);
 }
 
-DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 0, 0,
-       doc: /* Declare that this terminal does not handle underlining.
-This is used to override the terminfo data, for certain terminals that
-do not really do underlining, but say that they do.  */)
+\f
+
+static int deleting_tty = 0;
+
+
+/* Delete the given terminal device, closing all frames on it. */
+
+void
+delete_tty (struct display *display)
+{
+  struct tty_display_info *tty;
+  Lisp_Object tail, frame;
+  char *tty_name;
+  int last_display;
+  
+  if (deleting_tty)
+    /* We get a recursive call when we delete the last frame on this
+       display. */
+    return;
+
+  if (display->type != output_termcap)
+    abort ();
+
+  tty = display->display_info.tty;
+  
+  last_display = 1;
+  FOR_EACH_FRAME (tail, frame)
+    {
+      struct frame *f = XFRAME (frame);
+      if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty))
+        {
+          last_display = 0;
+          break;
+        }
+    }
+  if (last_display)
+      error ("Attempt to delete the sole display with live frames");
+  
+  if (tty == tty_list)
+    tty_list = tty->next;
+  else
+    {
+      struct tty_display_info *p;
+      for (p = tty_list; p && p->next != tty; p = p->next)
+        ;
+
+      if (! p)
+        /* This should not happen. */
+        abort ();
+
+      p->next = tty->next;
+      tty->next = 0;
+    }
+
+  deleting_tty = 1;
+
+  FOR_EACH_FRAME (tail, frame)
+    {
+      struct frame *f = XFRAME (frame);
+      if (FRAME_TERMCAP_P (f) && FRAME_LIVE_P (f) && FRAME_TTY (f) == tty)
+        {
+          Fdelete_frame (frame, Qt);
+        }
+    }
+
+  /* reset_sys_modes needs a valid display, so this call needs to be
+     before delete_display. */
+  reset_sys_modes (tty);
+
+  delete_display (display);
+
+  tty_name = tty->name;
+  if (tty->type)
+    xfree (tty->type);
+
+  if (tty->input)
+    {
+      delete_keyboard_wait_descriptor (fileno (tty->input));
+      if (tty->input != stdin)
+        fclose (tty->input);
+    }
+  if (tty->output && tty->output != stdout && tty->output != tty->input)
+    fclose (tty->output);
+  if (tty->termscript)
+    fclose (tty->termscript);
+
+  if (tty->old_tty)
+    xfree (tty->old_tty);
+
+  if (tty->Wcm)
+    xfree (tty->Wcm);
+
+  bzero (tty, sizeof (struct tty_display_info));
+  xfree (tty);
+  deleting_tty = 0;
+}
+
+\f
+
+/* Initialize the tty-dependent part of frame F.  The frame must
+   already have its display initialized. */
+
+void
+create_tty_output (struct frame *f)
+{
+  struct tty_output *t;
+
+  if (! FRAME_TERMCAP_P (f))
+    abort ();
+
+  t = xmalloc (sizeof (struct tty_output));
+  bzero (t, sizeof (struct tty_output));
+
+  t->display_info = FRAME_DISPLAY (f)->display_info.tty;
+
+  f->output_data.tty = t;
+}
+
+/* Delete the tty-dependent part of frame F. */
+
+void
+delete_tty_output (struct frame *f)
+{
+  if (! FRAME_TERMCAP_P (f))
+    abort ();
+
+  xfree (f->output_data.tty);
+}
+
+
+\f
+
+/* Mark the pointers in the tty_display_info objects.
+   Called by the Fgarbage_collector.  */
+
+void
+mark_ttys ()
+{
+  struct tty_display_info *tty;
+
+  for (tty = tty_list; tty; tty = tty->next)
+    {
+      if (tty->top_frame)
+        mark_object (tty->top_frame);
+    }
+}
+
+\f
+
+/* Create a new display object and add it to the display list. */
+
+struct display *
+create_display (void)
+{
+  struct display *display = (struct display *) xmalloc (sizeof (struct display));
+  
+  bzero (display, sizeof (struct display));
+  display->next_display = display_list;
+  display_list = display;
+
+  display->id = next_display_id++;
+
+  display->keyboard_coding =
+    (struct coding_system *) xmalloc (sizeof (struct coding_system));
+  display->terminal_coding =
+    (struct coding_system *) xmalloc (sizeof (struct coding_system));
+  
+  setup_coding_system (Qnil, display->keyboard_coding);
+  setup_coding_system (Qnil, display->terminal_coding);
+  
+  return display;
+}
+
+/* Remove a display from the display list and free its memory. */
+
+void
+delete_display (struct display *display)
+{
+  struct display **dp;
+  Lisp_Object tail, frame;
+  
+  /* Check for and close live frames that are still on this
+     display. */
+  FOR_EACH_FRAME (tail, frame)
+    {
+      struct frame *f = XFRAME (frame);
+      if (FRAME_LIVE_P (f) && f->display == display)
+        {
+          Fdelete_frame (frame, Qt);
+        }
+    }
+
+  for (dp = &display_list; *dp != display; dp = &(*dp)->next_display)
+    if (! *dp)
+      abort ();
+  *dp = display->next_display;
+
+  if (display->keyboard_coding)
+    xfree (display->keyboard_coding);
+  if (display->terminal_coding)
+    xfree (display->terminal_coding);
+  if (display->name)
+    xfree (display->name);
+  
+#ifdef MULTI_KBOARD
+  if (display->kboard && --display->kboard->reference_count == 0)
+    delete_kboard (display->kboard);
+#endif
+  
+  bzero (display, sizeof (struct display));
+  xfree (display);
+}
+
+DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0,
+       doc: /* Delete DISPLAY by deleting all frames on it and closing the device.
+DISPLAY may be a display id, a frame, or nil for the display
+device of the current frame.
+
+Normally, you may not delete a display if all other displays are suspended,
+but if the second argument FORCE is non-nil, you may do so. */)
+  (display, force)
+     Lisp_Object display, force;
+{
+  struct display *d, *p;
+
+  d = get_display (display, 0);
+
+  if (!d)
+    return Qnil;
+
+  p = display_list;
+  while (p && (p == d || !DISPLAY_ACTIVE_P (p)))
+    p = p->next_display;
+  
+  if (NILP (force) && !p)
+    error ("Attempt to delete the sole active display");
+
+  if (d->delete_display_hook)
+    (*d->delete_display_hook) (d);
+  else
+    delete_display (d);
+
+  return Qnil;
+}
+
+DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0,
+       doc: /* Return non-nil if OBJECT is a display which has not been deleted.
+Value is nil if OBJECT is not a live display.
+If object is a live display, the return value indicates what sort of
+output device it uses.  See the documentation of `framep' for possible
+return values.
+
+Displays are represented by their integer identifiers. */)
+  (object)
+     Lisp_Object object;
+{
+  struct display *d;
+  
+  if (!INTEGERP (object))
+    return Qnil;
+
+  d = get_display (object, 0);
+
+  if (!d)
+    return Qnil;
+
+  switch (d->type)
+    {
+    case output_initial: /* The initial frame is like a termcap frame. */
+    case output_termcap:
+      return Qt;
+    case output_x_window:
+      return Qx;
+    case output_w32:
+      return Qw32;
+    case output_msdos_raw:
+      return Qpc;
+    case output_mac:
+      return Qmac;
+    default:
+      abort ();
+    }
+}
+
+DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0,
+       doc: /* Return a list of all displays.
+Displays are represented by their integer identifiers. */)
   ()
 {
-  TS_enter_underline_mode = 0;
+  Lisp_Object displays = Qnil;
+  struct display *d;
+
+  for (d = display_list; d; d = d->next_display)
+    displays = Fcons (make_number (d->id), displays);
+
+  return displays;
+}
+
+            
+\f
+
+DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
+       doc: /* Suspend the terminal device TTY.
+The terminal is restored to its default state, and Emacs ceases all
+access to the terminal device.  Frames that use the device are not
+deleted, but input is not read from them and if they change, their
+display is not updated.
+
+TTY may be a display id, a frame, or nil for the display device of the
+currently selected frame.
+
+This function runs `suspend-tty-functions' after suspending the
+device.  The functions are run with one arg, the id of the suspended
+display device.
+
+`suspend-tty' does nothing if it is called on an already suspended
+device.
+
+A suspended terminal device may be resumed by calling `resume-tty' on
+it. */)
+  (tty)
+     Lisp_Object tty;
+{
+  struct display *d = get_tty_display (tty);
+  FILE *f;
+  
+  if (!d)
+    error ("Unknown tty device");
+
+  f = d->display_info.tty->input;
+  
+  if (f)
+    {
+      reset_sys_modes (d->display_info.tty);
+
+      delete_keyboard_wait_descriptor (fileno (f));
+      
+      fclose (f);
+      if (f != d->display_info.tty->output)
+        fclose (d->display_info.tty->output);
+      
+      d->display_info.tty->input = 0;
+      d->display_info.tty->output = 0;
+
+      if (FRAMEP (d->display_info.tty->top_frame))
+        FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 0);
+      
+      /* Run `suspend-tty-functions'.  */
+      if (!NILP (Vrun_hooks))
+        {
+          Lisp_Object args[2];
+          args[0] = intern ("suspend-tty-functions");
+          args[1] = make_number (d->id);
+          Frun_hook_with_args (2, args);
+        }
+    }
+
+  return Qnil;
+}
+
+
+DEFUN ("resume-tty", Fresume_tty, Sresume_tty, 0, 1, 0,
+       doc: /* Resume the previously suspended terminal device TTY.
+The terminal is opened and reinitialized.  Frames that are on the
+suspended display are revived.
+
+It is an error to resume a display while another display is active on
+the same device.
+
+This function runs `resume-tty-functions' after resuming the device.
+The functions are run with one arg, the id of the resumed display
+device.
+
+`resume-tty' does nothing if it is called on a device that is not
+suspended.
+
+TTY may be a display id, a frame, or nil for the display device of the
+currently selected frame. */)
+  (tty)
+     Lisp_Object tty;
+{
+  struct display *d = get_tty_display (tty);
+  int fd;
+
+  if (!d)
+    error ("Unknown tty device");
+
+  if (!d->display_info.tty->input)
+    {
+      if (get_named_tty_display (d->display_info.tty->name))
+        error ("Cannot resume display while another display is active on the same device");
+
+      fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0);
+
+      /* XXX What if open fails? */
+
+      dissociate_if_controlling_tty (fd);
+      
+      d->display_info.tty->output = fdopen (fd, "w+");
+      d->display_info.tty->input = d->display_info.tty->output;
+    
+      add_keyboard_wait_descriptor (fd);
+
+      if (FRAMEP (d->display_info.tty->top_frame))
+        FRAME_SET_VISIBLE (XFRAME (d->display_info.tty->top_frame), 1);
+
+      init_sys_modes (d->display_info.tty);
+
+      /* Run `suspend-tty-functions'.  */
+      if (!NILP (Vrun_hooks))
+        {
+          Lisp_Object args[2];
+          args[0] = intern ("resume-tty-functions");
+          args[1] = make_number (d->id);
+          Frun_hook_with_args (2, args);
+        }
+    }
+
   return Qnil;
 }
 
+\f
 void
 syms_of_term ()
 {
@@ -2720,10 +3407,36 @@ This variable can be used by terminal emulator packages.  */);
 The function should accept no arguments.  */);
   Vring_bell_function = Qnil;
 
+  DEFVAR_LISP ("suspend-tty-functions", &Vsuspend_tty_functions,
+    doc: /* Functions to be run after suspending a tty.
+The functions are run with one argument, the name of the tty to be suspended.
+See `suspend-tty'.  */);
+  Vsuspend_tty_functions = Qnil;
+
+
+  DEFVAR_LISP ("resume-tty-functions", &Vresume_tty_functions,
+    doc: /* Functions to be run after resuming a tty.
+The functions are run with one argument, the name of the tty that was revived.
+See `resume-tty'.  */);
+  Vresume_tty_functions = Qnil;
+
   defsubr (&Stty_display_color_p);
   defsubr (&Stty_display_color_cells);
   defsubr (&Stty_no_underline);
+  defsubr (&Sdisplay_name);
+  defsubr (&Sdisplay_tty_type);
+  defsubr (&Sdisplay_controlling_tty_p);
+  defsubr (&Sdelete_display);
+  defsubr (&Sdisplay_live_p);
+  defsubr (&Sdisplay_list);
+  defsubr (&Ssuspend_tty);
+  defsubr (&Sresume_tty);
+
+  Fprovide (intern ("multi-tty"), Qnil);
+
 }
 
+
+
 /* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
    (do not change this comment) */
index 3a3c9978dd6720781b283357972428df525ef312..ad7104ac89c296079b254d4623434da38a54ed78 100644 (file)
@@ -18,32 +18,185 @@ along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* Each termcap frame points to its own struct tty_output object in
+   the output_data.tty field.  The tty_output structure contains the
+   information that is specific to termcap frames. */
 
-/* extern EMACS_INT baud_rate; */              /* Output speed in baud */
-extern int must_write_spaces;  /* Nonzero means spaces in the text
-                                  must actually be output; can't just skip
-                                  over some columns to leave them blank.  */
-extern int min_padding_speed;  /* Speed below which no padding necessary */
-extern int fast_clear_end_of_line; /* Nonzero means terminal has
-                                     command for this */
-
-extern int line_ins_del_ok;    /* Terminal can insert and delete lines */
-extern int char_ins_del_ok;    /* Terminal can insert and delete chars */
-extern int scroll_region_ok;   /* Terminal supports setting the scroll
-                                  window */
-extern int scroll_region_cost; /* Cost of setting the scroll window,
-                                  measured in characters */
-extern int memory_below_frame; /* Terminal remembers lines scrolled
-                                  off bottom */
-extern int fast_clear_end_of_line; /* Terminal has a `ce' string */
-
-extern int dont_calculate_costs; /* Nonzero means don't bother computing
-                                   various cost tables; we won't use them. */
-
-/* Nonzero means no need to redraw the entire frame on resuming
-   a suspended Emacs.  This is useful on terminals with multiple pages,
-   where one page is used for Emacs and another for all else. */
-extern int no_redraw_on_reenter;
+struct tty_output
+{
+  /* The Emacs structure for the tty device this frame is on. */
+  struct tty_display_info *display_info;
+
+  /* There is nothing else here at the moment... */
+};
+
+/* Parameters that are shared between frames on the same tty device. */
+
+struct tty_display_info
+{
+  struct tty_display_info *next; /* Chain of all tty devices. */
+  
+  char *name;                   /* The name of the device file or 0 if
+                                   stdin/stdout. */
+  char *type;                   /* The type of the tty. */
+  
+  /* Input/output */
+  
+  FILE *input;                  /* The stream to be used for terminal input.
+                                   NULL if the terminal is suspended. */
+  FILE *output;                 /* The stream to be used for terminal output.
+                                   NULL if the terminal is suspended. */
+  
+  FILE *termscript;             /* If nonzero, send all terminal output
+                                   characters to this stream also.  */
+
+  struct emacs_tty *old_tty;    /* The initial tty mode bits */
+
+  int term_initted;             /* 1 if we have been through init_sys_modes. */
+
+
+  int reference_count;          /* Number of frames that are on this display. */
+
+  struct display *display;      /* Points back to the generic display
+                                   structure.  This is sometimes handy. */
+  
+  /* Info on cursor positioning.  */
+  struct cm *Wcm;
+
+  /* Redisplay. */
+
+  Lisp_Object top_frame;        /* The topmost frame on this tty. */
+  
+  /* The previous terminal frame we displayed on this tty.  */
+  struct frame *previous_terminal_frame;
+
+  /* Strings, numbers and flags taken from the termcap entry.  */
+
+  char *TS_ins_line;           /* "al" */
+  char *TS_ins_multi_lines;    /* "AL" (one parameter, # lines to insert) */
+  char *TS_bell;                /* "bl" */
+  char *TS_clr_to_bottom;       /* "cd" */
+  char *TS_clr_line;           /* "ce", clear to end of line */
+  char *TS_clr_frame;          /* "cl" */
+  char *TS_set_scroll_region;  /* "cs" (2 params, first line and last line) */
+  char *TS_set_scroll_region_1; /* "cS" (4 params: total lines,
+                                   lines above scroll region, lines below it,
+                                   total lines again) */
+  char *TS_del_char;           /* "dc" */
+  char *TS_del_multi_chars;    /* "DC" (one parameter, # chars to delete) */
+  char *TS_del_line;           /* "dl" */
+  char *TS_del_multi_lines;    /* "DL" (one parameter, # lines to delete) */
+  char *TS_delete_mode;                /* "dm", enter character-delete mode */
+  char *TS_end_delete_mode;    /* "ed", leave character-delete mode */
+  char *TS_end_insert_mode;    /* "ei", leave character-insert mode */
+  char *TS_ins_char;           /* "ic" */
+  char *TS_ins_multi_chars;    /* "IC" (one parameter, # chars to insert) */
+  char *TS_insert_mode;                /* "im", enter character-insert mode */
+  char *TS_pad_inserted_char;  /* "ip".  Just padding, no commands.  */
+  char *TS_end_keypad_mode;    /* "ke" */
+  char *TS_keypad_mode;                /* "ks" */
+  char *TS_pad_char;           /* "pc", char to use as padding */
+  char *TS_repeat;             /* "rp" (2 params, # times to repeat
+                                  and character to be repeated) */
+  char *TS_end_standout_mode;  /* "se" */
+  char *TS_fwd_scroll;         /* "sf" */
+  char *TS_standout_mode;       /* "so" */
+  char *TS_rev_scroll;          /* "sr" */
+  char *TS_end_termcap_modes;   /* "te" */
+  char *TS_termcap_modes;       /* "ti" */
+  char *TS_visible_bell;        /* "vb" */
+  char *TS_cursor_normal;       /* "ve" */
+  char *TS_cursor_visible;      /* "vs" */
+  char *TS_cursor_invisible;    /* "vi" */
+  char *TS_set_window;          /* "wi" (4 params, start and end of window,
+                                   each as vpos and hpos) */
+
+  char *TS_enter_bold_mode;     /* "md" -- turn on bold (extra bright mode).  */
+  char *TS_enter_dim_mode;      /* "mh" -- turn on half-bright mode.  */
+  char *TS_enter_blink_mode;    /* "mb" -- enter blinking mode.  */
+  char *TS_enter_reverse_mode;  /* "mr" -- enter reverse video mode.  */
+  char *TS_exit_underline_mode; /* "us" -- start underlining.  */
+  char *TS_enter_underline_mode; /* "ue" -- end underlining.  */
+
+  /* "as"/"ae" -- start/end alternate character set.  Not really
+     supported, yet.  */
+  char *TS_enter_alt_charset_mode;
+  char *TS_exit_alt_charset_mode;
+
+  char *TS_exit_attribute_mode; /* "me" -- switch appearances off.  */
+
+  /* Value of the "NC" (no_color_video) capability, or 0 if not present.  */
+  int TN_no_color_video;
+
+  int TN_max_colors;            /* "Co" -- number of colors.  */
+
+  /* "pa" -- max. number of color pairs on screen.  Not handled yet.
+     Could be a problem if not equal to TN_max_colors * TN_max_colors.  */
+  int TN_max_pairs;
+
+  /* "op" -- SVr4 set default pair to its original value.  */
+  char *TS_orig_pair;
+
+  /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color.
+     1 param, the color index.  */
+  char *TS_set_foreground;
+  char *TS_set_background;
+
+  int TF_hazeltine;             /* termcap hz flag. */
+  int TF_insmode_motion;        /* termcap mi flag: can move while in insert mode. */
+  int TF_standout_motion;       /* termcap mi flag: can move while in standout mode. */
+  int TF_underscore;            /* termcap ul flag: _ underlines if over-struck on
+                                   non-blank position.  Must clear before writing _.  */
+  int TF_teleray;               /* termcap xt flag: many weird consequences.
+                                   For t1061. */
+
+  int RPov;                     /* # chars to start a TS_repeat */
+
+  int delete_in_insert_mode;    /* delete mode == insert mode */
+  
+  int se_is_so;                 /* 1 if same string both enters and leaves
+                                   standout mode */
+  
+  int costs_set;                /* Nonzero if costs have been calculated. */
+  
+  int insert_mode;              /* Nonzero when in insert mode.  */
+  int standout_mode;            /* Nonzero when in standout mode.  */
+
+
+
+  /* 1 if should obey 0200 bit in input chars as "Meta", 2 if should
+     keep 0200 bit in input chars.  0 to ignore the 0200 bit.  */
+
+  int meta_key;
+
+  /* Size of window specified by higher levels.
+   This is the number of lines, from the top of frame downwards,
+   which can participate in insert-line/delete-line operations.
+
+   Effectively it excludes the bottom frame_lines - specified_window_size
+   lines from those operations.  */
+
+  int specified_window;
+  
+  /* Flag used in tty_show/hide_cursor.  */
+
+  int cursor_hidden;
+
+  /* Nonzero means use ^S/^Q for flow control.  */
+  int flow_control;
+
+};
+
+/* A chain of structures for all tty devices currently in use. */
+extern struct tty_display_info *tty_list;
+
+
+#define FRAME_TTY(f)                            \
+  ((f)->output_method == output_termcap         \
+   ? (f)->display->display_info.tty             \
+   : (abort(), (struct tty_display_info *) 0))
+
+#define CURTTY() FRAME_TTY (SELECTED_FRAME())
 
 /* arch-tag: bf9f0d49-842b-42fb-9348-ec8759b27193
    (do not change this comment) */
index 395e179ff49232e1e7eee0d03cbf5913bdf605d1..cce8f37f99e515abced71fde6d2a03b508dd2316 100644 (file)
@@ -1,5 +1,4 @@
-/* Hooks by which low level terminal operations
-   can be made to call other routines.
+/* Parameters and display hooks for output devices
    Copyright (C) 1985,86,93,94,2003  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -25,40 +24,11 @@ Boston, MA 02110-1301, USA.  */
 struct glyph;
 struct frame;
 
-/* If nonzero, send all terminal output characters to this stream also.  */
-extern FILE *termscript;
-
 /* Only use prototypes when lisp.h has been included.  */
 #ifndef P_
 #define P_(X) ()
 #endif
 \f
-/* Text display hooks.  */
-
-extern void (*cursor_to_hook) P_ ((int vpos, int hpos));
-extern void (*raw_cursor_to_hook) P_ ((int, int));
-
-extern void (*clear_to_end_hook) P_ ((void));
-extern void (*clear_frame_hook) P_ ((void));
-extern void (*clear_end_of_line_hook) P_ ((int));
-
-extern void (*ins_del_lines_hook) P_ ((int, int));
-
-extern void (*insert_glyphs_hook) P_ ((struct glyph *s, int n));
-extern void (*write_glyphs_hook) P_ ((struct glyph *s, int n));
-extern void (*delete_glyphs_hook) P_ ((int));
-
-extern void (*ring_bell_hook) P_ ((void));
-
-extern void (*reset_terminal_modes_hook) P_ ((void));
-extern void (*set_terminal_modes_hook) P_ ((void));
-extern void (*update_begin_hook) P_ ((struct frame *));
-extern void (*update_end_hook) P_ ((struct frame *));
-extern void (*set_terminal_window_hook) P_ ((int));
-
-
-\f
-/* Multi-frame and mouse support hooks.  */
 
 enum scroll_bar_part {
   scroll_bar_above_handle,
@@ -72,125 +42,6 @@ enum scroll_bar_part {
   scroll_bar_move_ratio
 };
 
-/* Return the current position of the mouse.
-
-   Set *f to the frame the mouse is in, or zero if the mouse is in no
-   Emacs frame.  If it is set to zero, all the other arguments are
-   garbage.
-
-   If the motion started in a scroll bar, set *bar_window to the
-   scroll bar's window, *part to the part the mouse is currently over,
-   *x to the position of the mouse along the scroll bar, and *y to the
-   overall length of the scroll bar.
-
-   Otherwise, set *bar_window to Qnil, and *x and *y to the column and
-   row of the character cell the mouse is over.
-
-   Set *time to the time the mouse was at the returned position.
-
-   This should clear mouse_moved until the next motion
-   event arrives.  */
-extern void (*mouse_position_hook) P_ ((struct frame **f, int,
-                                       Lisp_Object *bar_window,
-                                       enum scroll_bar_part *part,
-                                       Lisp_Object *x,
-                                       Lisp_Object *y,
-                                       unsigned long *time));
-
-/* The window system handling code should set this if the mouse has
-   moved since the last call to the mouse_position_hook.  Calling that
-   hook should clear this.  */
-extern int mouse_moved;
-
-/* When a frame's focus redirection is changed, this hook tells the
-   window system code to re-decide where to put the highlight.  Under
-   X, this means that Emacs lies about where the focus is.  */
-extern void (*frame_rehighlight_hook) P_ ((struct frame *));
-
-/* If we're displaying frames using a window system that can stack
-   frames on top of each other, this hook allows you to bring a frame
-   to the front, or bury it behind all the other windows.  If this
-   hook is zero, that means the device we're displaying on doesn't
-   support overlapping frames, so there's no need to raise or lower
-   anything.
-
-   If RAISE is non-zero, F is brought to the front, before all other
-   windows.  If RAISE is zero, F is sent to the back, behind all other
-   windows.  */
-extern void (*frame_raise_lower_hook) P_ ((struct frame *f, int raise));
-
-\f
-/* Scroll bar hooks.  */
-
-/* The representation of scroll bars is determined by the code which
-   implements them, except for one thing: they must be represented by
-   lisp objects.  This allows us to place references to them in
-   Lisp_Windows without worrying about those references becoming
-   dangling references when the scroll bar is destroyed.
-
-   The window-system-independent portion of Emacs just refers to
-   scroll bars via their windows, and never looks inside the scroll bar
-   representation; it always uses hook functions to do all the
-   scroll bar manipulation it needs.
-
-   The `vertical_scroll_bar' field of a Lisp_Window refers to that
-   window's scroll bar, or is nil if the window doesn't have a
-   scroll bar.
-
-   The `scroll_bars' and `condemned_scroll_bars' fields of a Lisp_Frame
-   are free for use by the scroll bar implementation in any way it sees
-   fit.  They are marked by the garbage collector.  */
-
-
-/* Set the vertical scroll bar for WINDOW to have its upper left corner
-   at (TOP, LEFT), and be LENGTH rows high.  Set its handle to
-   indicate that we are displaying PORTION characters out of a total
-   of WHOLE characters, starting at POSITION.  If WINDOW doesn't yet
-   have a scroll bar, create one for it.  */
-extern void (*set_vertical_scroll_bar_hook)
-            P_ ((struct window *window,
-                int portion, int whole, int position));
-
-
-/* The following three hooks are used when we're doing a thorough
-   redisplay of the frame.  We don't explicitly know which scroll bars
-   are going to be deleted, because keeping track of when windows go
-   away is a real pain - can you say set-window-configuration?
-   Instead, we just assert at the beginning of redisplay that *all*
-   scroll bars are to be removed, and then save scroll bars from the
-   fiery pit when we actually redisplay their window.  */
-
-/* Arrange for all scroll bars on FRAME to be removed at the next call
-   to `*judge_scroll_bars_hook'.  A scroll bar may be spared if
-   `*redeem_scroll_bar_hook' is applied to its window before the judgement.
-
-   This should be applied to each frame each time its window tree is
-   redisplayed, even if it is not displaying scroll bars at the moment;
-   if the HAS_SCROLL_BARS flag has just been turned off, only calling
-   this and the judge_scroll_bars_hook will get rid of them.
-
-   If non-zero, this hook should be safe to apply to any frame,
-   whether or not it can support scroll bars, and whether or not it is
-   currently displaying them.  */
-extern void (*condemn_scroll_bars_hook) P_ ((struct frame *frame));
-
-/* Unmark WINDOW's scroll bar for deletion in this judgement cycle.
-   Note that it's okay to redeem a scroll bar that is not condemned.  */
-extern void (*redeem_scroll_bar_hook) P_ ((struct window *window));
-
-/* Remove all scroll bars on FRAME that haven't been saved since the
-   last call to `*condemn_scroll_bars_hook'.
-
-   This should be applied to each frame after each time its window
-   tree is redisplayed, even if it is not displaying scroll bars at the
-   moment; if the HAS_SCROLL_BARS flag has just been turned off, only
-   calling this and condemn_scroll_bars_hook will get rid of them.
-
-   If non-zero, this hook should be safe to apply to any frame,
-   whether or not it can support scroll bars, and whether or not it is
-   currently displaying them.  */
-extern void (*judge_scroll_bars_hook) P_ ((struct frame *FRAME));
-
 \f
 /* Input queue declarations and hooks.  */
 
@@ -374,13 +225,6 @@ struct input_event
 
 #define EVENT_INIT(event) bzero (&(event), sizeof (struct input_event))
 
-/* Called to read input events.  */
-extern int (*read_socket_hook) P_ ((int, int, struct input_event *));
-
-/* Called when a frame's display becomes entirely up to date.  */
-extern void (*frame_up_to_date_hook) P_ ((struct frame *));
-\f
-
 /* Bits in the modifiers member of the input_event structure.
    Note that reorder_modifiers assumes that the bits are in canonical
    order.
@@ -430,7 +274,318 @@ enum {
   meta_modifier        =  CHAR_META    /* Under X, the XK_Meta_[LR] keysyms.  */
 };
 
+#endif /* CONSP */
+
+\f
+/* Display-local parameters. */
+struct display
+{
+  /* Chain of all displays. */
+  struct display *next_display;
+
+  /* Unique id for this display. */
+  int id;
+
+  /* The number of frames that are on this display. */
+  int reference_count;
+  
+  /* The type of the display. */
+  enum output_method type;
+
+  /* The name of the display device.  Do not use this to identify the display. */
+  char *name;
+
+#ifdef MULTI_KBOARD
+  /* The device's keyboard object. */
+  struct kboard *kboard;
 #endif
 
+  /* Display-type dependent data shared amongst all frames on this display. */
+  union display_info
+  {
+    struct tty_display_info *tty;     /* termchar.h */
+    struct x_display_info *x;         /* xterm.h */
+  } display_info;
+
+\f
+  /* Coding-system to be used for encoding terminal output.  This
+     structure contains information of a coding-system specified by
+     the function `set-terminal-coding-system'.  Also see
+     `safe_terminal_coding' in coding.h.  */
+  struct coding_system *terminal_coding;
+
+  /* Coding-system of what is sent from terminal keyboard.  This
+     structure contains information of a coding-system specified by
+     the function `set-keyboard-coding-system'.  */
+  struct coding_system *keyboard_coding;
+
+  /* Terminal characteristics. */
+  /* XXX Are these really used on non-termcap displays? */
+  
+  int must_write_spaces;       /* Nonzero means spaces in the text must
+                                  actually be output; can't just skip over
+                                  some columns to leave them blank.  */
+  int fast_clear_end_of_line;   /* Nonzero means terminal has a `ce' string */
+  
+  int line_ins_del_ok;          /* Terminal can insert and delete lines */
+  int char_ins_del_ok;          /* Terminal can insert and delete chars */
+  int scroll_region_ok;         /* Terminal supports setting the scroll
+                                   window */
+  int scroll_region_cost;      /* Cost of setting the scroll window,
+                                   measured in characters. */
+  int memory_below_frame;      /* Terminal remembers lines scrolled
+                                   off bottom */
+
+#if 0  /* These are not used anywhere. */
+  /* EMACS_INT baud_rate; */   /* Output speed in baud */
+  int min_padding_speed;       /* Speed below which no padding necessary. */
+  int dont_calculate_costs;     /* Nonzero means don't bother computing
+                                   various cost tables; we won't use them. */
+#endif
+
+\f
+  /* Window-based redisplay interface for this device (0 for tty
+     devices). */
+  struct redisplay_interface *rif;
+
+  /* Frame-based redisplay interface. */
+  
+  /* Text display hooks.  */
+
+  void (*cursor_to_hook) P_ ((struct frame *f, int vpos, int hpos));
+  void (*raw_cursor_to_hook) P_ ((struct frame *, int, int));
+  
+  void (*clear_to_end_hook) P_ ((struct frame *));
+  void (*clear_frame_hook) P_ ((struct frame *));
+  void (*clear_end_of_line_hook) P_ ((struct frame *, int));
+  
+  void (*ins_del_lines_hook) P_ ((struct frame *f, int, int));
+  
+  void (*insert_glyphs_hook) P_ ((struct frame *f, struct glyph *s, int n));
+  void (*write_glyphs_hook) P_ ((struct frame *f, struct glyph *s, int n));
+  void (*delete_glyphs_hook) P_ ((struct frame *, int));
+  
+  void (*ring_bell_hook) P_ ((struct frame *f));
+  
+  void (*reset_terminal_modes_hook) P_ ((struct display *));
+  void (*set_terminal_modes_hook) P_ ((struct display *));
+
+  void (*update_begin_hook) P_ ((struct frame *));
+  void (*update_end_hook) P_ ((struct frame *));
+  void (*set_terminal_window_hook) P_ ((struct frame *, int));
+
+  /* Multi-frame and mouse support hooks.  */
+
+  /* Return the current position of the mouse.
+
+     Set *f to the frame the mouse is in, or zero if the mouse is in no
+     Emacs frame.  If it is set to zero, all the other arguments are
+     garbage.
+  
+     If the motion started in a scroll bar, set *bar_window to the
+     scroll bar's window, *part to the part the mouse is currently over,
+     *x to the position of the mouse along the scroll bar, and *y to the
+     overall length of the scroll bar.
+
+     Otherwise, set *bar_window to Qnil, and *x and *y to the column and
+     row of the character cell the mouse is over.
+
+     Set *time to the time the mouse was at the returned position.
+     
+     This should clear mouse_moved until the next motion
+     event arrives.  */
+  void (*mouse_position_hook) P_ ((struct frame **f, int,
+                                   Lisp_Object *bar_window,
+                                   enum scroll_bar_part *part,
+                                   Lisp_Object *x,
+                                   Lisp_Object *y,
+                                   unsigned long *time));
+
+  /* The window system handling code should set this if the mouse has
+     moved since the last call to the mouse_position_hook.  Calling that
+     hook should clear this.  */
+  int mouse_moved;
+
+  /* When a frame's focus redirection is changed, this hook tells the
+     window system code to re-decide where to put the highlight.  Under
+     X, this means that Emacs lies about where the focus is.  */
+  void (*frame_rehighlight_hook) P_ ((struct frame *));
+
+  /* If we're displaying frames using a window system that can stack
+     frames on top of each other, this hook allows you to bring a frame
+     to the front, or bury it behind all the other windows.  If this
+     hook is zero, that means the device we're displaying on doesn't
+     support overlapping frames, so there's no need to raise or lower
+     anything.
+     
+     If RAISE is non-zero, F is brought to the front, before all other
+     windows.  If RAISE is zero, F is sent to the back, behind all other
+     windows.  */
+  void (*frame_raise_lower_hook) P_ ((struct frame *f, int raise));
+
+  \f
+  /* Scroll bar hooks.  */
+
+  /* The representation of scroll bars is determined by the code which
+     implements them, except for one thing: they must be represented by
+     lisp objects.  This allows us to place references to them in
+     Lisp_Windows without worrying about those references becoming
+     dangling references when the scroll bar is destroyed.
+     
+     The window-system-independent portion of Emacs just refers to
+     scroll bars via their windows, and never looks inside the scroll bar
+     representation; it always uses hook functions to do all the
+     scroll bar manipulation it needs.
+     
+     The `vertical_scroll_bar' field of a Lisp_Window refers to that
+     window's scroll bar, or is nil if the window doesn't have a
+     scroll bar.
+     
+     The `scroll_bars' and `condemned_scroll_bars' fields of a Lisp_Frame
+     are free for use by the scroll bar implementation in any way it sees
+     fit.  They are marked by the garbage collector.  */
+  
+  
+  /* Set the vertical scroll bar for WINDOW to have its upper left corner
+     at (TOP, LEFT), and be LENGTH rows high.  Set its handle to
+     indicate that we are displaying PORTION characters out of a total
+     of WHOLE characters, starting at POSITION.  If WINDOW doesn't yet
+     have a scroll bar, create one for it.  */
+  void (*set_vertical_scroll_bar_hook) P_ ((struct window *window,
+                                            int portion, int whole,
+                                            int position));
+
+
+  /* The following three hooks are used when we're doing a thorough
+     redisplay of the frame.  We don't explicitly know which scroll bars
+     are going to be deleted, because keeping track of when windows go
+     away is a real pain - can you say set-window-configuration?
+     Instead, we just assert at the beginning of redisplay that *all*
+     scroll bars are to be removed, and then save scroll bars from the
+     fiery pit when we actually redisplay their window.  */
+  
+  /* Arrange for all scroll bars on FRAME to be removed at the next call
+     to `*judge_scroll_bars_hook'.  A scroll bar may be spared if
+     `*redeem_scroll_bar_hook' is applied to its window before the judgement.
+     
+     This should be applied to each frame each time its window tree is
+     redisplayed, even if it is not displaying scroll bars at the moment;
+     if the HAS_SCROLL_BARS flag has just been turned off, only calling
+     this and the judge_scroll_bars_hook will get rid of them.
+     
+     If non-zero, this hook should be safe to apply to any frame,
+     whether or not it can support scroll bars, and whether or not it is
+     currently displaying them.  */
+  void (*condemn_scroll_bars_hook) P_ ((struct frame *frame));
+
+  /* Unmark WINDOW's scroll bar for deletion in this judgement cycle.
+     Note that it's okay to redeem a scroll bar that is not condemned.  */
+  void (*redeem_scroll_bar_hook) P_ ((struct window *window));
+
+  /* Remove all scroll bars on FRAME that haven't been saved since the
+     last call to `*condemn_scroll_bars_hook'.
+
+     This should be applied to each frame after each time its window
+     tree is redisplayed, even if it is not displaying scroll bars at the
+     moment; if the HAS_SCROLL_BARS flag has just been turned off, only
+     calling this and condemn_scroll_bars_hook will get rid of them.
+     
+     If non-zero, this hook should be safe to apply to any frame,
+     whether or not it can support scroll bars, and whether or not it is
+     currently displaying them.  */
+  void (*judge_scroll_bars_hook) P_ ((struct frame *FRAME));
+
+\f
+  /* Called to read input events.
+
+     DISPLAY indicates which display to read from.  Input events
+     should be read into BUF, the size of which is given in SIZE.
+     EXPECTED is non-zero if the caller suspects that new input is
+     available.
+
+     A positive return value indicates that that many input events
+     where read into BUF.
+     Zero means no events were immediately available.
+     A value of -1 means a transient read error, while -2 indicates
+     that the display was closed (hangup), and it should be deleted.
+
+     XXX Please note that a non-zero value of EXPECTED only means that
+     there is available input on at least one of the currently opened
+     display devices -- but not necessarily on this device.
+     Therefore, in most cases EXPECTED should be simply ignored.
+
+     XXX This documentation needs to be updated.  */
+  int (*read_socket_hook) P_ ((struct display *display,
+                               int expected,
+                               struct input_event *hold_quit));
+
+  /* Called when a frame's display becomes entirely up to date.  */
+  void (*frame_up_to_date_hook) P_ ((struct frame *));
+
+\f
+  /* Called to delete the device-specific portions of a frame that is
+     on this display. */
+  void (*delete_frame_hook) P_ ((struct frame *));
+
+  /* Called after the last frame on this display is deleted, or when
+     the display device was closed (hangup).
+     
+     If this is NULL, then the generic delete_display is called
+     instead.  Otherwise the hook must call delete_display itself.
+
+     The hook must check for and close any live frames that are still
+     on the display.  Fdelete_frame ensures that there are no live
+     frames on the display when it calls this hook, so infinite
+     recursion is prevented.  */
+  void (*delete_display_hook) P_ ((struct display *));
+};
+
+
+/* Chain of all displays currently in use. */
+extern struct display *display_list;
+
+#define FRAME_MUST_WRITE_SPACES(f) ((f)->display->must_write_spaces)
+#define FRAME_FAST_CLEAR_END_OF_LINE(f) ((f)->display->fast_clear_end_of_line)
+#define FRAME_LINE_INS_DEL_OK(f) ((f)->display->line_ins_del_ok)
+#define FRAME_CHAR_INS_DEL_OK(f) ((f)->display->char_ins_del_ok)
+#define FRAME_SCROLL_REGION_OK(f) ((f)->display->scroll_region_ok)
+#define FRAME_SCROLL_REGION_COST(f) ((f)->display->scroll_region_cost)
+#define FRAME_MEMORY_BELOW_FRAME(f) ((f)->display->memory_below_frame)
+
+#define FRAME_TERMINAL_CODING(f) ((f)->display->terminal_coding)
+#define FRAME_KEYBOARD_CODING(f) ((f)->display->keyboard_coding)
+
+#define DISPLAY_TERMINAL_CODING(d) ((d)->terminal_coding)
+#define DISPLAY_KEYBOARD_CODING(d) ((d)->keyboard_coding)
+
+#define FRAME_RIF(f) ((f)->display->rif)
+
+#define FRAME_DISPLAY(f) ((f)->display)
+
+/* FRAME_WINDOW_P tests whether the frame is a window, and is
+   defined to be the predicate for the window system being used.  */
+
+#ifdef HAVE_X_WINDOWS
+#define FRAME_WINDOW_P(f) FRAME_X_P (f)
+#endif
+#ifdef HAVE_NTGUI
+#define FRAME_WINDOW_P(f) FRAME_W32_P (f)
+#endif
+#ifdef MAC_OS
+#define FRAME_WINDOW_P(f) FRAME_MAC_P (f)
+#endif
+#ifndef FRAME_WINDOW_P
+#define FRAME_WINDOW_P(f) (0)
+#endif
+
+/* Return true if the display is not suspended. */
+#define DISPLAY_ACTIVE_P(d) ((d)->type != output_termcap || (d)->display_info.tty->input)
+
+extern struct display *create_display P_ ((void));
+extern void delete_display P_ ((struct display *));
+
+/* The initial display device, created by initial_term_init. */
+extern struct display *initial_display;
+
 /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d
    (do not change this comment) */
index 9d241f64678a508be4c4adc11b957bf55a131f33..94d3f3bb9d71b6375f7b4e3ec92342fc46099015 100644 (file)
@@ -40,5 +40,10 @@ extern int meta_key;
 /* Nonzero means truncate lines in all windows less wide than the frame */
 extern int truncate_partial_width_windows;
 
+/* Nonzero means no need to redraw the entire frame on resuming a suspended
+   Emacs.  This is useful on terminals with multiple pages, where one page is
+   used for Emacs and another for all else. */
+extern int no_redraw_on_reenter;
+
 /* arch-tag: 35d4d284-dc1a-4fff-97fa-0154a21aebdb
    (do not change this comment) */
index b6cc61df2a5a690af2d77d1a417497e52f42edcf..abf8e377ef1664b2bc2d629ccbd43ea373941abc 100644 (file)
@@ -6409,12 +6409,13 @@ w32_initialize ()
   redeem_scroll_bar_hook = w32_redeem_scroll_bar;
   judge_scroll_bars_hook = w32_judge_scroll_bars;
 
-  scroll_region_ok = 1;         /* we'll scroll partial frames */
-  char_ins_del_ok = 1;
-  line_ins_del_ok = 1;          /* we'll just blt 'em */
-  fast_clear_end_of_line = 1;   /* X does this well */
-  memory_below_frame = 0;       /* we don't remember what scrolls
-                                  off the bottom */
+  TTY_SCROLL_REGION_OK (CURTTY ()) = 1; /* we'll scroll partial frames */
+  TTY_CHAR_INS_DEL_OK (CURTTY ()) = 1;
+  TTY_LINE_INS_DEL_OK (CURTTY ()) = 1; /* we'll just blt 'em */
+  TTY_FAST_CLEAR_END_OF_LINE (CURTTY ()) = 1; /* X does this well */
+  TTY_MEMORY_BELOW_FRAME (CURTTY ()) = 0; /* we don't remember what
+                                                            scrolls off the
+                                                            bottom */
   baud_rate = 19200;
 
   w32_system_caret_hwnd = NULL;
index cc305485f1f1d65b73bb8b2539f5dacb62aa97ca..1557a45653f2a660c67c14e2e37c25a21c9cc1ff 100644 (file)
@@ -410,8 +410,6 @@ extern struct w32_output w32term_display;
 #define FRAME_W32_WINDOW(f) ((f)->output_data.w32->window_desc)
 #define FRAME_X_WINDOW(f) ((f)->output_data.w32->window_desc)
 
-#define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_pixel)
-#define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_pixel)
 #define FRAME_FONT(f) ((f)->output_data.w32->font)
 #define FRAME_FONTSET(f) ((f)->output_data.w32->fontset)
 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.w32->baseline_offset)
index 6155aeddc6bcf1b30ddf826eb05cffbeb3cf5649..68b2d4f89c739ff089c122e5f246ff56c07d59c7 100644 (file)
@@ -21,6 +21,8 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
+#include <stdio.h>
+
 #include "lisp.h"
 #include "buffer.h"
 #include "keyboard.h"
@@ -6701,7 +6703,7 @@ and scrolling positions.  */)
 void
 init_window_once ()
 {
-  struct frame *f = make_terminal_frame ();
+  struct frame *f = make_initial_frame ();
   XSETFRAME (selected_frame, f);
   Vterminal_frame = selected_frame;
   minibuf_window = f->minibuffer_window;
index 99274e04ad1961fdfecaa15c1a379dcd4e158b64..7e34ddee26c23614ca20265cf642ed5b7fc908ab 100644 (file)
@@ -749,7 +749,7 @@ extern Lisp_Object Vminibuf_scroll_window;
 /* Nil or a symbol naming the window system under which emacs is
    running ('x is the only current possibility) */
 
-extern Lisp_Object Vwindow_system;
+extern Lisp_Object Vinitial_window_system;
 
 /* Version number of X windows: 10, 11 or nil.  */
 
index 5ed987cf84d408996cd344d7c27f18072f2a3b65..a1ff09739d04243b0b4ebcacc0bf44a5e0fd36b6 100644 (file)
@@ -571,21 +571,12 @@ Lisp_Object Vmessage_log_max;
 
 static Lisp_Object Vmessages_buffer_name;
 
-/* Index 0 is the buffer that holds the current (desired) echo area message,
-   or nil if none is desired right now.
-
-   Index 1 is the buffer that holds the previously displayed echo area message,
-   or nil to indicate no message.  This is normally what's on the screen now.
-
-   These two can point to the same buffer.  That happens when the last
-   message output by the user (or made by echoing) has been displayed.  */
+/* Current, index 0, and last displayed echo area message.  Either
+   buffers from echo_buffers, or nil to indicate no message.  */
 
 Lisp_Object echo_area_buffer[2];
 
-/* Permanent pointers to the two buffers that are used for echo area
-   purposes.  Once the two buffers are made, and their pointers are
-   placed here, these two slots remain unchanged unless those buffers
-   need to be created afresh.  */
+/* The buffers referenced from echo_area_buffer.  */
 
 static Lisp_Object echo_buffer[2];
 
@@ -795,10 +786,6 @@ static int clear_face_cache_count;
 static int clear_image_cache_count;
 #endif
 
-/* Record the previous terminal frame we displayed.  */
-
-static struct frame *previous_terminal_frame;
-
 /* Non-zero while redisplay_internal is in progress.  */
 
 int redisplaying_p;
@@ -2183,7 +2170,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
   XSETWINDOW (it->window, w);
   it->w = w;
   it->f = XFRAME (w->frame);
-
+  
   /* Extra space between lines (on window systems only).  */
   if (base_face_id == DEFAULT_FACE_ID
       && FRAME_WINDOW_P (it->f))
@@ -2200,9 +2187,9 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
 
   /* If realized faces have been removed, e.g. because of face
      attribute changes of named faces, recompute them.  When running
-     in batch mode, the face cache of Vterminal_frame is null.  If
+     in batch mode, the face cache of the initial frame is null.  If
      we happen to get called, make a dummy face cache.  */
-  if (noninteractive && FRAME_FACE_CACHE (it->f) == NULL)
+  if (FRAME_FACE_CACHE (it->f) == NULL)
     init_frame_faces (it->f);
   if (FRAME_FACE_CACHE (it->f)->used == 0)
     recompute_basic_faces (it->f);
@@ -3579,7 +3566,7 @@ handle_single_display_spec (it, spec, object, position,
       && EQ (XCAR (spec), Qheight)
       && CONSP (XCDR (spec)))
     {
-      if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+      if (!FRAME_WINDOW_P (it->f))
        return 0;
 
       it->font_height = XCAR (XCDR (spec));
@@ -3645,7 +3632,7 @@ handle_single_display_spec (it, spec, object, position,
       && EQ (XCAR (spec), Qspace_width)
       && CONSP (XCDR (spec)))
     {
-      if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+      if (!FRAME_WINDOW_P (it->f))
        return 0;
 
       value = XCAR (XCDR (spec));
@@ -3661,7 +3648,7 @@ handle_single_display_spec (it, spec, object, position,
     {
       Lisp_Object tem;
 
-      if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+      if (!FRAME_WINDOW_P (it->f))
        return 0;
 
       if (tem = XCDR (spec), CONSP (tem))
@@ -3687,7 +3674,7 @@ handle_single_display_spec (it, spec, object, position,
       && EQ (XCAR (spec), Qraise)
       && CONSP (XCDR (spec)))
     {
-      if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+      if (!FRAME_WINDOW_P (it->f))
        return 0;
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -3728,7 +3715,7 @@ handle_single_display_spec (it, spec, object, position,
       int face_id = DEFAULT_FACE_ID;
       int fringe_bitmap;
 
-      if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+      if (!FRAME_WINDOW_P (it->f))
        /* If we return here, POSITION has been advanced
           across the text with this property.  */
        return 0;
@@ -3774,7 +3761,7 @@ handle_single_display_spec (it, spec, object, position,
          it->left_user_fringe_face_id = face_id;
        }
       else
-       {
+        {
          it->right_user_fringe_bitmap = fringe_bitmap;
          it->right_user_fringe_face_id = face_id;
        }
@@ -3819,16 +3806,15 @@ handle_single_display_spec (it, spec, object, position,
 
   valid_p = (STRINGP (value)
 #ifdef HAVE_WINDOW_SYSTEM
-            || (!FRAME_TERMCAP_P (it->f) && valid_image_p (value))
+             || (FRAME_WINDOW_P (it->f) && valid_image_p (value))
 #endif /* not HAVE_WINDOW_SYSTEM */
-            || (CONSP (value) && EQ (XCAR (value), Qspace)));
+             || (CONSP (value) && EQ (XCAR (value), Qspace)));
 
   if (valid_p && !display_replaced_before_p)
     {
       /* Save current settings of IT so that we can restore them
         when we are finished with the glyph property value.  */
       push_it (it);
-
       if (NILP (location))
        it->area = TEXT_AREA;
       else if (EQ (location, Qleft_margin))
@@ -3861,6 +3847,7 @@ handle_single_display_spec (it, spec, object, position,
          it->method = GET_FROM_STRETCH;
          it->object = value;
          it->current.pos = it->position = start_pos;
+
        }
 #ifdef HAVE_WINDOW_SYSTEM
       else
@@ -3888,7 +3875,7 @@ handle_single_display_spec (it, spec, object, position,
 }
 
 
-/* Check if SPEC is a display specification value whose text should be
+/* Check if SPEC is a display sub-property value whose text should be
    treated as intangible.  */
 
 static int
@@ -6971,8 +6958,8 @@ message2_nolog (m, nbytes, multibyte)
       do_pending_window_change (0);
       echo_area_display (1);
       do_pending_window_change (0);
-      if (frame_up_to_date_hook != 0 && ! gc_in_progress)
-       (*frame_up_to_date_hook) (f);
+      if (FRAME_DISPLAY (f)->frame_up_to_date_hook != 0 && ! gc_in_progress)
+       (*FRAME_DISPLAY (f)->frame_up_to_date_hook) (f);
     }
 }
 
@@ -7064,8 +7051,8 @@ message3_nolog (m, nbytes, multibyte)
       do_pending_window_change (0);
       echo_area_display (1);
       do_pending_window_change (0);
-      if (frame_up_to_date_hook != 0 && ! gc_in_progress)
-       (*frame_up_to_date_hook) (f);
+      if (FRAME_DISPLAY (f)->frame_up_to_date_hook != 0 && ! gc_in_progress)
+       (*FRAME_DISPLAY (f)->frame_up_to_date_hook) (f);
     }
 }
 
@@ -7303,6 +7290,10 @@ ensure_echo_area_buffers ()
    WHICH > 0 means use echo_area_buffer[1].  If that is nil, choose a
    suitable buffer from echo_buffer[] and clear it.
 
+   If WHICH < 0, set echo_area_buffer[1] to echo_area_buffer[0], so
+   that the current message becomes the last displayed one, make
+   choose a suitable buffer for echo_area_buffer[0], and clear it.
+
    Value is what FN returns.  */
 
 static int
@@ -7327,6 +7318,17 @@ with_echo_area_buffer (w, which, fn, a1, a2, a3, a4)
     this_one = 0, the_other = 1;
   else if (which > 0)
     this_one = 1, the_other = 0;
+  else
+    {
+      this_one = 0, the_other = 1;
+      clear_buffer_p = 1;
+
+      /* We need a fresh one in case the current echo buffer equals
+        the one containing the last displayed echo area message.  */
+      if (!NILP (echo_area_buffer[this_one])
+         && EQ (echo_area_buffer[this_one], echo_area_buffer[the_other]))
+       echo_area_buffer[this_one] = Qnil;
+    }
 
   /* Choose a suitable buffer from echo_buffer[] is we don't
      have one.  */
@@ -7946,7 +7948,7 @@ set_message (s, string, nbytes, multibyte_p)
     = ((s && multibyte_p)
        || (STRINGP (string) && STRING_MULTIBYTE (string)));
 
-  with_echo_area_buffer (0, 0, set_message_1,
+  with_echo_area_buffer (0, -1, set_message_1,
                         (EMACS_INT) s, string, nbytes, multibyte_p);
   message_buf_print = 0;
   help_echo_showing_p = 0;
@@ -7976,7 +7978,6 @@ set_message_1 (a1, a2, nbytes, multibyte_p)
 
   /* Insert new message at BEG.  */
   TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
-  Ferase_buffer ();
 
   if (STRINGP (string))
     {
@@ -8072,11 +8073,11 @@ clear_garbaged_frames ()
     {
       Lisp_Object tail, frame;
       int changed_count = 0;
-
+      
       FOR_EACH_FRAME (tail, frame)
        {
          struct frame *f = XFRAME (frame);
-
+         
          if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f))
            {
              if (f->resized_p)
@@ -8090,7 +8091,7 @@ clear_garbaged_frames ()
              f->resized_p = 0;
            }
        }
-
+      
       frame_garbaged = 0;
       if (changed_count)
        ++windows_or_buffers_changed;
@@ -8123,11 +8124,10 @@ echo_area_display (update_frame_p)
 /* The terminal frame is used as the first Emacs frame on the Mac OS.  */
 #ifndef MAC_OS8
 #ifdef HAVE_WINDOW_SYSTEM
-  /* When Emacs starts, selected_frame may be a visible terminal
-     frame, even if we run under a window system.  If we let this
-     through, a message would be displayed on the terminal.  */
-  if (EQ (selected_frame, Vterminal_frame)
-      && !NILP (Vwindow_system))
+  /* When Emacs starts, selected_frame may be the initial terminal
+     frame.  If we let this through, a message would be displayed on
+     the terminal.  */
+  if (FRAME_INITIAL_P (XFRAME (selected_frame)))
     return 0;
 #endif /* HAVE_WINDOW_SYSTEM */
 #endif
@@ -8178,7 +8178,7 @@ echo_area_display (update_frame_p)
                 Can do with a display update of the echo area,
                 unless we displayed some mode lines.  */
              update_single_window (w, 1);
-             rif->flush_display (f);
+             FRAME_RIF (f)->flush_display (f);
            }
          else
            update_frame (f, 1, 1);
@@ -8193,8 +8193,10 @@ echo_area_display (update_frame_p)
   else if (!EQ (mini_window, selected_window))
     windows_or_buffers_changed++;
 
-  /* The current message is now also the last one displayed.  */
+  /* Last displayed message is now the current message.  */
   echo_area_buffer[1] = echo_area_buffer[0];
+  /* Inform read_char that we're not echoing.  */
+  echo_message_buffer = Qnil;
 
   /* Prevent redisplay optimization in redisplay_internal by resetting
      this_line_start_pos.  This is done because the mini-buffer now
@@ -8722,8 +8724,8 @@ x_cursor_to (vpos, hpos, y, x)
     {
       BLOCK_INPUT;
       display_and_set_cursor (w, 1, hpos, vpos, x, y);
-      if (rif->flush_display_optional)
-       rif->flush_display_optional (SELECTED_FRAME ());
+      if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional)
+       FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ());
       UNBLOCK_INPUT;
     }
 }
@@ -10150,17 +10152,16 @@ redisplay_internal (preserve_echo_area)
   if (face_change_count)
     ++windows_or_buffers_changed;
 
-  if (! FRAME_WINDOW_P (sf)
-      && previous_terminal_frame != sf)
+  if (FRAME_TERMCAP_P (sf)
+      && FRAME_TTY (sf)->previous_terminal_frame != sf)
     {
-      /* Since frames on an ASCII terminal share the same display
-        area, displaying a different frame means redisplay the whole
-        thing.  */
+      /* Since frames on a single ASCII terminal share the same
+        display area, displaying a different frame means redisplay
+        the whole thing.  */
       windows_or_buffers_changed++;
       SET_FRAME_GARBAGED (sf);
-      XSETFRAME (Vterminal_frame, sf);
+      FRAME_TTY (sf)->previous_terminal_frame = sf;
     }
-  previous_terminal_frame = sf;
 
   /* Set the visible flags for all frames.  Do this before checking
      for resized or garbaged frames; they want to know if their frames
@@ -10182,6 +10183,7 @@ redisplay_internal (preserve_echo_area)
       }
   }
 
+  
   /* Notice any pending interrupt request to change frame size.  */
   do_pending_window_change (1);
 
@@ -10536,7 +10538,7 @@ redisplay_internal (preserve_echo_area)
        {
          struct frame *f = XFRAME (frame);
 
-         if (FRAME_WINDOW_P (f) || f == sf)
+         if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
            {
              if (! EQ (frame, selected_frame))
                /* Select the frame, for the sake of frame-local
@@ -10545,16 +10547,16 @@ redisplay_internal (preserve_echo_area)
 
              /* Mark all the scroll bars to be removed; we'll redeem
                 the ones we want when we redisplay their windows.  */
-             if (condemn_scroll_bars_hook)
-               condemn_scroll_bars_hook (f);
+             if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook)
+               FRAME_DISPLAY (f)->condemn_scroll_bars_hook (f);
 
              if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
                redisplay_windows (FRAME_ROOT_WINDOW (f));
 
              /* Any scroll bars which redisplay_windows should have
                 nuked should now go away.  */
-             if (judge_scroll_bars_hook)
-               judge_scroll_bars_hook (f);
+             if (FRAME_DISPLAY (f)->judge_scroll_bars_hook)
+               FRAME_DISPLAY (f)->judge_scroll_bars_hook (f);
 
              /* If fonts changed, display again.  */
              /* ??? rms: I suspect it is a mistake to jump all the way
@@ -10606,8 +10608,8 @@ redisplay_internal (preserve_echo_area)
            {
              struct frame *f = updated[i];
              mark_window_display_accurate (f->root_window, 1);
-             if (frame_up_to_date_hook)
-               frame_up_to_date_hook (f);
+             if (FRAME_DISPLAY (f)->frame_up_to_date_hook)
+               FRAME_DISPLAY (f)->frame_up_to_date_hook (f);
            }
        }
     }
@@ -10692,8 +10694,8 @@ redisplay_internal (preserve_echo_area)
          /* Say overlay arrows are up to date.  */
          update_overlay_arrows (1);
 
-         if (frame_up_to_date_hook != 0)
-           frame_up_to_date_hook (sf);
+         if (FRAME_DISPLAY (sf)->frame_up_to_date_hook != 0)
+           FRAME_DISPLAY (sf)->frame_up_to_date_hook (sf);
        }
 
       update_mode_lines = 0;
@@ -10803,8 +10805,9 @@ redisplay_preserve_echo_area (from_where)
   else
     redisplay_internal (1);
 
-  if (rif != NULL && rif->flush_display_optional)
-    rif->flush_display_optional (NULL);
+  if (FRAME_RIF (SELECTED_FRAME ()) != NULL
+      && FRAME_RIF (SELECTED_FRAME ())->flush_display_optional)
+    FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (NULL);
 }
 
 
@@ -11942,7 +11945,9 @@ set_vertical_scroll_bar (w)
     start = end = whole = 0;
 
   /* Indicate what this scroll bar ought to be displaying now.  */
-  set_vertical_scroll_bar_hook (w, end - start, whole, start);
+  if (FRAME_DISPLAY (XFRAME (w->frame))->set_vertical_scroll_bar_hook)
+    (*FRAME_DISPLAY (XFRAME (w->frame))->set_vertical_scroll_bar_hook)
+      (w, end - start, whole, start);
 }
 
 
@@ -12634,17 +12639,19 @@ redisplay_window (window, just_this_one_p)
         display_menu_bar (w);
 
 #ifdef HAVE_WINDOW_SYSTEM
+      if (FRAME_WINDOW_P (f))
+        {
 #ifdef USE_GTK
-      redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f);
+          redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f);
 #else
-      redisplay_tool_bar_p = WINDOWP (f->tool_bar_window)
-        && (FRAME_TOOL_BAR_LINES (f) > 0
-            || auto_resize_tool_bars_p);
-
+          redisplay_tool_bar_p = WINDOWP (f->tool_bar_window)
+            && (FRAME_TOOL_BAR_LINES (f) > 0
+                || auto_resize_tool_bars_p);
 #endif
 
-      if (redisplay_tool_bar_p)
-        redisplay_tool_bar (f);
+          if (redisplay_tool_bar_p)
+            redisplay_tool_bar (f);
+        }
 #endif
     }
 
@@ -12679,7 +12686,8 @@ redisplay_window (window, just_this_one_p)
 
       /* Note that we actually used the scroll bar attached to this
         window, so it shouldn't be deleted at the end of redisplay.  */
-      redeem_scroll_bar_hook (w);
+      if (FRAME_DISPLAY (f)->redeem_scroll_bar_hook)
+        (*FRAME_DISPLAY (f)->redeem_scroll_bar_hook) (w);
     }
 
   /* Restore current_buffer and value of point in it.  */
@@ -12942,10 +12950,10 @@ try_window_reusing_current_matrix (w)
          if (run.height > 0 && run.current_y != run.desired_y)
            {
              update_begin (f);
-             rif->update_window_begin_hook (w);
-             rif->clear_window_mouse_face (w);
-             rif->scroll_run_hook (w, &run);
-             rif->update_window_end_hook (w, 0, 0);
+             FRAME_RIF (f)->update_window_begin_hook (w);
+             FRAME_RIF (f)->clear_window_mouse_face (w);
+             FRAME_RIF (f)->scroll_run_hook (w, &run);
+             FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
              update_end (f);
            }
 
@@ -13114,10 +13122,10 @@ try_window_reusing_current_matrix (w)
       if (run.height)
        {
          update_begin (f);
-         rif->update_window_begin_hook (w);
-         rif->clear_window_mouse_face (w);
-         rif->scroll_run_hook (w, &run);
-         rif->update_window_end_hook (w, 0, 0);
+         FRAME_RIF (f)->update_window_begin_hook (w);
+         FRAME_RIF (f)->clear_window_mouse_face (w);
+         FRAME_RIF (f)->scroll_run_hook (w, &run);
+         FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
          update_end (f);
        }
 
@@ -13567,7 +13575,7 @@ try_window_id (w)
 
   /* Window must either use window-based redisplay or be full width.  */
   if (!FRAME_WINDOW_P (f)
-      && (!line_ins_del_ok
+      && (!FRAME_LINE_INS_DEL_OK (f)
          || !WINDOW_FULL_WIDTH_P (w)))
     GIVE_UP (4);
 
@@ -13976,10 +13984,10 @@ try_window_id (w)
 
       if (FRAME_WINDOW_P (f))
        {
-         rif->update_window_begin_hook (w);
-         rif->clear_window_mouse_face (w);
-         rif->scroll_run_hook (w, &run);
-         rif->update_window_end_hook (w, 0, 0);
+         FRAME_RIF (f)->update_window_begin_hook (w);
+         FRAME_RIF (f)->clear_window_mouse_face (w);
+         FRAME_RIF (f)->scroll_run_hook (w, &run);
+         FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
        }
       else
        {
@@ -13997,36 +14005,36 @@ try_window_id (w)
            {
              /* Scroll last_unchanged_at_beg_row to the end of the
                 window down dvpos lines.  */
-             set_terminal_window (end);
+             set_terminal_window (f, end);
 
              /* On dumb terminals delete dvpos lines at the end
                 before inserting dvpos empty lines.  */
-             if (!scroll_region_ok)
-               ins_del_lines (end - dvpos, -dvpos);
+             if (!FRAME_SCROLL_REGION_OK (f))
+               ins_del_lines (f, end - dvpos, -dvpos);
 
              /* Insert dvpos empty lines in front of
                  last_unchanged_at_beg_row.  */
-             ins_del_lines (from, dvpos);
+             ins_del_lines (f, from, dvpos);
            }
          else if (dvpos < 0)
            {
              /* Scroll up last_unchanged_at_beg_vpos to the end of
                 the window to last_unchanged_at_beg_vpos - |dvpos|.  */
-             set_terminal_window (end);
+             set_terminal_window (f, end);
 
              /* Delete dvpos lines in front of
                 last_unchanged_at_beg_vpos.  ins_del_lines will set
                 the cursor to the given vpos and emit |dvpos| delete
                 line sequences.  */
-             ins_del_lines (from + dvpos, dvpos);
+             ins_del_lines (f, from + dvpos, dvpos);
 
              /* On a dumb terminal insert dvpos empty lines at the
                  end.  */
-             if (!scroll_region_ok)
-               ins_del_lines (end + dvpos, -dvpos);
+             if (!FRAME_SCROLL_REGION_OK (f))
+               ins_del_lines (f, end + dvpos, -dvpos);
            }
 
-         set_terminal_window (0);
+         set_terminal_window (f, 0);
        }
 
       update_end (f);
@@ -17044,8 +17052,8 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
          {
            /* No need to mention EOL here--the terminal never needs
               to do EOL conversion.  */
-           p = decode_mode_spec_coding (keyboard_coding.symbol, p, 0);
-           p = decode_mode_spec_coding (terminal_coding.symbol, p, 0);
+           p = decode_mode_spec_coding (FRAME_KEYBOARD_CODING (f)->symbol, p, 0);
+           p = decode_mode_spec_coding (FRAME_TERMINAL_CODING (f)->symbol, p, 0);
          }
        p = decode_mode_spec_coding (b->buffer_file_coding_system,
                                     p, eol_flag);
@@ -17886,7 +17894,7 @@ get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
            = FONT_INFO_FROM_ID (f, face->font_info_id);
          if (font_info)
            glyph->font_type
-             = rif->encode_char (glyph->u.ch, char2b, font_info, two_byte_p);
+             = FRAME_RIF (f)->encode_char (glyph->u.ch, char2b, font_info, two_byte_p);
        }
     }
 
@@ -18117,7 +18125,7 @@ x_get_glyph_overhangs (glyph, f, left, right)
       font = face->font;
       font_info = FONT_INFO_FROM_ID (f, face->font_info_id);
       if (font  /* ++KFS: Should this be font_info ?  */
-         && (pcm = rif->per_char_metric (font, &char2b, glyph->font_type)))
+         && (pcm = FRAME_RIF (f)->per_char_metric (font, &char2b, glyph->font_type)))
        {
          if (pcm->rbearing > pcm->width)
            *right = pcm->rbearing - pcm->width;
@@ -18285,7 +18293,7 @@ get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
          struct font_info *font_info
            = FONT_INFO_FROM_ID (f, face->font_info_id);
          if (font_info)
-           rif->encode_char (c, char2b, font_info, 0);
+           FRAME_RIF (f)->encode_char (c, char2b, font_info, 0);
        }
     }
 
@@ -18352,8 +18360,8 @@ compute_overhangs_and_x (s, x, backward_p)
     {
       while (s)
        {
-         if (rif->compute_glyph_string_overhangs)
-           rif->compute_glyph_string_overhangs (s);
+         if (FRAME_RIF (s->f)->compute_glyph_string_overhangs)
+           FRAME_RIF (s->f)->compute_glyph_string_overhangs (s);
          x -= s->width;
          s->x = x;
          s = s->prev;
@@ -18363,8 +18371,8 @@ compute_overhangs_and_x (s, x, backward_p)
     {
       while (s)
        {
-         if (rif->compute_glyph_string_overhangs)
-           rif->compute_glyph_string_overhangs (s);
+         if (FRAME_RIF (s->f)->compute_glyph_string_overhangs)
+           FRAME_RIF (s->f)->compute_glyph_string_overhangs (s);
          s->x = x;
          x += s->width;
          s = s->next;
@@ -18646,9 +18654,9 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
       struct glyph_string *h, *t;
 
       /* Compute overhangs for all glyph strings.  */
-      if (rif->compute_glyph_string_overhangs)
+      if (FRAME_RIF (f)->compute_glyph_string_overhangs)
        for (s = head; s; s = s->next)
-         rif->compute_glyph_string_overhangs (s);
+         FRAME_RIF (f)->compute_glyph_string_overhangs (s);
 
       /* Prepend glyph strings for glyphs in front of the first glyph
         string that are overwritten because of the first glyph
@@ -18726,7 +18734,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
 
   /* Draw all strings.  */
   for (s = head; s; s = s->next)
-    rif->draw_glyph_string (s);
+    FRAME_RIF (f)->draw_glyph_string (s);
 
   if (area == TEXT_AREA
       && !row->full_width_p
@@ -19422,20 +19430,20 @@ x_produce_glyphs (it)
 
          it->nglyphs = 1;
 
-         pcm = rif->per_char_metric (font, &char2b,
-                                     FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
-
-         if (it->override_ascent >= 0)
-           {
-             it->ascent = it->override_ascent;
-             it->descent = it->override_descent;
-             boff = it->override_boff;
-           }
-         else
-           {
-             it->ascent = FONT_BASE (font) + boff;
-             it->descent = FONT_DESCENT (font) - boff;
-           }
+          pcm = FRAME_RIF (it->f)->per_char_metric
+            (font, &char2b, FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
+
+         if (it->override_ascent >= 0)
+           {
+             it->ascent = it->override_ascent;
+             it->descent = it->override_descent;
+             boff = it->override_boff;
+           }
+         else
+           {
+             it->ascent = FONT_BASE (font) + boff;
+             it->descent = FONT_DESCENT (font) - boff;
+           }
 
          if (pcm)
            {
@@ -19653,8 +19661,8 @@ x_produce_glyphs (it)
             from the charset width; this is what old redisplay code
             did.  */
 
-         pcm = rif->per_char_metric (font, &char2b,
-                                     FONT_TYPE_FOR_MULTIBYTE (font, it->c));
+         pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+                                                    FONT_TYPE_FOR_MULTIBYTE (font, it->c));
 
          if (font_not_found_p || !pcm)
            {
@@ -19785,8 +19793,8 @@ x_produce_glyphs (it)
 
          /* Initialize the bounding box.  */
          if (font_info
-             && (pcm = rif->per_char_metric (font, &char2b,
-                                             FONT_TYPE_FOR_MULTIBYTE (font, it->c))))
+             && (pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+                                                            FONT_TYPE_FOR_MULTIBYTE (font, it->c))))
            {
              width = pcm->width;
              ascent = pcm->ascent;
@@ -19844,8 +19852,8 @@ x_produce_glyphs (it)
                }
 
              if (font_info
-                 && (pcm = rif->per_char_metric (font, &char2b,
-                                                 FONT_TYPE_FOR_MULTIBYTE (font, ch))))
+                 && (pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+                                                                FONT_TYPE_FOR_MULTIBYTE (font, ch))))
                {
                  width = pcm->width;
                  ascent = pcm->ascent;
@@ -20085,8 +20093,8 @@ x_insert_glyphs (start, len)
   frame_x = window_box_left (w, updated_area) + output_cursor.x;
   frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, output_cursor.y);
 
-  rif->shift_glyphs_for_insert (f, frame_x, frame_y, shifted_region_width,
-                               line_height, shift_by_width);
+  FRAME_RIF (f)->shift_glyphs_for_insert (f, frame_x, frame_y, shifted_region_width,
+                                          line_height, shift_by_width);
 
   /* Write the glyphs.  */
   hpos = start - row->glyphs[updated_area];
@@ -20168,8 +20176,8 @@ x_clear_end_of_line (to_x)
   if (to_x > from_x && to_y > from_y)
     {
       BLOCK_INPUT;
-      rif->clear_frame_area (f, from_x, from_y,
-                            to_x - from_x, to_y - from_y);
+      FRAME_RIF (f)->clear_frame_area (f, from_x, from_y,
+                                       to_x - from_x, to_y - from_y);
       UNBLOCK_INPUT;
     }
 }
@@ -20639,9 +20647,9 @@ erase_phys_cursor (w)
       x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
       y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y));
       width = min (cursor_glyph->pixel_width,
-                  window_box_width (w, TEXT_AREA) - w->phys_cursor.x);
+                   window_box_width (w, TEXT_AREA) - w->phys_cursor.x);
 
-      rif->clear_frame_area (f, x, y, width, cursor_row->visible_height);
+      FRAME_RIF (f)->clear_frame_area (f, x, y, width, cursor_row->visible_height);
     }
 
   /* Erase the cursor by redrawing the character underneath it.  */
@@ -20738,9 +20746,9 @@ display_and_set_cursor (w, on, hpos, vpos, x, y)
       w->phys_cursor.vpos = vpos;
     }
 
-  rif->draw_window_cursor (w, glyph_row, x, y,
-                          new_cursor_type, new_cursor_width,
-                          on, active_cursor);
+  FRAME_RIF (f)->draw_window_cursor (w, glyph_row, x, y,
+                                     new_cursor_type, new_cursor_width,
+                                     on, active_cursor);
 }
 
 
@@ -20885,11 +20893,11 @@ show_mouse_face (dpyinfo, draw)
 
   /* Change the mouse cursor.  */
   if (draw == DRAW_NORMAL_TEXT)
-    rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
+    FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
   else if (draw == DRAW_MOUSE_FACE)
-    rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
+    FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
   else
-    rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
+    FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
 }
 
 /* EXPORT:
@@ -21328,7 +21336,6 @@ on_hot_spot_p (hot_spot, x, y)
          return inside;
        }
     }
-  /* If we don't understand the format, pretend we're not in the hot-spot.  */
   return 0;
 }
 
@@ -21408,7 +21415,7 @@ define_frame_cursor1 (f, cursor, pointer)
     }
 
   if (cursor != No_Cursor)
-    rif->define_frame_cursor (f, cursor);
+    FRAME_RIF (f)->define_frame_cursor (f, cursor);
 }
 
 /* Take proper action when mouse has moved to the mode or header line
@@ -22368,8 +22375,8 @@ phys_cursor_in_rect_p (w, r)
         I assume the effect is the same -- and this is portable.  */
       return x_intersect_rectangles (&cr, r, &result);
     }
-  else
-    return 0;
+  /* If we don't understand the format, pretend we're not in the hot-spot.  */
+  return 0;
 }
 
 
@@ -22381,6 +22388,8 @@ void
 x_draw_vertical_border (w)
      struct window *w;
 {
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  
   /* We could do better, if we knew what type of scroll-bar the adjacent
      windows (on either side) have...  But we don't :-(
      However, I think this works ok.  ++KFS 2003-04-25 */
@@ -22401,9 +22410,9 @@ x_draw_vertical_border (w)
       y1 -= 1;
 
       if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
-       x1 -= 1;
+        x1 -= 1;
 
-      rif->draw_vertical_window_border (w, x1, y0, y1);
+      FRAME_RIF (f)->draw_vertical_window_border (w, x1, y0, y1);
     }
   else if (!WINDOW_LEFTMOST_P (w)
           && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
@@ -22414,9 +22423,9 @@ x_draw_vertical_border (w)
       y1 -= 1;
 
       if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
-       x0 -= 1;
+        x0 -= 1;
 
-      rif->draw_vertical_window_border (w, x0, y0, y1);
+      FRAME_RIF (f)->draw_vertical_window_border (w, x0, y0, y1);
     }
 }
 
index 616318daa63bc302b3333ef3dee456cd6fe4aa1c..0667d3823c75e201d305b7a6e0210723105bcc02 100644 (file)
@@ -195,11 +195,13 @@ Boston, MA 02110-1301, USA.  */
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <stdio.h>              /* This needs to be before termchar.h */
 
 #include "lisp.h"
 #include "charset.h"
 #include "keyboard.h"
 #include "frame.h"
+#include "termhooks.h"
 
 #ifdef HAVE_WINDOW_SYSTEM
 #include "fontset.h"
@@ -242,6 +244,7 @@ Boston, MA 02110-1301, USA.  */
 #include "blockinput.h"
 #include "window.h"
 #include "intervals.h"
+#include "termchar.h"
 
 #ifdef HAVE_X_WINDOWS
 
@@ -3203,6 +3206,20 @@ push_named_merge_point (struct named_merge_point *new_named_merge_point,
 
 \f
 
+static Lisp_Object
+internal_resolve_face_name (nargs, args)
+     int nargs;
+     Lisp_Object *args;
+{
+  Fget (args[0], args[1]);
+}
+
+static Lisp_Object
+resolve_face_name_error (ignore)
+     Lisp_Object ignore;
+{
+  return Qnil;
+}
 
 /* Resolve face name FACE_NAME.  If FACE_NAME is a string, intern it
    to make it a symbol.  If FACE_NAME is an alias for another face,
@@ -6095,7 +6112,7 @@ tty_supports_face_attributes_p (f, attrs, def_face)
   /* See if the capabilities we selected above are supported, with the
      given colors.  */
   if (test_caps != 0 &&
-      ! tty_capable_p (f, test_caps, fg_tty_color.pixel, bg_tty_color.pixel))
+      ! tty_capable_p (FRAME_TTY (f), test_caps, fg_tty_color.pixel, bg_tty_color.pixel))
     return 0;
 
 
@@ -6889,7 +6906,8 @@ realize_basic_faces (f)
        {
          FRAME_FACE_CACHE (f)->menu_face_changed_p = 0;
 #ifdef USE_X_TOOLKIT
-         x_update_menu_appearance (f);
+          if (FRAME_WINDOW_P (f))
+            x_update_menu_appearance (f);
 #endif
        }
 
@@ -6976,7 +6994,7 @@ realize_default_face (f)
        LFACE_FOREGROUND (lface) = XCDR (color);
       else if (FRAME_WINDOW_P (f))
        return 0;
-      else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
+      else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
        LFACE_FOREGROUND (lface) = build_string (unspecified_fg);
       else
        abort ();
@@ -6991,7 +7009,7 @@ realize_default_face (f)
        LFACE_BACKGROUND (lface) = XCDR (color);
       else if (FRAME_WINDOW_P (f))
        return 0;
-      else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
+      else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
        LFACE_BACKGROUND (lface) = build_string (unspecified_bg);
       else
        abort ();
@@ -7080,6 +7098,11 @@ realize_face (cache, attrs, c, base_face, former_face_id)
     face = realize_x_face (cache, attrs, c, base_face);
   else if (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f))
     face = realize_tty_face (cache, attrs, c);
+  else if (FRAME_INITIAL_P (cache->f))
+    {
+      /* Create a dummy face. */
+      face = make_realized_face (attrs);
+    }
   else
     abort ();
 
index 9c3965d7e2b35d452649b7a73aa1ccfbaceff5f3..9623ea13eebc3b8353dbf1251b943041cd461a05 100644 (file)
@@ -47,6 +47,7 @@ Boston, MA 02110-1301, USA.  */
 #include "systime.h"
 #include "termhooks.h"
 #include "atimer.h"
+#include "termchar.h"
 
 #ifdef HAVE_X_WINDOWS
 
@@ -259,6 +260,15 @@ check_x_display_info (frame)
       else
        error ("X windows are not in use or not initialized");
     }
+  else if (INTEGERP (frame))
+    {
+      struct display *d = get_display (XINT (frame), 1);
+
+      if (d->type != output_x_window)
+        error ("Display %d is not an X display", XINT (frame));
+
+      dpyinfo = d->display_info.x;
+    }
   else if (STRINGP (frame))
     dpyinfo = x_display_info_for_name (frame);
   else
@@ -1382,10 +1392,8 @@ x_set_tool_bar_lines (f, value, oldval)
      below the menu bar.  */
   if (FRAME_X_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0)
     {
-      updating_frame = f;
-      clear_frame ();
+      clear_frame (f);
       clear_current_matrices (f);
-      updating_frame = NULL;
     }
 
   /* If the tool bar gets smaller, the internal border below it
@@ -1436,10 +1444,10 @@ x_set_scroll_bar_foreground (f, value, oldval)
   if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f))
     {
       /* Remove all scroll bars because they have wrong colors.  */
-      if (condemn_scroll_bars_hook)
-       (*condemn_scroll_bars_hook) (f);
-      if (judge_scroll_bars_hook)
-       (*judge_scroll_bars_hook) (f);
+      if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook)
+       (*FRAME_DISPLAY (f)->condemn_scroll_bars_hook) (f);
+      if (FRAME_DISPLAY (f)->judge_scroll_bars_hook)
+       (*FRAME_DISPLAY (f)->judge_scroll_bars_hook) (f);
 
       update_face_from_frame_parameter (f, Qscroll_bar_foreground, value);
       redraw_frame (f);
@@ -1485,10 +1493,10 @@ x_set_scroll_bar_background (f, value, oldval)
   if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f))
     {
       /* Remove all scroll bars because they have wrong colors.  */
-      if (condemn_scroll_bars_hook)
-       (*condemn_scroll_bars_hook) (f);
-      if (judge_scroll_bars_hook)
-       (*judge_scroll_bars_hook) (f);
+      if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook)
+       (*FRAME_DISPLAY (f)->condemn_scroll_bars_hook) (f);
+      if (FRAME_DISPLAY (f)->judge_scroll_bars_hook)
+       (*FRAME_DISPLAY (f)->judge_scroll_bars_hook) (f);
 
       update_face_from_frame_parameter (f, Qscroll_bar_background, value);
       redraw_frame (f);
@@ -2941,6 +2949,12 @@ unwind_create_frame (frame)
 {
   struct frame *f = XFRAME (frame);
 
+  /* If frame is already dead, nothing to do.  This can happen if the
+     display is disconnected after the frame has become official, but
+     before x_create_frame removes the unwind protect.  */
+  if (!FRAME_LIVE_P (f))
+    return Qnil;
+
   /* If frame is ``official'', nothing to do.  */
   if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame))
     {
@@ -2989,18 +3003,18 @@ This function is an internal primitive--use `make-frame' instead.  */)
   Lisp_Object parent;
   struct kboard *kb;
 
-  check_x ();
-
   /* Use this general default value to start with
      until we know if this frame has a specified name.  */
   Vx_resource_name = Vinvocation_name;
 
-  display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING);
+  display = x_get_arg (dpyinfo, parms, Qdisplay_id, 0, 0, RES_TYPE_NUMBER);
+  if (EQ (display, Qunbound))
+    display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING);
   if (EQ (display, Qunbound))
     display = Qnil;
   dpyinfo = check_x_display_info (display);
 #ifdef MULTI_KBOARD
-  kb = dpyinfo->kboard;
+  kb = dpyinfo->frame_display->kboard;
 #else
   kb = &the_only_kboard;
 #endif
@@ -3045,6 +3059,9 @@ This function is an internal primitive--use `make-frame' instead.  */)
   /* Note that X Windows does support scroll bars.  */
   FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
 
+  f->display = dpyinfo->frame_display;
+  f->display->reference_count++;
+
   f->output_method = output_x_window;
   f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
   bzero (f->output_data.x, sizeof (struct x_output));
@@ -3069,9 +3086,6 @@ This function is an internal primitive--use `make-frame' instead.  */)
   image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
   dpyinfo_refcount = dpyinfo->reference_count;
 #endif /* GLYPH_DEBUG */
-#ifdef MULTI_KBOARD
-  FRAME_KBOARD (f) = kb;
-#endif
 
   /* These colors will be set anyway later, but it's important
      to get the color reference counts right, so initialize them!  */
@@ -3134,6 +3148,8 @@ This function is an internal primitive--use `make-frame' instead.  */)
       specbind (Qx_resource_name, name);
     }
 
+  Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qx), Qnil));
+
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
   {
@@ -3935,8 +3951,10 @@ x_display_info_for_name (name)
 
   CHECK_STRING (name);
 
-  if (! EQ (Vwindow_system, intern ("x")))
-    error ("Not using X Windows");
+#if 0
+  if (! EQ (Vinitial_window_system, intern ("x")))
+    error ("Not using X Windows"); /* That doesn't stop us anymore. */
+#endif
 
   for (dpyinfo = x_display_list, names = x_display_name_list;
        dpyinfo;
@@ -3983,8 +4001,10 @@ terminate Emacs if we can't open the connection.  */)
   if (! NILP (xrm_string))
     CHECK_STRING (xrm_string);
 
-  if (! EQ (Vwindow_system, intern ("x")))
-    error ("Not using X Windows");
+#if 0
+  if (! EQ (Vinitial_window_system, intern ("x")))
+    error ("Not using X Windows"); /* That doesn't stop us anymore. */
+#endif
 
   if (! NILP (xrm_string))
     xrm_option = (unsigned char *) SDATA (xrm_string);
@@ -4026,30 +4046,11 @@ If DISPLAY is nil, that stands for the selected frame's display.  */)
      Lisp_Object display;
 {
   struct x_display_info *dpyinfo = check_x_display_info (display);
-  int i;
 
   if (dpyinfo->reference_count > 0)
     error ("Display still has frames on it");
 
-  BLOCK_INPUT;
-  /* Free the fonts in the font table.  */
-  for (i = 0; i < dpyinfo->n_fonts; i++)
-    if (dpyinfo->font_table[i].name)
-      {
-       XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font);
-      }
-
-  x_destroy_all_bitmaps (dpyinfo);
-  XSetCloseDownMode (dpyinfo->display, DestroyAll);
-
-#ifdef USE_X_TOOLKIT
-  XtCloseDisplay (dpyinfo->display);
-#else
-  XCloseDisplay (dpyinfo->display);
-#endif
-
-  x_delete_display (dpyinfo);
-  UNBLOCK_INPUT;
+  x_delete_frame_display (dpyinfo->frame_display);
 
   return Qnil;
 }
@@ -4383,10 +4384,6 @@ start_hourglass ()
   EMACS_TIME delay;
   int secs, usecs = 0;
 
-  /* Don't bother for ttys.  */
-  if (NILP (Vwindow_system))
-    return;
-
   cancel_hourglass ();
 
   if (INTEGERP (Vhourglass_delay)
@@ -4598,20 +4595,12 @@ x_create_tip_frame (dpyinfo, parms, text)
   int width, height;
   int count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3;
-  struct kboard *kb;
   int face_change_count_before = face_change_count;
   Lisp_Object buffer;
   struct buffer *old_buffer;
 
   check_x ();
 
-
-#ifdef MULTI_KBOARD
-  kb = dpyinfo->kboard;
-#else
-  kb = &the_only_kboard;
-#endif
-
   /* Get the name of the frame to use for resource lookup.  */
   name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", RES_TYPE_STRING);
   if (!STRINGP (name)
@@ -4638,6 +4627,9 @@ x_create_tip_frame (dpyinfo, parms, text)
   FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
   record_unwind_protect (unwind_create_tip_frame, frame);
 
+  f->display = dpyinfo->frame_display;
+  f->display->reference_count++;
+
   /* By setting the output method, we're essentially saying that
      the frame is live, as per FRAME_LIVE_P.  If we get a signal
      from this point on, x_destroy_window might screw up reference
@@ -4659,9 +4651,6 @@ x_create_tip_frame (dpyinfo, parms, text)
   image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
   dpyinfo_refcount = dpyinfo->reference_count;
 #endif /* GLYPH_DEBUG */
-#ifdef MULTI_KBOARD
-  FRAME_KBOARD (f) = kb;
-#endif
   f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
   f->output_data.x->explicit_parent = 0;
 
@@ -4671,6 +4660,16 @@ x_create_tip_frame (dpyinfo, parms, text)
     Lisp_Object black;
     struct gcpro gcpro1;
 
+    /* Function x_decode_color can signal an error.  Make
+       sure to initialize color slots so that we won't try
+       to free colors we haven't allocated.  */
+    f->output_data.x->foreground_pixel = -1;
+    f->output_data.x->background_pixel = -1;
+    f->output_data.x->cursor_pixel = -1;
+    f->output_data.x->cursor_foreground_pixel = -1;
+    f->output_data.x->border_pixel = -1;
+    f->output_data.x->mouse_pixel = -1;
+
     black = build_string ("black");
     GCPRO1 (black);
     f->output_data.x->foreground_pixel
@@ -4861,6 +4860,8 @@ x_create_tip_frame (dpyinfo, parms, text)
                                              Qnil));
   }
 
+  Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qx), Qnil));
+
   f->no_split = 1;
 
   UNGCPRO;
index bcc0e57bcdbcfee69d245c7f618c8f2f626e74ff..321e6deb7c6afb17b079bd535e900409bef9120e 100644 (file)
@@ -41,10 +41,10 @@ Boston, MA 02110-1301, USA.  */
 #include <stdio.h>
 
 #include "lisp.h"
-#include "termhooks.h"
 #include "keyboard.h"
 #include "keymap.h"
 #include "frame.h"
+#include "termhooks.h"
 #include "window.h"
 #include "blockinput.h"
 #include "buffer.h"
index 13bc241053ff35e9fa756dac1e312424932ee167..9d5bf568231593fea1fb2ff7d7482c0a36ec6dc7 100644 (file)
@@ -397,13 +397,20 @@ x_own_selection (selection_name, selection_value)
      Lisp_Object selection_name, selection_value;
 {
   struct frame *sf = SELECTED_FRAME ();
-  Window selecting_window = FRAME_X_WINDOW (sf);
-  Display *display = FRAME_X_DISPLAY (sf);
+  Window selecting_window;
+  Display *display;
   Time time = last_event_timestamp;
   Atom selection_atom;
-  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf);
+  struct x_display_info *dpyinfo;
   int count;
 
+  if (! FRAME_X_P (sf))
+    return;
+
+  selecting_window = FRAME_X_WINDOW (sf);
+  display = FRAME_X_DISPLAY (sf);
+  dpyinfo = FRAME_X_DISPLAY_INFO (sf);
+  
   CHECK_SYMBOL (selection_name);
   selection_atom = symbol_to_x_atom (dpyinfo, display, selection_name);
 
@@ -664,7 +671,8 @@ some_frame_on_display (dpyinfo)
 
   FOR_EACH_FRAME (list, frame)
     {
-      if (FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
+      if (FRAME_X_P (XFRAME (frame))
+          && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
        return frame;
     }
 
@@ -1002,7 +1010,7 @@ x_handle_selection_clear (event)
      to see if this Emacs job now owns the selection
      through that display.  */
   for (t_dpyinfo = x_display_list; t_dpyinfo; t_dpyinfo = t_dpyinfo->next)
-    if (t_dpyinfo->kboard == dpyinfo->kboard)
+    if (t_dpyinfo->frame_display->kboard == dpyinfo->frame_display->kboard)
       {
        Window owner_window
          = XGetSelectionOwner (t_dpyinfo->display, selection);
@@ -1362,17 +1370,26 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
      Lisp_Object selection_symbol, target_type, time_stamp;
 {
   struct frame *sf = SELECTED_FRAME ();
-  Window requestor_window = FRAME_X_WINDOW (sf);
-  Display *display = FRAME_X_DISPLAY (sf);
-  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (sf);
+  Window requestor_window;
+  Display *display;
+  struct x_display_info *dpyinfo;
   Time requestor_time = last_event_timestamp;
-  Atom target_property = dpyinfo->Xatom_EMACS_TMP;
-  Atom selection_atom = symbol_to_x_atom (dpyinfo, display, selection_symbol);
+  Atom target_property;
+  Atom selection_atom;
   Atom type_atom;
   int secs, usecs;
   int count;
   Lisp_Object frame;
 
+  if (! FRAME_X_P (sf))
+    return Qnil;
+
+  requestor_window = FRAME_X_WINDOW (sf);
+  display = FRAME_X_DISPLAY (sf);
+  dpyinfo = FRAME_X_DISPLAY_INFO (sf);
+  target_property = dpyinfo->Xatom_EMACS_TMP;
+  selection_atom = symbol_to_x_atom (dpyinfo, display, selection_symbol);
+
   if (CONSP (target_type))
     type_atom = symbol_to_x_atom (dpyinfo, display, XCAR (target_type));
   else
@@ -2198,6 +2215,9 @@ Disowning it means there is no such selection.  */)
   struct frame *sf = SELECTED_FRAME ();
 
   check_x ();
+  if (! FRAME_X_P (sf))
+    return Qnil;
+
   display = FRAME_X_DISPLAY (sf);
   dpyinfo = FRAME_X_DISPLAY_INFO (sf);
   CHECK_SYMBOL (selection);
@@ -2361,6 +2381,10 @@ DEFUN ("x-get-cut-buffer-internal", Fx_get_cut_buffer_internal,
   struct frame *sf = SELECTED_FRAME ();
 
   check_x ();
+
+  if (! FRAME_X_P (sf))
+    return Qnil;
+
   display = FRAME_X_DISPLAY (sf);
   dpyinfo = FRAME_X_DISPLAY_INFO (sf);
   window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
@@ -2402,6 +2426,10 @@ DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal,
   struct frame *sf = SELECTED_FRAME ();
 
   check_x ();
+
+  if (! FRAME_X_P (sf))
+    return Qnil;
+
   display = FRAME_X_DISPLAY (sf);
   window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
 
@@ -2458,8 +2486,12 @@ Positive means shift the values forward, negative means backward.  */)
   Atom props[8];
   Display *display;
   struct frame *sf = SELECTED_FRAME ();
-
+  
   check_x ();
+
+  if (! FRAME_X_P (sf))
+    return Qnil;
+
   display = FRAME_X_DISPLAY (sf);
   window = RootWindow (display, 0); /* Cut buffers are on screen 0 */
   CHECK_NUMBER (n);
index 9a94adbb997a71422d71317aca49e4e401cd20bb..3c1231e17322c45babd371dcde0a49f6ad0ff0cd 100644 (file)
@@ -48,6 +48,7 @@ Boston, MA 02110-1301, USA.  */
 #include "systime.h"
 #include "sysselect.h"
 #include "lisp.h"
+#include "frame.h"
 #include "termhooks.h"
 #include "termopts.h"
 #include "xterm.h"
index ab46a7700e34f4a7ffa917085d12117e82107cf7..57a09c8c496dd6abb3291b511747d565d9d790ff 100644 (file)
@@ -54,7 +54,6 @@ Boston, MA 02110-1301, USA.  */
 #include <sys/ioctl.h>
 #endif /* ! defined (BSD_SYSTEM) */
 
-#include "systty.h"
 #include "systime.h"
 
 #ifndef INCLUDED_FCNTL
@@ -313,6 +312,10 @@ static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value;
 static Lisp_Object Qvendor_specific_keysyms;
 static Lisp_Object Qlatin_1;
 
+/* Used in x_flush.  */
+
+extern Lisp_Object Vinhibit_redisplay;
+
 extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *));
 extern int x_bitmap_mask P_ ((FRAME_PTR, int));
 
@@ -334,14 +337,16 @@ void x_raise_frame P_ ((struct frame *));
 void x_set_window_size P_ ((struct frame *, int, int, int));
 void x_wm_set_window_state P_ ((struct frame *, int));
 void x_wm_set_icon_pixmap P_ ((struct frame *, int));
+struct display *x_create_frame_display P_ ((struct x_display_info *));
+void x_delete_frame_display P_ ((struct display *));
 void x_initialize P_ ((void));
 static void x_font_min_bounds P_ ((XFontStruct *, int *, int *));
 static int x_compute_min_glyph_bounds P_ ((struct frame *));
 static void x_update_end P_ ((struct frame *));
 static void XTframe_up_to_date P_ ((struct frame *));
-static void XTset_terminal_modes P_ ((void));
-static void XTreset_terminal_modes P_ ((void));
-static void x_clear_frame P_ ((void));
+static void XTset_terminal_modes P_ ((struct display *));
+static void XTreset_terminal_modes P_ ((struct display *));
+static void x_clear_frame P_ ((struct frame *));
 static void frame_highlight P_ ((struct frame *));
 static void frame_unhighlight P_ ((struct frame *));
 static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *));
@@ -377,12 +382,18 @@ static void
 x_flush (f)
      struct frame *f;
 {
+  /* Don't call XFlush when it is not safe to redisplay; the X
+     connection may be broken.  */
+  if (!NILP (Vinhibit_redisplay))
+    return;
+
   BLOCK_INPUT;
   if (f == NULL)
     {
       Lisp_Object rest, frame;
       FOR_EACH_FRAME (rest, frame)
-       x_flush (XFRAME (frame));
+        if (FRAME_X_P (XFRAME (frame)))
+          x_flush (XFRAME (frame));
     }
   else if (FRAME_X_P (f))
     XFlush (FRAME_X_DISPLAY (f));
@@ -794,7 +805,7 @@ x_draw_fringe_bitmap (w, row, p)
    rarely happens).  */
 
 static void
-XTset_terminal_modes ()
+XTset_terminal_modes (struct display *display)
 {
 }
 
@@ -802,7 +813,7 @@ XTset_terminal_modes ()
    the X-windows go away, and suspending requires no action.  */
 
 static void
-XTreset_terminal_modes ()
+XTreset_terminal_modes (struct display *display)
 {
 }
 
@@ -1415,7 +1426,8 @@ x_frame_of_widget (widget)
   for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
     if (GC_FRAMEP (XCAR (tail))
        && (f = XFRAME (XCAR (tail)),
-           (f->output_data.nothing != 1
+           (FRAME_X_P (f)
+             && f->output_data.nothing != 1
             && FRAME_X_DISPLAY_INFO (f) == dpyinfo))
        && f->output_data.x->widget == widget)
       return f;
@@ -2769,7 +2781,8 @@ x_shift_glyphs_for_insert (f, x, y, width, height, shift_by)
    for X frames.  */
 
 static void
-x_delete_glyphs (n)
+x_delete_glyphs (f, n)
+     struct frame *f;
      register int n;
 {
   abort ();
@@ -2792,19 +2805,11 @@ x_clear_area (dpy, window, x, y, width, height, exposures)
 }
 
 
-/* Clear entire frame.  If updating_frame is non-null, clear that
-   frame.  Otherwise clear the selected frame.  */
+/* Clear an entire frame.  */
 
 static void
-x_clear_frame ()
+x_clear_frame (struct frame *f)
 {
-  struct frame *f;
-
-  if (updating_frame)
-    f = updating_frame;
-  else
-    f = SELECTED_FRAME ();
-
   /* Clearing the frame will erase any cursor, so mark them all as no
      longer visible.  */
   mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f)));
@@ -3050,7 +3055,8 @@ XTset_terminal_window (n)
    lines or deleting -N lines at vertical position VPOS.  */
 
 static void
-x_ins_del_lines (vpos, n)
+x_ins_del_lines (f, vpos, n)
+     struct frame *f;
      int vpos, n;
 {
   abort ();
@@ -3724,7 +3730,8 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
 
       /* Clear the mouse-moved flag for every frame on this display.  */
       FOR_EACH_FRAME (tail, frame)
-       if (FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp))
+       if (FRAME_X_P (XFRAME (frame))
+            && FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp))
          XFRAME (frame)->mouse_moved = 0;
 
       last_mouse_scroll_bar = Qnil;
@@ -3938,6 +3945,9 @@ x_window_to_scroll_bar (display, window_id)
       if (! GC_FRAMEP (frame))
        abort ();
 
+      if (! FRAME_X_P (XFRAME (frame)))
+        continue;
+      
       /* Scan this frame's scroll bar list for a scroll bar with the
          right window ID.  */
       condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame));
@@ -3972,11 +3982,14 @@ x_window_to_menu_bar (window)
        XGCTYPE (tail) == Lisp_Cons;
        tail = XCDR (tail))
     {
-      Lisp_Object frame = XCAR (tail);
-      Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget;
+      if (FRAME_X_P (XFRAME (XCAR (tail))))
+        {
+          Lisp_Object frame = XCAR (tail);
+          Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget;
 
-      if (menu_bar && xlwmenu_window_p (menu_bar, window))
-       return menu_bar;
+          if (menu_bar && xlwmenu_window_p (menu_bar, window))
+            return menu_bar;
+        }
     }
 
   return NULL;
@@ -6290,37 +6303,37 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
           bzero (&compose_status, sizeof (compose_status));
           orig_keysym = keysym;
 
-         /* Common for all keysym input events.  */
-         XSETFRAME (inev.ie.frame_or_window, f);
-         inev.ie.modifiers
-           = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), modifiers);
-         inev.ie.timestamp = event.xkey.time;
-
-         /* First deal with keysyms which have defined
-            translations to characters.  */
-         if (keysym >= 32 && keysym < 128)
-           /* Avoid explicitly decoding each ASCII character.  */
-           {
-             inev.ie.kind = ASCII_KEYSTROKE_EVENT;
-             inev.ie.code = keysym;
-             goto done_keysym;
-           }
-
-         /* Now non-ASCII.  */
-         if (HASH_TABLE_P (Vx_keysym_table)
-             && (NATNUMP (c = Fgethash (make_number (keysym),
-                                        Vx_keysym_table,
-                                        Qnil))))
-           {
-             inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFASTINT (c))
-                             ? ASCII_KEYSTROKE_EVENT
-                             : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
-             inev.ie.code = XFASTINT (c);
-             goto done_keysym;
-           }
-
-         /* Random non-modifier sorts of keysyms.  */
-         if (((keysym >= XK_BackSpace && keysym <= XK_Escape)
+         /* Common for all keysym input events.  */
+         XSETFRAME (inev.ie.frame_or_window, f);
+         inev.ie.modifiers
+           = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), modifiers);
+         inev.ie.timestamp = event.xkey.time;
+
+         /* First deal with keysyms which have defined
+            translations to characters.  */
+         if (keysym >= 32 && keysym < 128)
+           /* Avoid explicitly decoding each ASCII character.  */
+           {
+             inev.ie.kind = ASCII_KEYSTROKE_EVENT;
+             inev.ie.code = keysym;
+             goto done_keysym;
+           }
+         /* Now non-ASCII.  */
+         if (HASH_TABLE_P (Vx_keysym_table)
+             && (NATNUMP (c = Fgethash (make_number (keysym),
+                                        Vx_keysym_table,
+                                        Qnil))))
+           {
+             inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFASTINT (c))
+                              ? ASCII_KEYSTROKE_EVENT
+                              : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+             inev.ie.code = XFASTINT (c);
+             goto done_keysym;
+           }
+         /* Random non-modifier sorts of keysyms.  */
+         if (((keysym >= XK_BackSpace && keysym <= XK_Escape)
                         || keysym == XK_Delete
 #ifdef XK_ISO_Left_Tab
                         || (keysym >= XK_ISO_Left_Tab
@@ -6953,8 +6966,8 @@ x_dispatch_event (event, display)
    EXPECTED is nonzero if the caller knows input is available.  */
 
 static int
-XTread_socket (sd, expected, hold_quit)
-     register int sd;
+XTread_socket (display, expected, hold_quit)
+     struct display *display;
      int expected;
      struct input_event *hold_quit;
 {
@@ -7364,8 +7377,7 @@ x_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, activ
     }
 
 #ifndef XFlush
-  if (updating_frame != f)
-    XFlush (FRAME_X_DISPLAY (f));
+  XFlush (FRAME_X_DISPLAY (f));
 #endif
 }
 
@@ -7645,6 +7657,7 @@ x_connection_closed (dpy, error_message)
   struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
   Lisp_Object frame, tail;
   int count;
+  int index = SPECPDL_INDEX ();
 
   error_msg = (char *) alloca (strlen (error_message) + 1);
   strcpy (error_msg, error_message);
@@ -7656,6 +7669,44 @@ x_connection_closed (dpy, error_message)
      the original message here.  */
   count = x_catch_errors (dpy);
 
+  /* Inhibit redisplay while frames are being deleted. */
+  specbind (Qinhibit_redisplay, Qt);
+
+  if (dpyinfo)
+    {
+      /* Protect display from being closed when we delete the last
+         frame on it. */
+      dpyinfo->reference_count++;
+      dpyinfo->frame_display->reference_count++;
+    }
+  
+  /* First delete frames whose mini-buffers are on frames
+     that are on the dead display.  */
+  FOR_EACH_FRAME (tail, frame)
+    {
+      Lisp_Object minibuf_frame;
+      minibuf_frame
+       = WINDOW_FRAME (XWINDOW (FRAME_MINIBUF_WINDOW (XFRAME (frame))));
+      if (FRAME_X_P (XFRAME (frame))
+         && FRAME_X_P (XFRAME (minibuf_frame))
+         && ! EQ (frame, minibuf_frame)
+         && FRAME_X_DISPLAY_INFO (XFRAME (minibuf_frame)) == dpyinfo)
+       Fdelete_frame (frame, Qt);
+    }
+
+  /* Now delete all remaining frames on the dead display.
+     We are now sure none of these is used as the mini-buffer
+     for another frame that we need to delete.  */
+  FOR_EACH_FRAME (tail, frame)
+    if (FRAME_X_P (XFRAME (frame))
+       && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
+      {
+       /* Set this to t so that Fdelete_frame won't get confused
+          trying to find a replacement.  */
+       FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt;
+       Fdelete_frame (frame, Qt);
+      }
+
   /* We have to close the display to inform Xt that it doesn't
      exist anymore.  If we don't, Xt will continue to wait for
      events from the display.  As a consequence, a sequence of
@@ -7688,43 +7739,23 @@ x_connection_closed (dpy, error_message)
     xg_display_close (dpyinfo->display);
 #endif
 
-  /* Indicate that this display is dead.  */
   if (dpyinfo)
-    dpyinfo->display = 0;
-
-  /* First delete frames whose mini-buffers are on frames
-     that are on the dead display.  */
-  FOR_EACH_FRAME (tail, frame)
     {
-      Lisp_Object minibuf_frame;
-      minibuf_frame
-       = WINDOW_FRAME (XWINDOW (FRAME_MINIBUF_WINDOW (XFRAME (frame))));
-      if (FRAME_X_P (XFRAME (frame))
-         && FRAME_X_P (XFRAME (minibuf_frame))
-         && ! EQ (frame, minibuf_frame)
-         && FRAME_X_DISPLAY_INFO (XFRAME (minibuf_frame)) == dpyinfo)
-       Fdelete_frame (frame, Qt);
-    }
+      /* Indicate that this display is dead.  */
+      dpyinfo->display = 0;
 
-  /* Now delete all remaining frames on the dead display.
-     We are now sure none of these is used as the mini-buffer
-     for another frame that we need to delete.  */
-  FOR_EACH_FRAME (tail, frame)
-    if (FRAME_X_P (XFRAME (frame))
-       && FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
-      {
-       /* Set this to t so that Fdelete_frame won't get confused
-          trying to find a replacement.  */
-       FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt;
-       Fdelete_frame (frame, Qt);
-      }
+      dpyinfo->reference_count--;
+      dpyinfo->frame_display->reference_count--;
+      if (dpyinfo->reference_count != 0)
+        /* We have just closed all frames on this display. */
+        abort ();
 
-  if (dpyinfo)
-    x_delete_display (dpyinfo);
+      x_delete_display (dpyinfo);
+    }
 
   x_uncatch_errors (dpy, count);
 
-  if (x_display_list == 0)
+  if (display_list == 0)
     {
       fprintf (stderr, "%s\n", error_msg);
       shut_down_emacs (0, 0, Qnil);
@@ -7738,6 +7769,7 @@ x_connection_closed (dpy, error_message)
   sigunblock (sigmask (SIGALRM));
   TOTALLY_UNBLOCK_INPUT;
 
+  unbind_to (index, Qnil);
   clear_waiting_for_input ();
   error ("%s", error_msg);
 }
@@ -7942,7 +7974,7 @@ xim_destroy_callback (xim, client_data, call_data)
   FOR_EACH_FRAME (tail, frame)
     {
       struct frame *f = XFRAME (frame);
-      if (FRAME_X_DISPLAY_INFO (f) == dpyinfo)
+      if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo)
        {
          FRAME_XIC (f) = NULL;
           xic_free_xfontset (f);
@@ -8041,7 +8073,8 @@ xim_instantiate_callback (display, client_data, call_data)
        {
          struct frame *f = XFRAME (frame);
 
-         if (FRAME_X_DISPLAY_INFO (f) == xim_inst->dpyinfo)
+         if (FRAME_X_P (f)
+              && FRAME_X_DISPLAY_INFO (f) == xim_inst->dpyinfo)
            if (FRAME_XIC (f) == NULL)
              {
                create_frame_xic (f);
@@ -10103,6 +10136,7 @@ x_term_init (display_name, xrm_option, resource_name)
 {
   int connection;
   Display *dpy;
+  struct display *display;
   struct x_display_info *dpyinfo;
   XrmDatabase xrdb;
 
@@ -10237,6 +10271,8 @@ x_term_init (display_name, xrm_option, resource_name)
   dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
   bzero (dpyinfo, sizeof *dpyinfo);
 
+  display = x_create_frame_display (dpyinfo);
+
 #ifdef MULTI_KBOARD
   {
     struct x_display_info *share;
@@ -10248,30 +10284,30 @@ x_term_init (display_name, xrm_option, resource_name)
                         SDATA (display_name)))
        break;
     if (share)
-      dpyinfo->kboard = share->kboard;
+      display->kboard = share->frame_display->kboard;
     else
       {
-       dpyinfo->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
-       init_kboard (dpyinfo->kboard);
+       display->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+       init_kboard (display->kboard);
        if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
          {
            char *vendor = ServerVendor (dpy);
            UNBLOCK_INPUT;
-           dpyinfo->kboard->Vsystem_key_alist
+           display->kboard->Vsystem_key_alist
              = call1 (Qvendor_specific_keysyms,
                       build_string (vendor ? vendor : ""));
            BLOCK_INPUT;
          }
 
-       dpyinfo->kboard->next_kboard = all_kboards;
-       all_kboards = dpyinfo->kboard;
+       display->kboard->next_kboard = all_kboards;
+       all_kboards = display->kboard;
        /* Don't let the initial kboard remain current longer than necessary.
           That would cause problems if a file loaded on startup tries to
           prompt in the mini-buffer.  */
        if (current_kboard == initial_kboard)
-         current_kboard = dpyinfo->kboard;
+         current_kboard = display->kboard;
       }
-    dpyinfo->kboard->reference_count++;
+    display->kboard->reference_count++;
   }
 #endif
 
@@ -10286,6 +10322,11 @@ x_term_init (display_name, xrm_option, resource_name)
 
   dpyinfo->display = dpy;
 
+  /* Set the name of the display. */
+  display->name = (char *) xmalloc (SBYTES (display_name) + 1);
+  strncpy (display->name, SDATA (display_name), SBYTES (display_name));
+  display->name[SBYTES (display_name)] = 0;
+  
 #if 0
   XSetAfterFunction (x_current_display, x_trace_wire);
 #endif /* ! 0 */
@@ -10591,7 +10632,16 @@ x_delete_display (dpyinfo)
      struct x_display_info *dpyinfo;
 {
   int i;
+  struct display *d;
 
+  /* Delete the generic struct display for this X display. */
+  for (d = display_list; d; d = d->next_display)
+    if (d->type == output_x_window && d->display_info.x == dpyinfo)
+      {
+        delete_display (d);
+        break;
+      }
+    
   delete_keyboard_wait_descriptor (dpyinfo->connection);
 
   /* Discard this display from x_display_name_list and x_display_list.
@@ -10634,10 +10684,6 @@ x_delete_display (dpyinfo)
   XrmDestroyDatabase (dpyinfo->xrdb);
 #endif
 #endif
-#ifdef MULTI_KBOARD
-  if (--dpyinfo->kboard->reference_count == 0)
-    delete_kboard (dpyinfo->kboard);
-#endif
 #ifdef HAVE_X_I18N
   if (dpyinfo->xim)
     xim_close_dpy (dpyinfo);
@@ -10652,10 +10698,11 @@ x_delete_display (dpyinfo)
        xfree (dpyinfo->font_table[i].name);
       }
 
-  if (dpyinfo->font_table->font_encoder)
+  if (dpyinfo->font_table && dpyinfo->font_table->font_encoder)
     xfree (dpyinfo->font_table->font_encoder);
 
-  xfree (dpyinfo->font_table);
+  if (dpyinfo->font_table)
+    xfree (dpyinfo->font_table);
   xfree (dpyinfo->x_id_name);
   xfree (dpyinfo->color_cells);
   xfree (dpyinfo);
@@ -10689,70 +10736,123 @@ x_process_timeouts (timer)
 extern frame_parm_handler x_frame_parm_handlers[];
 
 static struct redisplay_interface x_redisplay_interface =
-{
-  x_frame_parm_handlers,
-  x_produce_glyphs,
-  x_write_glyphs,
-  x_insert_glyphs,
-  x_clear_end_of_line,
-  x_scroll_run,
-  x_after_update_window_line,
-  x_update_window_begin,
-  x_update_window_end,
-  x_cursor_to,
-  x_flush,
+  {
+    x_frame_parm_handlers,
+    x_produce_glyphs,
+    x_write_glyphs,
+    x_insert_glyphs,
+    x_clear_end_of_line,
+    x_scroll_run,
+    x_after_update_window_line,
+    x_update_window_begin,
+    x_update_window_end,
+    x_cursor_to,
+    x_flush,
 #ifdef XFlush
-  x_flush,
+    x_flush,
 #else
-  0,  /* flush_display_optional */
+    0,  /* flush_display_optional */
 #endif
-  x_clear_window_mouse_face,
-  x_get_glyph_overhangs,
-  x_fix_overlapping_area,
-  x_draw_fringe_bitmap,
-  0, /* define_fringe_bitmap */
-  0, /* destroy_fringe_bitmap */
-  x_per_char_metric,
-  x_encode_char,
-  x_compute_glyph_string_overhangs,
-  x_draw_glyph_string,
-  x_define_frame_cursor,
-  x_clear_frame_area,
-  x_draw_window_cursor,
-  x_draw_vertical_window_border,
-  x_shift_glyphs_for_insert
-};
+    x_clear_window_mouse_face,
+    x_get_glyph_overhangs,
+    x_fix_overlapping_area,
+    x_draw_fringe_bitmap,
+    0, /* define_fringe_bitmap */
+    0, /* destroy_fringe_bitmap */
+    x_per_char_metric,
+    x_encode_char,
+    x_compute_glyph_string_overhangs,
+    x_draw_glyph_string,
+    x_define_frame_cursor,
+    x_clear_frame_area,
+    x_draw_window_cursor,
+    x_draw_vertical_window_border,
+    x_shift_glyphs_for_insert
+  };
+
+
+/* This function is called when the last frame on a display is deleted. */
+void
+x_delete_frame_display (struct display *display)
+{
+  struct x_display_info *dpyinfo = display->display_info.x;
+  int i;
+
+  BLOCK_INPUT;
+  /* Free the fonts in the font table.  */
+  for (i = 0; i < dpyinfo->n_fonts; i++)
+    if (dpyinfo->font_table[i].name)
+      {
+       XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font);
+      }
+
+  x_destroy_all_bitmaps (dpyinfo);
+  XSetCloseDownMode (dpyinfo->display, DestroyAll);
+
+#ifdef USE_X_TOOLKIT
+  XtCloseDisplay (dpyinfo->display);
+#else
+#ifdef USE_GTK
+  xg_display_close (dpyinfo->display);
+#else
+  XCloseDisplay (dpyinfo->display);
+#endif
+#endif
+
+  x_delete_display (dpyinfo);
+  UNBLOCK_INPUT;
+}
+
+
+struct display *
+x_create_frame_display (struct x_display_info *dpyinfo)
+{
+  struct display *display;
+  
+  display = create_display ();
+
+  display->type = output_x_window;
+  display->display_info.x = dpyinfo;
+  dpyinfo->frame_display = display;
+
+  /* kboard is initialized in x_term_init. */
+  
+  display->clear_frame_hook = x_clear_frame;
+  display->ins_del_lines_hook = x_ins_del_lines;
+  display->delete_glyphs_hook = x_delete_glyphs;
+  display->ring_bell_hook = XTring_bell;
+  display->reset_terminal_modes_hook = XTreset_terminal_modes;
+  display->set_terminal_modes_hook = XTset_terminal_modes;
+  display->update_begin_hook = x_update_begin;
+  display->update_end_hook = x_update_end;
+  display->set_terminal_window_hook = XTset_terminal_window;
+  display->read_socket_hook = XTread_socket;
+  display->frame_up_to_date_hook = XTframe_up_to_date;
+  display->mouse_position_hook = XTmouse_position;
+  display->frame_rehighlight_hook = XTframe_rehighlight;
+  display->frame_raise_lower_hook = XTframe_raise_lower;
+  display->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar;
+  display->condemn_scroll_bars_hook = XTcondemn_scroll_bars;
+  display->redeem_scroll_bar_hook = XTredeem_scroll_bar;
+  display->judge_scroll_bars_hook = XTjudge_scroll_bars;
+
+  display->delete_frame_hook = x_destroy_window;
+  display->delete_display_hook = x_delete_frame_display;
+  
+  display->rif = &x_redisplay_interface;
+  display->scroll_region_ok = 1;    /* We'll scroll partial frames. */
+  display->char_ins_del_ok = 1;
+  display->line_ins_del_ok = 1;         /* We'll just blt 'em. */
+  display->fast_clear_end_of_line = 1;  /* X does this well. */
+  display->memory_below_frame = 0;   /* We don't remember what scrolls
+                                        off the bottom. */
+
+  return display;
+}
 
 void
 x_initialize ()
 {
-  rif = &x_redisplay_interface;
-
-  clear_frame_hook = x_clear_frame;
-  ins_del_lines_hook = x_ins_del_lines;
-  delete_glyphs_hook = x_delete_glyphs;
-  ring_bell_hook = XTring_bell;
-  reset_terminal_modes_hook = XTreset_terminal_modes;
-  set_terminal_modes_hook = XTset_terminal_modes;
-  update_begin_hook = x_update_begin;
-  update_end_hook = x_update_end;
-  set_terminal_window_hook = XTset_terminal_window;
-  read_socket_hook = XTread_socket;
-  frame_up_to_date_hook = XTframe_up_to_date;
-  mouse_position_hook = XTmouse_position;
-  frame_rehighlight_hook = XTframe_rehighlight;
-  frame_raise_lower_hook = XTframe_raise_lower;
-  set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar;
-  condemn_scroll_bars_hook = XTcondemn_scroll_bars;
-  redeem_scroll_bar_hook = XTredeem_scroll_bar;
-  judge_scroll_bars_hook = XTjudge_scroll_bars;
-
-  scroll_region_ok = 1;                /* we'll scroll partial frames */
-  char_ins_del_ok = 1;
-  line_ins_del_ok = 1;         /* we'll just blt 'em */
-  fast_clear_end_of_line = 1;  /* X does this well */
-  memory_below_frame = 0;      /* we don't remember what scrolls
-                                  off the bottom */
   baud_rate = 19200;
 
   x_noop_count = 0;
@@ -10807,9 +10907,11 @@ x_initialize ()
   XSetIOErrorHandler (x_io_error_quitter);
 
   /* Disable Window Change signals;  they are handled by X events.  */
+#if 0              /* Don't.  We may want to open tty frames later. */
 #ifdef SIGWINCH
   signal (SIGWINCH, SIG_DFL);
 #endif /* SIGWINCH */
+#endif
 
   signal (SIGPIPE, x_connection_signal);
 }
index df444bfea7b878d5ce41ec13736856c45747790b..b05efa32746529b0b2dae08fe5ce3e200fe85de9 100644 (file)
@@ -327,9 +327,6 @@ struct x_display_info
   /* Atom used in toolkit scroll bar client messages.  */
   Atom Xatom_Scrollbar;
 
-#ifdef MULTI_KBOARD
-  struct kboard *kboard;
-#endif
   int cut_buffers_initialized; /* Whether we're sure they all exist */
 
   /* The frame (if any) which has the X window that has keyboard focus.
@@ -389,6 +386,9 @@ struct x_display_info
       X_WMTYPE_A,
       X_WMTYPE_B
     } wm_type;
+
+  /* The generic display parameters corresponding to this X display. */
+  struct display *frame_display;
 };
 
 #ifdef HAVE_X_I18N