Go to the first, previous, next, last section, table of contents.

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 (see 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.

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; 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 (see section Using Emacs as a 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.

Go to the first, previous, next, last section, table of contents.