From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: goncholden Newsgroups: gmane.emacs.help Subject: Re: Spaces rather than tabs by a major mode hook Date: Thu, 09 Jun 2022 15:30:05 +0000 Message-ID: References: Reply-To: goncholden Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29903"; mail-complaints-to="usenet@ciao.gmane.io" Cc: goncholden via Users list for the GNU Emacs text editor To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 09 18:59:18 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nzLV8-0007at-Ho for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 09 Jun 2022 18:59:18 +0200 Original-Received: from localhost ([::1]:46912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzLV7-0002ol-3z for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 09 Jun 2022 12:59:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzK7H-0003PU-QV for help-gnu-emacs@gnu.org; Thu, 09 Jun 2022 11:30:36 -0400 Original-Received: from mail-4319.protonmail.ch ([185.70.43.19]:15427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzK7C-0001YS-Hf for help-gnu-emacs@gnu.org; Thu, 09 Jun 2022 11:30:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1654788612; x=1655047812; bh=EdM4287gCtxXEvZ0hHFrJ8Z3v55Mjku+UE35TpYSbbQ=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=ZX72C/bj6awy8uGkmYSOCi2jE4TPfxLGPlLrIBI4pIj4CrtGhbTtrO7/QgGJaaHZA AwKor3qMlaURQfaqARhTCCux9fyOK+CkbKIGAMpmHBiF7IQ9jk1UOHdBypP5ExH31Z T+oo5u0DmnN/JIyx0NJoVVFg+GaVtl9WzVHP7RGj72Wx5KwIvfYlsNkRrPzBT/4EKS BVSo5aOAy6OKflGqn/uAkClwNujrlitLR+LmoY0L20Dg3N54lGuNQKBTAjcWECwRbO X+e05S89Qklzk5B8pFYp92azfbXBx34lp+hiSvPbi+lbAgD3T7tCFWg/xq2tWZy6+f haRz6uM8NdL/Q== In-Reply-To: Feedback-ID: 43053548:user:proton Received-SPF: pass client-ip=185.70.43.19; envelope-from=goncholden@protonmail.com; helo=mail-4319.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:137565 Archived-At: ------- Original Message ------- On Friday, June 10th, 2022 at 3:12 AM, Yuri Khan wr= ote: > 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=E2=80=99s 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.