Search code examples
emacsmode

Change major mode from fundamental to shell in emacs


Surprisingly file .bashrc_custom has Fundamental mode even though files .bashrc and .bash_profile in the same directory have (Shell-script[bash]).

How can I configure major mode for .bashrc_custom?


Solution

  • Put this into your Emacs init file:

    (add-to-list 'auto-mode-alist '("\\.bashrc_custom\\'" . sh-mode))
    

    Note possibly directory local variables are not questioned here, it's ruled by a list reading strings resp. regular expressions for matching file-names.