EMACS와 호환되는 PHP 모드 (및 기타 CC 모드 파생 모드) 만들기 23

StackOverflow https://stackoverflow.com/questions/898063

  •  23-08-2019
  •  | 
  •  

문제

나는 EMACS 23을 사용하고 있습니다 php-mode.el 1.5.0. 내가 이것을 가지고있을 때 .emacs:

(require 'php-mode)

EMACS가 시작되면이 오류 메시지가 표시됩니다.

경고 (초기화) :`/users/kdj/.emacs '를로드하는 동안 오류가 발생했습니다.

오류 :`c-lang-defconst '는 파일에 사용해야합니다.

내가 평가하면 (require 'php-mode) EMACS가 시작되면 오류 메시지가 없습니다.

나는 a를 찾았다 블로그 항목

이것이 중요한지 모르겠지만 Mac OS X를 사용하고 있으며 현재 CVS 소스에서 EMAC를 구축하여 사용하고 있습니다. ./configure --with-ns.

여기서 무슨 일이 일어나고 있는지 또는 어떻게 고칠 수 있습니까?

도움이 되었습니까?

해결책

;;   This code doesn't seem to work when you compile it, then
;;   load/require in the Emacs file. You will get an error (error
;;   "`c-lang-defconst' must be used in a file") which happens because
;;   cc-mode doesn't think it is in a buffer while loading directly
;;   from the init. However, if you call it based on a file extension,
;;   it works properly. Interestingly enough, this doesn't happen if
;;   you don't byte-compile cc-mode.

따라서 .Emacs에 넣을 빠르고 더러운 수정은 확장에 자동로드하고 넣지 않는 것입니다. (require 'php-mode) 또는 (load "php-mode") 거기에. 더 이상 고민하지 않고

(autoload 'php-mode "php-mode" "Major mode for editing php code." t)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))

이게 도움이 되길 바란다! Now I just need to get the PHP/HTML mode switching stuff working. Wish me luck.

다른 팁

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top