[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

C.4 Resuming Emacs with Arguments

You can specify action arguments for Emacs when you resume it after a suspension. To prepare for this, put the following code in your ‘.emacs’ file (voir la section Hooks):

 
(add-hook 'suspend-hook 'resume-suspend-hook)
(add-hook 'suspend-resume-hook 'resume-process-args)

As further preparation, you must execute the shell script ‘emacs.csh’ (if you use csh as your shell) or ‘emacs.bash’ (if you use bash as your shell). These scripts define an alias named edit, which will resume Emacs giving it new command line arguments such as files to visit. The scripts are found in the ‘etc’ subdirectory of the Emacs distribution.

Only action arguments work properly when you resume Emacs. Initial arguments are not recognized—it's too late to execute them anyway.

Note that resuming Emacs (with or without arguments) must be done from within the shell that is the parent of the Emacs job. This is why edit is an alias rather than a program or a shell script. It is not possible to implement a resumption command that could be run from other subjobs of the shell; there is no way to define a command that could be made the value of EDITOR, for example. Therefore, this feature does not take the place of the Emacs Server feature (@pxref{Emacs Server}).

The aliases use the Emacs Server feature if you appear to have a server Emacs running. However, they cannot determine this with complete accuracy. They may think that a server is still running when in actuality you have killed that Emacs, because the file ‘/tmp/esrv…’ still exists. If this happens, find that file and delete it.


Ce document a été généré par Eric Reinbold le 23 Février 2009 en utilisant texi2html 1.78.