help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turning electric-indent-mode off, for a specific buffer


From: goncholden
Subject: Re: Turning electric-indent-mode off, for a specific buffer
Date: Mon, 13 Jun 2022 01:31:52 +0000

------- Original Message -------
On Monday, June 13th, 2022 at 12:26 PM, Po Lu <luangruo@yahoo.com> wrote:


> goncholden via Users list for the GNU Emacs text editor
> help-gnu-emacs@gnu.org writes:
>
> > I thought that for Emacs >= 24.4 there is "electric-indent-local-mode"
> > so one can turn it off in a specific buffer.
>
>
> There is?

What is the way to disable `electric-indent-mode` in a buffer?

There is `setq-default` which only changes the mode if the buffer does not have 
a defined local value for `electric-indent-mode`.  Using `setq` would be 
considered a global change.

Thusly, `setq-local` could be the appropriate one to use.

(setq-local electric-indent-mode nil)

Whereas for the specific language I could use

(defun myindent ()
  (setq-local electric-indent-mode nil))

(add-hook 'fortran-mode 'myindent)

Any critique about all this?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]