[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Spaces rather than tabs by a major mode hook
From: |
goncholden |
Subject: |
Re: Spaces rather than tabs by a major mode hook |
Date: |
Thu, 09 Jun 2022 15:30:05 +0000 |
------- Original Message -------
On Friday, June 10th, 2022 at 3:12 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> On Thu, 9 Jun 2022 at 21:39, goncholden via Users list for the GNU
> Emacs text editor help-gnu-emacs@gnu.org wrote:
>
> > I want to use spaces rather than tabs, but need to do this setting by a
> > major mode hook?
> >
> > How can this be done exactly?
>
>
> (defun my-indent-with-spaces ()
> (setq-local indent-tabs-mode nil))
> (add-hook 'emacs-lisp-mode 'my-indent-with-spaces)
> (add-hook 'js-mode 'my-indent-with-spaces)
>
>
> Alternatively, use spaces by default and only use tabs for specific modes:
>
> (setq-default indent-tabs-mode nil)
> (defun my-indent-with-tabs ()
> (setq-local indent-tabs-mode t))
> (add-hook 'c++-mode 'my-indent-with-tabs)
> (add-hook 'c-mode 'my-indent-with-tabs)
>
>
> Or use spaces everywhere by default and only use tabs for specific
> modes in specific projects where prescribed by coding convention:
>
> (setq-default indent-tabs-mode nil)
>
> In your project’s root directory, put a .dir-locals.el:
>
> ((c++-mode
> (indent-tabs-mode . t)
> (c-mode
> (indent-tabs-mode . t)))
Yuri, could you introspect the benefits between the last two alternatives?
1. Using spaces by default and tabs for specific modes.
2. Use spaces everywhere and tabs for specific modes.
- Spaces rather than tabs by a major mode hook, goncholden, 2022/06/09
- Re: Spaces rather than tabs by a major mode hook, Yuri Khan, 2022/06/09
- Re: Spaces rather than tabs by a major mode hook,
goncholden <=
- Re: Spaces rather than tabs by a major mode hook, Yuri Khan, 2022/06/09
- Re: Spaces rather than tabs by a major mode hook, goncholden, 2022/06/09
- Re: Spaces rather than tabs by a major mode hook, Yuri Khan, 2022/06/09
- Re: Spaces rather than tabs by a major mode hook, Emanuel Berg, 2022/06/10
- Re: Spaces rather than tabs by a major mode hook, goncholden, 2022/06/10
- Re: Spaces rather than tabs by a major mode hook, Eli Zaretskii, 2022/06/11
- Re: Spaces rather than tabs by a major mode hook, goncholden, 2022/06/09
- RE: [External] : Re: Spaces rather than tabs by a major mode hook, Drew Adams, 2022/06/09
- RE: [External] : Re: Spaces rather than tabs by a major mode hook, Drew Adams, 2022/06/09
- Re: Spaces rather than tabs by a major mode hook, Tassilo Horn, 2022/06/09