unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: goncholden <goncholden@protonmail.com>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: goncholden via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Spaces rather than tabs by a major mode hook
Date: Thu, 09 Jun 2022 15:30:05 +0000	[thread overview]
Message-ID: <ip_7Wy8BEOwvem84R1Oj3cjNjbA_XlVCwFshcH9jFe8PeR5u6lONBpFtDzLdmBb7Xh5gxjv9v0ASJP11OpsWffEaL4s5MLZKt7ZlnXCe678=@protonmail.com> (raw)
In-Reply-To: <CAP_d_8Xdz8y_HA9aYsOtnOzuFx-cqTvkMThNffUTZF9kqovytQ@mail.gmail.com>

------- 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.



  reply	other threads:[~2022-06-09 15:30 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 13:58 Spaces rather than tabs by a major mode hook goncholden via Users list for the GNU Emacs text editor
2022-06-09 15:12 ` Yuri Khan
2022-06-09 15:30   ` goncholden [this message]
2022-06-09 15:46     ` Yuri Khan
2022-06-09 16:08       ` goncholden
2022-06-09 16:34         ` Yuri Khan
2022-06-10 23:17           ` Emanuel Berg
2022-06-11  0:05             ` goncholden
2022-06-11  7:35               ` Eli Zaretskii
2022-06-09 18:13     ` goncholden
2022-06-09 19:15       ` [External] : " Drew Adams
2022-06-09 19:16       ` Drew Adams
2022-06-09 19:24       ` Tassilo Horn
2022-06-09 19:40         ` goncholden
2022-06-09 19:54           ` Tassilo Horn
2022-06-10  5:39             ` Eli Zaretskii
2022-06-10  5:46               ` goncholden
2022-06-10  6:08                 ` Po Lu
2022-06-10  6:11                   ` goncholden
2022-06-10  6:31                   ` tomas
2022-06-10  6:41                 ` Eli Zaretskii
2022-06-10  7:42                   ` goncholden
2022-06-10  7:50                     ` Eli Zaretskii
2022-06-10  8:31                       ` goncholden
2022-06-10 10:49                         ` Eli Zaretskii
2022-06-10 18:10                           ` goncholden
2022-06-10 19:33                             ` Eli Zaretskii
2022-06-10 19:40                               ` goncholden
2022-06-10 19:44                                 ` Eli Zaretskii
2022-06-10 19:52                                   ` goncholden
2022-06-10 19:56                                     ` goncholden
2022-06-11  7:20                                       ` Eli Zaretskii
2022-06-11  7:30                                         ` Emanuel Berg
2022-06-11  7:57                                           ` tomas
2022-06-11  8:26                                             ` goncholden
2022-06-11 15:35                                             ` Emanuel Berg
2022-06-11  7:19                                     ` Eli Zaretskii
2022-06-11  8:17                                       ` goncholden
2022-06-11  8:40                                         ` Eli Zaretskii
2022-06-11  8:57                                           ` goncholden
2022-06-11 10:10                                             ` Eli Zaretskii
2022-06-11 10:20                                               ` goncholden
2022-06-11 10:33                                                 ` Eli Zaretskii
2022-06-11 11:15                                                   ` goncholden
2022-06-11 11:50                                                     ` Eli Zaretskii
2022-06-11 20:02                                                       ` goncholden
2022-06-12  2:24                                                         ` [External] : " Drew Adams
2022-06-12  3:16                                                           ` goncholden
2022-06-12  6:06                                                             ` Eli Zaretskii
2022-06-12  6:40                                                               ` goncholden
2022-06-12  7:02                                                                 ` Eli Zaretskii
2022-06-12  7:49                                                                   ` goncholden
2022-06-12  8:06                                                                     ` Po Lu
2022-06-12  8:35                                                                       ` goncholden
2022-06-12  6:40                                                         ` Eli Zaretskii
2022-06-12  7:29                                                           ` goncholden
2022-06-12  6:53                                                         ` Po Lu
2022-06-12  7:06                                                           ` goncholden
2022-06-12  7:18                                                             ` Po Lu
2022-06-12  7:54                                                               ` goncholden
2022-06-12 18:13                                                             ` Netiquette is way to go Jean Louis
2022-06-12 23:25                                                               ` goncholden
2022-06-13  4:53                                                                 ` Jean Louis
2022-06-13  6:25                                                                   ` goncholden
2022-06-13  6:26                                                                   ` Emanuel Berg
2022-06-13  7:17                                                                 ` Po Lu
2022-06-13  7:41                                                                   ` Emanuel Berg
2022-06-13  7:43                                                                   ` Jean Louis
2022-06-13  9:18                                                                     ` goncholden
2022-06-13  9:29                                                                       ` Po Lu
2022-06-13 10:39                                                                         ` goncholden
2022-06-13 11:48                                                                       ` Eli Zaretskii
2022-06-13 13:17                                                                         ` goncholden
2022-06-13 21:05                                                                         ` Emanuel Berg
2022-06-14  4:43                                                                           ` tomas
2022-06-14 10:08                                                                             ` Emanuel Berg
2022-06-13 15:42                                                                     ` [External] : " Drew Adams
2022-06-12  7:13                                                           ` Spaces rather than tabs by a major mode hook Po Lu
2022-06-12  7:29                                                             ` Eli Zaretskii
2022-06-12  8:29                                                               ` goncholden
2022-06-12  8:36                                                                 ` Eli Zaretskii
2022-06-12  9:14                                                                   ` goncholden
2022-06-12  8:45                                                                 ` Po Lu
2022-06-12  9:02                                                                   ` goncholden
2022-06-12 18:21                                                               ` Jean Louis
2022-06-12 23:29                                                                 ` goncholden
2022-06-13  3:03                                                                 ` Emanuel Berg
2022-06-13  5:39                                                                   ` Jean Louis
2022-06-13  6:24                                                                     ` Emanuel Berg
2022-06-13  6:33                                                                     ` goncholden
2022-06-13 15:17                                                                     ` [External] : " Drew Adams
2022-06-12 17:10                                                         ` Jean Louis
2022-06-12 20:18                                                           ` goncholden
2022-06-12 20:41                                                           ` goncholden
2022-06-12 22:42                                                             ` Jean Louis
2022-06-13  6:18                                                               ` goncholden
2022-06-13  6:18                                                               ` Emanuel Berg
2022-06-13 15:17                                                               ` [External] : " Drew Adams
2022-06-13 11:55                                                         ` Andreas Röhler
2022-06-13 12:12                                                           ` goncholden
2022-06-11 10:39                                                 ` goncholden
2022-06-11 21:00                                                   ` Dmitry Gutov
2022-06-11 21:17                                                     ` goncholden
2022-06-11 21:36                                                       ` Dmitry Gutov
2022-06-11 21:56                                                         ` goncholden
2022-06-12  0:07                                                           ` goncholden
2022-06-12  0:19                                                             ` Dmitry Gutov
2022-06-12  0:35                                                               ` goncholden
2022-06-12  1:05                                                                 ` goncholden
2022-06-11  4:58             ` Emanuel Berg
2022-06-11 14:53               ` [External] : " Drew Adams
2022-06-11 15:39                 ` Emanuel Berg
2022-06-10 23:03   ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ip_7Wy8BEOwvem84R1Oj3cjNjbA_XlVCwFshcH9jFe8PeR5u6lONBpFtDzLdmBb7Xh5gxjv9v0ASJP11OpsWffEaL4s5MLZKt7ZlnXCe678=@protonmail.com' \
    --to=goncholden@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=yuri.v.khan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).