1

I always set up emacs running in server mode, and every time I update Ubuntu, the procedure to do this changes.

Even though I have all the same setting in my /.bash_aliases and /.emacs, it will not work.

I have emacs 24.3.x (whatever the most recent version is), I have AUCTeX cvs, and TeX Live 2013 installed.

In my ./bash_aliases, I have

emacs = 'emacsclient -t --alternate-editor='

The relevant information in my /.emacs is

;; Start server and set directory                                               
(setq server-socket-dir (format "/tmp/emacs%d" (user-uid)))
(server-start)

(custom-set-variables
 '(TeX-PDF-mode t)
 '(TeX-show-compilation t)
 '(TeX-newline-function (quote newline-and-indent))
 '(TeX-source-correlate-method (quote synctex))
 '(TeX-source-correlate-mode t)
 '(TeX-source-correlate-start-server t))

Problems only occur opening LaTeX files. Sometimes it says another server is running and other times it says:

dustin@dustin:~/Documents/NUPOC/NUPOCSoln$ emacs SolnNUPOC.tex 
emacsclient.emacs24: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
Warning: due to a long standing Gtk+ bug
http://bugzilla.gnome.org/show_bug.cgi?id=85715
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
("emacs")
Loading 00debian-vars...
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50cmake-data.el (source)...
Loading /etc/emacs/site-start.d/50cmake-data.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Error while loading 50dictionaries-common: Symbol's value as variable is void: debian-aspell-only-dictionary-alist
Loading paren...
Loading paren...done
Warning: no abbrev-file found, customize `abbrev-file-name' in order to make mode-specific abbrevs work. 
Starting Emacs daemon.
Restarting server

I read in the manual a footnote that:


Some programs use a different environment variable; for example, to make TeX use ‘emacsclient’, set the TEXEDIT environment variable to ‘emacsclient +%d %s’.


There is no mention (that I can find) on where and how to set the TEXEDIT environment.

  1. How do I set the TEXEDIT environment? or
  2. How can I set up emacsclient to work?

This set up worked prior to having to re-install everything.

1

I was able to get the server to start and work for synctex. It will still issue this message:

emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".

Warning: due to a long standing Gtk+ bug
http://bugzilla.gnome.org/show_bug.cgi?id=85715
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Loading paren...
Loading paren...done
Loading server...
Loading server...done
Warning: no abbrev-file found, customize `abbrev-file-name' in order to make mode-specific abbrevs work. 
Starting Emacs daemon.
Restarting server
Emacs daemon should have started, trying to connect again

What I changed was my /.bash_aliases and /.emacs.

If you open emacs first without specifying a file and then open a file, you will not receive the the warning above. I have no idea why it works flawlessly in that order opposed to going directly to a file.

For my aliases, I now have:

# emacs aliases for server mode
alias emacs='emacsclient -t -s server --alternate-editor='

The -s is short for --socket-name=; therefore, -s server is --socket-name=server.

I found this by M-x describe-variable then server-socket-name and the name should output for you. Also, we can locate the directory with the same M-x and then server-socket-dir

In my ~/.emacs, I changed:

;; Start server and set directory                
(setq server-socket-dir (format "/tmp/emacs1000" (user-uid)))
;(server-start)  has been commented out

In the custom set variables, I added: '(server-mode t).

I don't know if there is a difference between (server-start) and the custom variables '(server-mode t). I will test out using one or the other and both to see what happens later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.