aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-04-22 04:21:39 +0000
committerChong Yidong2009-04-22 04:21:39 +0000
commitdca019f8593ef4802550f370e88c363392ef7cb8 (patch)
tree8f76bccf937404d2d6c5a96837ae28de570a1f87
parentfdc496e7d1a7eade06cdd9a6de74a385033ff6fc (diff)
downloademacs-dca019f8593ef4802550f370e88c363392ef7cb8.tar.gz
emacs-dca019f8593ef4802550f370e88c363392ef7cb8.zip
* os.texi (Command-Line Arguments): Document
command-line-args-left. (Suspending Emacs): Adapt text to multi-tty case. Document use of terminal objects for tty arguments. (Startup Summary): Add xref to Session Management. (Session Management): Mention emacs-session-restore. Copyedits.
-rw-r--r--doc/lispref/ChangeLog9
-rw-r--r--doc/lispref/os.texi115
2 files changed, 71 insertions, 53 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index bc9d3a4c9e9..a7398e86bb4 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,12 @@
12009-04-22 Chong Yidong <cyd@stupidchicken.com>
2
3 * os.texi (Command-Line Arguments): Document
4 command-line-args-left.
5 (Suspending Emacs): Adapt text to multi-tty case. Document use of
6 terminal objects for tty arguments.
7 (Startup Summary): Add xref to Session Management.
8 (Session Management): Mention emacs-session-restore. Copyedits.
9
12009-04-20 Chong Yidong <cyd@stupidchicken.com> 102009-04-20 Chong Yidong <cyd@stupidchicken.com>
2 11
3 * os.texi (Startup Summary): Copyedits. The init file is not 12 * os.texi (Startup Summary): Copyedits. The init file is not
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 041e23a810b..6b8a2eca700 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -189,7 +189,7 @@ not done if @code{initial-buffer-choice} or
189@item 189@item
190If started by the X session manager, it calls 190If started by the X session manager, it calls
191@code{emacs-session-restore} passing it as argument the ID of the 191@code{emacs-session-restore} passing it as argument the ID of the
192previous session. @c FIXME: add an xref to the Emacs manual! 192previous session. @xref{Session Management}.
193@end enumerate 193@end enumerate
194 194
195@defopt inhibit-startup-screen 195@defopt inhibit-startup-screen
@@ -488,6 +488,11 @@ The value of this variable is the list of command-line arguments passed
488to Emacs. 488to Emacs.
489@end defvar 489@end defvar
490 490
491@defvar command-line-args-left
492The value of this variable is the list of command-line arguments that
493have not yet been processed. @code{argv} is an alias for this.
494@end defvar
495
491@defvar command-line-functions 496@defvar command-line-functions
492This variable's value is a list of functions for handling an 497This variable's value is a list of functions for handling an
493unrecognized command-line argument. Each time the next argument to be 498unrecognized command-line argument. Each time the next argument to be
@@ -582,28 +587,24 @@ how Emacs is killed, put it on @code{kill-emacs-hook}.
582@subsection Suspending Emacs 587@subsection Suspending Emacs
583@cindex suspending Emacs 588@cindex suspending Emacs
584 589
585 @dfn{Suspending Emacs} means stopping Emacs temporarily and returning 590 On text-only terminals, it is possible to @dfn{suspend Emacs}, which
586control to its superior process, which is usually the shell. This 591means stopping Emacs temporarily and returning control to its superior
587allows you to resume editing later in the same Emacs process, with the 592process, which is usually the shell. This allows you to resume
588same buffers, the same kill ring, the same undo history, and so on. To 593editing later in the same Emacs process, with the same buffers, the
589resume Emacs, use the appropriate command in the parent shell---most 594same kill ring, the same undo history, and so on. To resume Emacs,
590likely @code{fg}. 595use the appropriate command in the parent shell---most likely
596@code{fg}.
591 597
592@cindex controlling terminal 598@cindex controlling terminal
593 Suspending works only on a terminal device from which the Emacs 599 Suspending works only on a terminal device from which the Emacs
594session was started. We call that device the @dfn{controlling 600session was started. We call that device the @dfn{controlling
595terminal} of the session. 601terminal} of the session. Suspending is not allowed if the
602controlling terminal is a graphical terminal.
596 603
597 Some operating systems do not support suspension of jobs; on these 604 Some operating systems do not support suspension of jobs; on these
598systems, ``suspension'' actually creates a new shell temporarily as a 605systems, ``suspension'' actually creates a new shell temporarily as a
599subprocess of Emacs. Then you would exit the shell to return to Emacs. 606subprocess of Emacs. Then you would exit the shell to return to Emacs.
600 607
601 Suspension is not useful with window systems, because the Emacs job
602may not have a parent that can resume it again, and in any case you can
603give input to some other job such as a shell merely by moving to a
604different window. Therefore, suspending is not allowed when Emacs is using
605a window system (X, MS Windows).
606
607@defun suspend-emacs &optional string 608@defun suspend-emacs &optional string
608This function stops Emacs and returns control to the superior process. 609This function stops Emacs and returns control to the superior process.
609If and when the superior process resumes Emacs, @code{suspend-emacs} 610If and when the superior process resumes Emacs, @code{suspend-emacs}
@@ -612,24 +613,23 @@ returns @code{nil} to its caller in Lisp.
612This function works only on the controlling terminal of the Emacs 613This function works only on the controlling terminal of the Emacs
613session; to relinquish control of other tty devices, use 614session; to relinquish control of other tty devices, use
614@code{suspend-tty} (see below). If the Emacs session uses more than 615@code{suspend-tty} (see below). If the Emacs session uses more than
615one terminal device, you will need to delete the frames on all the 616one terminal, you must delete the frames on all the other terminals
616other devices before suspending Emacs, otherwise this function signals 617before suspending Emacs, or this function signals an error.
617an error. 618@xref{Multiple Terminals}.
618 619
619If @var{string} is non-@code{nil}, its characters are sent to be read 620If @var{string} is non-@code{nil}, its characters are sent to Emacs's
620as terminal input by Emacs's superior shell. The characters in 621superior shell, to be read as terminal input. The characters in
621@var{string} are not echoed by the superior shell; only the results 622@var{string} are not echoed by the superior shell; only the results
622appear. 623appear.
623 624
624Before suspending, @code{suspend-emacs} runs the normal hook 625Before suspending, @code{suspend-emacs} runs the normal hook
625@code{suspend-hook}. 626@code{suspend-hook}. After the user resumes Emacs,
626 627@code{suspend-emacs} runs the normal hook @code{suspend-resume-hook}.
627After the user resumes Emacs, @code{suspend-emacs} runs the normal hook 628@xref{Hooks}.
628@code{suspend-resume-hook}. @xref{Hooks}.
629 629
630The next redisplay after resumption will redraw the entire screen, 630The next redisplay after resumption will redraw the entire screen,
631unless the variable @code{no-redraw-on-reenter} is non-@code{nil} 631unless the variable @code{no-redraw-on-reenter} is non-@code{nil}.
632(@pxref{Refresh Screen}). 632@xref{Refresh Screen}.
633 633
634In the following example, note that @samp{pwd} is not echoed after 634In the following example, note that @samp{pwd} is not echoed after
635Emacs is suspended. But it is read and executed by the shell. 635Emacs is suspended. But it is read and executed by the shell.
@@ -691,25 +691,26 @@ after a suspension.
691If @var{tty} specifies a terminal device used by Emacs, this function 691If @var{tty} specifies a terminal device used by Emacs, this function
692relinquishes the device and restores it to its prior state. Frames 692relinquishes the device and restores it to its prior state. Frames
693that used the device continue to exist, but are not updated and Emacs 693that used the device continue to exist, but are not updated and Emacs
694doesn't read input from them. If @var{tty} is a frame, it means that 694doesn't read input from them. @var{tty} can be a terminal object, a
695frame's terminal; if it is @code{nil}, the function uses the selected 695frame (meaning the terminal for that frame), or @code{nil} (meaning
696frame's terminal. If @var{tty} is already suspended, the function 696the terminal for the selected frame). @xref{Multiple Terminals}.
697does nothing. 697
698 698If @var{tty} is already suspended, this function does nothing.
699This function runs the hook @code{suspend-tty-functions} (each 699
700function gets one argument, the terminal that corresponds to 700This function runs the hook @code{suspend-tty-functions}, passing the
701@var{tty}). 701terminal object as an argument to each function.
702@end defun 702@end defun
703 703
704@defun resume-tty &optional tty 704@defun resume-tty &optional tty
705Resume the previously suspended terminal device @var{tty}. If 705This function resumes the previously suspended terminal device
706@var{tty} is a frame, it means resume that frame's terminal; 706@var{tty}; @var{tty} can be a terminal object, a frame (meaning the
707@code{nil} means the selected frame. 707terminal for that frame), or @code{nil} (meaning the terminal for the
708selected frame).
708 709
709This function reopens the terminal device, re-initializes it, and 710This function reopens the terminal device, re-initializes it, and
710redraws its with that terminal's selected frame. It then runs the 711redraws its with that terminal's selected frame. It then runs the
711hook @code{resume-tty-functions}, passing each function the terminal 712hook @code{resume-tty-functions}, passing the terminal object as an
712which corresponds to @var{tty}. 713argument to each function.
713 714
714If the same device is already used by another Emacs terminal, this 715If the same device is already used by another Emacs terminal, this
715function signals an error. 716function signals an error.
@@ -717,7 +718,9 @@ function signals an error.
717 718
718@defun controlling-tty-p &optional terminal 719@defun controlling-tty-p &optional terminal
719This function returns non-@code{nil} if @var{terminal} is the 720This function returns non-@code{nil} if @var{terminal} is the
720controlling terminal device of the Emacs session. 721controlling terminal of the Emacs session; @code{terminal} can be a
722terminal object, a frame (meaning the terminal for that frame), or
723@code{nil} (meaning the terminal for the selected frame).
721@end defun 724@end defun
722 725
723@deffn Command suspend-frame 726@deffn Command suspend-frame
@@ -2131,12 +2134,13 @@ This variable is non-@code{nil} when Emacs is running in batch mode.
2131@section Session Management 2134@section Session Management
2132@cindex session manager 2135@cindex session manager
2133 2136
2134Emacs supports the X Session Management Protocol for suspension and 2137Emacs supports the X Session Management Protocol, which is used to
2135restart of applications. In the X Window System, a program called the 2138suspend and restart applications. In the X Window System, a program
2136@dfn{session manager} has the responsibility to keep track of the 2139called the @dfn{session manager} is responsible for keeping track of
2137applications that are running. During shutdown, the session manager 2140the applications that are running. When the X server shuts down, the
2138asks applications to save their state, and delays the actual shutdown 2141session manager asks applications to save their state, and delays the
2139until they respond. An application can also cancel the shutdown. 2142actual shutdown until they respond. An application can also cancel
2143the shutdown.
2140 2144
2141When the session manager restarts a suspended session, it directs 2145When the session manager restarts a suspended session, it directs
2142these applications to individually reload their saved state. It does 2146these applications to individually reload their saved state. It does
@@ -2145,14 +2149,19 @@ saved session to restore. For Emacs, this argument is @samp{--smid
2145@var{session}}. 2149@var{session}}.
2146 2150
2147@defvar emacs-save-session-functions 2151@defvar emacs-save-session-functions
2148Emacs supports saving state by using a hook called 2152Emacs supports saving state via a hook called
2149@code{emacs-save-session-functions}. Each function in this hook is 2153@code{emacs-save-session-functions}. Emacs runs this hook when the
2150called when the session manager tells Emacs that the window system is 2154session manager tells it that the window system is shutting down. The
2151shutting down. The functions are called with no arguments and with the 2155functions are called with no arguments, and with the current buffer
2152current buffer set to a temporary buffer. Each function can use 2156set to a temporary buffer. Each function can use @code{insert} to add
2153@code{insert} to add Lisp code to this buffer. At the end, Emacs 2157Lisp code to this buffer. At the end, Emacs saves the buffer in a
2154saves the buffer in a file that a subsequent Emacs invocation will 2158file, called the @dfn{session file}.
2155load in order to restart the saved session. 2159
2160@findex emacs-session-restore
2161Subsequently, when the session manager restarts Emacs, it loads the
2162session file automatically (@pxref{Loading}). This is performed by a
2163function named @code{emacs-session-restore}, which is called during
2164startup. @xref{Startup Summary}.
2156 2165
2157If a function in @code{emacs-save-session-functions} returns 2166If a function in @code{emacs-save-session-functions} returns
2158non-@code{nil}, Emacs tells the session manager to cancel the 2167non-@code{nil}, Emacs tells the session manager to cancel the