7

I recently began running emacs in daemon mode on startup. Connecting via GUI client (Emacs.app) appears to load customizations correctly. However, connecting via emacsclient in Terminal does not.

The first symptom appeared after trying to M-x customize-variable in Terminal which produced the following message:

Cannot save customizations: init file was not fully loaded

This may have something to do with emacs --daemon ignoring all X11-related options according to this. Though it would appear in my case that instead of ignoring the X11-related options emacsclient fails to load subsequent options.

After researching the problem and possible solutions I've been unable to determine a bulletproof method for dealing with this. I've seen suggestions to create a different init file and corresponding bash alias that passes it to emacsclient --eval each time one wants to open an emacs buffer in Terminal. And I've seen others who use if-else statements in their main init file to deal with X11-related options. But before going down one path or another I'm wondering if there's a canonical way of dealing with this that I've somehow overlooked (or if I've simply made a mistake somewhere).

Advice, criticism, tips would be much appreciated.

Edit to add:
* GNU Emacs 24.3.1
* emacsclient 24.3
* both installed with homebrew on OS X 10.9

Here is the LaunchAgent:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>emacsdaemon</string> <key>ProgramArguments</key> <array> <string>/opt/boxen/homebrew/bin/emacs</string> <string>--daemon</string> </array> <key>RunAtLoad</key> <true/> <key>ServiceDescription</key> <string>Emacs Daemon</string> <key>UserName</key> <string>my_name</string> </dict> </plist> 

Here are the dotfile configs:

# relevant lines of .zshrc: alias emacs="/opt/boxen/homebrew/bin/emacsclient -nw" # set emacsclient as default editor export EDITOR="emacsclient" # use only emacscilent export ALTERNATE_EDITOR="" 

Sometimes I also like to launch emacs from within tmux:

# relevant lines of .tmux.conf: # open emacs inside of tmux in a new window # hat tip: http://perlstalker.vuser.org/blog/2012/10/16/emacsclient-and-tmux/ bind-key y new-window -n "emacs" "/opt/boxen/homebrew/bin/emacsclient -nw" 
2
  • Which version of Emacs? OSX users are often running quite old versions. Does this still happen with the current release? Commented Mar 30, 2014 at 21:43
  • @phils, I'm running version 24.3, installed with homebrew on OS X 10.9. Commented Mar 31, 2014 at 3:44

1 Answer 1

1

emacsclient does not cause any part of the init file from being read. I.e. in your use case, you need to setup your init file such that it covers all use cases (both for text-terminals and for GUI frames) since you can have several of the different kinds at the same time anyway.

The Cannot save customizations: init file was not fully loaded message indicates that an error was signaled while loading ~/.emacs, so go check the contents of *Messages* to see what the error was and try to fix it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.