reddit / emacs

How to disable electric-indent-mode for a specific file?

zoliky · 2022-05-05 13:48
Hi, I would like to disable `electric-indent-mode` for only one file named `phrases.tex`. Is there a file that I can place in the folder and tells emacs to disable to it for that file? Also, is it possible to enable a custom input method, instead of enabling it manually every time I open the `phrases.tex` file with `C-u \` The name of the input method I need enabled is `custom-input-method`. The default input method is `rfc1345`. Is there a way to do that using that one single file as well? UPDATE: I tried adding this to the file with the LaTeX "percent sign comment" first so `LaTeX` doesn't fail when processing the file to produce a PDF: `% -*- electric-indent-mode: nil; current-input-method: "custom-input-method" -*-` The electric-indent-mode is applied, but the current-input-method doesn't seem to be applied. I tried settings both variables `current-input-method` and `default-input-method` but nothing.
[deleted] · 2022-05-05 14:34
[deleted]
ss141309 · 2022-05-05 14:36
Try using the `eval` keyword: `% -*- electric-indent-mode: nil; eval: (set-input-method 'custom-input-method); -*-`
zoliky · 2022-05-05 14:41
> eval: (set-input-method 'custom-input-method); Amazing. It works. Thank you so much!
ss141309 · 2022-05-05 14:48
Glad I could help :) Also next time instead of doing it manually you can `M-x add-file-local-variable-prop-line` which greatly simplifies this process. ​ For more information: https://www.gnu.org/software/emacs/manual/html\_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables