I added the following line to my init file to replace ruby-mode
with enh-ruby-mode
:
(setq auto-mode-alist
(mapcar
(lambda (x)
(if (eq (cdr x) 'ruby-mode)
(cons (car x) 'enh-ruby-mode)
x)) auto-mode-alist))
But it works only for the first file. The first ruby
file I open is in enh-ruby-mode
. But in the process the following command is executed:
/usr/share/emacs/26.3/lisp/progmodes/ruby-mode.el.gz
:
;;;###autoload
(add-to-list 'auto-mode-alist
(cons (purecopy (concat "\\(?:\\.\\(?:"
"rbw?\\|ru\\|rake\\|thor"
"\\|jbuilder\\|rabl\\|gemspec\\|podspec"
"\\)"
"\\|/"
"\\(?:Gem\\|Rake\\|Cap\\|Thor"
"\\|Puppet\\|Berks"
"\\|Vagrant\\|Guard\\|Pod\\)file"
"\\)\\'"))
'ruby-mode))
(The same line is in /usr/share/emacs/26.3/lisp/loaddefs.el
.) Which means the second and the following files are opened in ruby-mode
.
I guess to remedy this I've got to not change the line in auto-mode-alist
, but add one. Anyways, how does this autoload thing work? When does loaddefs.el
get executed? Is there a way to keep the line out of the file?