Emacs: usando emacsclient

Emacs: usando emacsclient

Eu sempre configuro o emacs rodando em modo servidor, e toda vez que atualizo o Ubuntu, o procedimento para fazer isso muda.

Mesmo que eu tenha a mesma configuração no meu /.bash_aliasese /.emacs, não funcionará.

Tenho o emacs 24.3.x (qualquer que seja a versão mais recente), tenho o AUCTeX cvs e o TeX Live 2013 instalados.

Na minha ./bash_aliases, eu tenho

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

A informação relevante no meu /.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))

Os problemas ocorrem apenas na abertura de arquivos LaTeX. Às vezes diz que outro servidor está em execução e outras vezes diz:

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

eu li nomanualuma nota de rodapé que:


Alguns programas usam uma variável de ambiente diferente; por exemplo, para fazer o TeX usar 'emacsclient', defina a variável de ambiente TEXEDIT como 'emacsclient +%d %s'.


Não há menção (que eu possa encontrar) sobre onde e como definir o ambiente TEXEDIT.

  1. Como configuro o ambiente TEXEDIT? ou
  2. Como posso configurar o emacsclient para funcionar?

Esta configuração funcionou antes de ter que reinstalar tudo.

Responder1

Consegui fazer com que o servidor iniciasse e funcionasse synctex. Ele ainda emitirá esta mensagem:

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

O que eu mudei foi meu /.bash_aliasese /.emacs.

Se você abrir o emacs primeiro sem especificar um arquivo e depois abrir um arquivo, não receberá o aviso acima. Não tenho ideia de por que funciona perfeitamente nessa ordem, em vez de ir diretamente para um arquivo.

Para meus aliases, agora tenho:

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

O -sé a abreviação de --socket-name=; portanto, -s serveré --socket-name=server.

Eu encontrei isso até M-x describe-variableentão server-socket-namee o nome deve ser exibido para você. Além disso, podemos localizar o diretório com o mesmo M-xe entãoserver-socket-dir

No meu ~/.emacs, mudei:

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

Nas variáveis ​​do conjunto personalizado, adicionei: '(server-mode t).

Não sei se existe diferença entre (server-start)e as variáveis ​​personalizadas '(server-mode t). Vou testar usando um ou outro e ambos para ver o que acontece mais tarde.

informação relacionada