Closed yuzumx closed 7 years ago
What do you mean emacs crashes? What's the error?
Also I really don't think you want to add .c
to the list of header files. The point of this variable is to define which files are headers for the given major mode. So don't add .c
to this list unless you routinely #include
them.
Also you might not understand how rx
works. This builds a regular expression using a relatively intuitive syntax. In this case ".h"
followed by ".c"
means exactly that: a file name ending in .h.c
. I sincerely doubt that's what you want.
SO.....
Well, I am bad.
My intention is to let the mode in the ". C" file automatically trigger.Because now I have to manually use M-x company-c-headers
to trigger auto-complete the header files name.
The emacs-crash
message:
(mx-c-cpp.el
is my configuration file about this mode and other C language modes, I'm sure there is no error before adding the problem code.)
eval-buffer: End of file during parsing: /home/tlmf/.emacs.d/lisp/mx-c-cpp.el
Code for your mode (Doesn't contain the wrong period) :
(when (maybe-require-package 'company-c-headers)
(after-load 'company
(add-hook 'c-mode-common-hook
(lambda () (mx/local-push-company-backend 'company-c-headers)))))
I added the code in the issue after that, and then went wrong.
The contents of the function mx/local-push-company-backend
:
(defun mx/local-push-company-backend (backend)
"Add BACKEND to a buffer-local version of `company-backends'."
(set (make-local-variable 'company-backends)
(append (list backend) company-backends))))
I what to start your mode on .c and .cpp file. but the emacs crash when I changed the
company-c-headers-modes
my code :What's I wrong ?