[Tfug] Conditional execution of .emacs?
Robert Hunter
hunter at tfug.org
Thu Jun 5 15:33:22 MST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thu, Jun 05, 2008 at 02:26:25PM -0700, Claude Rubinson wrote:
> Hi all,
>
> My emacs knowledge seems to be failing me here. There are parts of my
> .emacs file that I want to execute depending upon how I start emacs
> up. More specifically: in general, I use gnuclient/gnuserv. However,
> under a few circumstances, I like to start up emacs within an xterm
> via "emacs -nw" (primarily I do so when I want to use R from within
> emacs).
>
> Invoking emacs as non-windowed wreaks havoc with gnuserv. So, what
> I'd like to do is avoid (re)starting gnuserv when I invoke "emacs
> -nw". Or, alternatively, only start gnuserv when emacs is started
> from X.
>
> Any ideas?
Claude, I think there are several ways to do this. For instance, you
could specify a different init file when invoking emacs.
Alternatively, you can start the emacsserver with --eval. Yet another
way is to test the value of an environment variable which you can
explicitly set prior to invoking emacs, or in my case, I just use
SESSION_MANAGER. Here is a snippet from my .emacs:
(if (not (eq (getenv "SESSION_MANAGER") 'nil))
(server-start)
(message "emacs server started"))
- --Rob
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFISGmyJ1pz6tWxufARAtLWAJ4o8UUpjAbH/Pl2z3l1sc8lnvR12QCfSN+t
Brv6jkdUSX60T6s10QyeuuY=
=RNMv
-----END PGP SIGNATURE-----
More information about the tfug
mailing list