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-xserver-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)。どちらか一方、または両方を使用してテストし、後で何が起こるかを確認します。

関連情報