I would like to override the default Emacs cc-mode.el
with another file. In my .emacs
, I have the following line:
(add-to-list 'load-path "/usr/home/smooth/emacs" t)
This works correctly to load local Emacs configuration files. For example
(require 'go-mode-autoloads)
works to load go-mode.el
from the above directory.
I tried placing the required cc-mode.el
file into the above directory in the hope that it would override the default Emacs c-mode
. However, it did not load the cc-mode.el
file which I had put in /usr/home/smooth/emacs
. Instead it continued to use the default one.
How can I make Emacs use my cc-mode.el
file and not the default one? I have already extensively searched with Google and tried the Emacs Wiki, but I couldn't find the correct page.
Alternatively, how I can I set Emacs to use another file for c-mode
than the system default? I don't mind renaming the current cc-mode.el
to another name.
My version of Emacs is 25.2.
Looking at Emacs Wiki, I noticed there was no "t" at the end of the "load-path", so I removed that and it started working. The "t" above may be the origin of the problem. What is very strange is that the misbehaviour in cc-mode I was trying to get around has also disappeared. The above "t" may have caused some sort of other errors. See emacswiki.org/emacs/LoadPath for the Emacs Wiki page.
I found this page: gnu.org/software/emacs/manual/html_node/elisp/…. It says Normally, if element is added, it is added to the front of symbol, but if the optional argument append is non-nil, it is added at the end. It seems I was adding at the end. I'm not sure why that broke cc-mode so horribly, since it was working until I switched to emacs 25.2 a few days ago. It's now working well.