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 18:13:44 +0000 Message-ID: <2nP2PN2t_BuoLFcCV1LCJLjRsU6YkW6e-VeBbRcMl2zR4tfPLI9rg26bBYSjJIhOkCKntjKW0XfBXVpaHYoXIrE7Lm4Zh-4Pzy0b1mCwdpc=@protonmail.com> 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="1590"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuri Khan , goncholden via Users list for the GNU Emacs text editor To: goncholden Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 09 21:01:08 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 1nzNP1-0000EM-Jc for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 09 Jun 2022 21:01:07 +0200 Original-Received: from localhost ([::1]:59734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzNP0-0001qU-F6 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 09 Jun 2022 15:01:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzMfN-0004bX-S8 for help-gnu-emacs@gnu.org; Thu, 09 Jun 2022 14:14:00 -0400 Original-Received: from mail-40135.protonmail.ch ([185.70.40.135]:47712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzMfJ-00034g-JA for help-gnu-emacs@gnu.org; Thu, 09 Jun 2022 14:13:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1654798430; x=1655057630; bh=aMJEq15nd5gPc3PcZCPZ2w46VQ24Jq2Wh3gFpir1Fdg=; 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=deY8L9mf+yT/hHseFrX88zPh9G4++msJmrELcdxikUylrrCXb/2byw9TJBdUcZlhW 7qxCTNYFq8grqb0PXkzmH/wac/pYPGRlHoA/Z9el3A1h+1GhP+N6+wYIQM2ZOTl5KM 56xF/iqHQ3sZ1Dz8fvgUYIZlktN3P694p3lmQI9eVMMpxT4z42sRCFMLgaqDn6zo8y mfKoRThgBA1xx2CCSA2CHGFtM9RhLkkcwNoFKrbT62bJbTkbH7WURglInvEMV5g5kq gR1BaNMzjOUz+nS+hXfVh0o08ZdNsW6xQugsyhEaeQGrGcsN9hBJsIStN6+XsD2DgO RB/BRL+asMp9g== In-Reply-To: Feedback-ID: 43053548:user:proton Received-SPF: pass client-ip=185.70.40.135; envelope-from=goncholden@protonmail.com; helo=mail-40135.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, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, TO_EQ_FM_DIRECT_MX=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:137572 Archived-At: ------- Original Message ------- On Friday, June 10th, 2022 at 3:30 AM, goncholden wrote: > ------- Original Message ------- > On Friday, June 10th, 2022 at 3:12 AM, Yuri Khan yuri.v.khan@gmail.com 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 mod= es: > > > > (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))) Suppose I have a file with tabs, would the change show the tabs as spaces? = I would rather have the file show as it is. If there are tabs in the file= , would (setq-default indent-tabs-mode nil) show them as spaces?