Emacs: использование emacsclient

Emacs: использование emacsclient

Я всегда настраиваю emacs в режиме сервера, и каждый раз, когда я обновляю Ubuntu, процедура выполнения этого действия меняется.

/.bash_aliasesНесмотря на то, что у меня в и установлены те же настройки /.emacs, это не сработает.

У меня установлены emacs 24.3.x (любая последняя версия), AUCTeX cvs и TeX Live 2013.

В моем ./bash_aliases, у меня есть

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

Соответствующая информация в моем /.emacsесть

;; 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))

Проблемы возникают только при открытии файлов LaTeX. Иногда он говорит, что запущен другой сервер, а иногда он говорит:

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

Я прочитал вруководствосноска, которая:


Некоторые программы используют другую переменную среды; например, чтобы TeX использовал «emacsclient», установите переменную среды TEXEDIT на «emacsclient +%d %s».


Я не нашел никаких упоминаний о том, где и как настроить среду TEXEDIT.

  1. Как настроить среду TEXEDIT? или
  2. Как настроить emacsclient для работы?

Эта настройка работала до того, как пришлось все переустанавливать.

решение1

Мне удалось запустить и запустить сервер для synctex. Он все равно выдает это сообщение:

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

Я изменил свои /.bash_aliasesи /.emacs.

Если вы сначала откроете emacs, не указав файл, а затем откроете файл, вы не получите предупреждение выше. Я понятия не имею, почему он работает безупречно в таком порядке, а не при прямом переходе к файлу.

Теперь у меня есть следующие псевдонимы:

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

Это -sсокращение от --socket-name=; следовательно, -s serverэто --socket-name=server.

Я нашел это к M-x describe-variableтому времени server-socket-name, и имя должно вывести для вас. Также мы можем найти каталог с тем же самым, M-xа затемserver-socket-dir

В моем ~/.emacs, я изменил:

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

В пользовательском наборе переменных я добавил: '(server-mode t).

Я не знаю, есть ли разница между (server-start)и пользовательскими переменными '(server-mode t). Я попробую использовать один или другой и оба, чтобы посмотреть, что получится позже.

Связанный контент