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). 나중에 어떤 일이 발생하는지 확인하기 위해 둘 중 하나와 둘 다를 사용하여 테스트하겠습니다.

관련 정보