From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Spaces rather than tabs by a major mode hook Date: Fri, 10 Jun 2022 10:50:04 +0300 Message-ID: <83y1y5yn2r.fsf@gnu.org> References: <2nP2PN2t_BuoLFcCV1LCJLjRsU6YkW6e-VeBbRcMl2zR4tfPLI9rg26bBYSjJIhOkCKntjKW0XfBXVpaHYoXIrE7Lm4Zh-4Pzy0b1mCwdpc=@protonmail.com> <877d5pljnr.fsf@gnu.org> <20f6f8fc-7e91-4efb-bac3-8c4e6ed0ae63@gnu.org> <83h74t13hd.fsf@gnu.org> <837d5p10m0.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24177"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 10 09:51:39 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 1nzZQh-00067m-68 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 10 Jun 2022 09:51:39 +0200 Original-Received: from localhost ([::1]:55930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzZQf-00047F-Kd for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 10 Jun 2022 03:51:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzZPP-00045V-Aa for help-gnu-emacs@gnu.org; Fri, 10 Jun 2022 03:50:19 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzZPO-0005Bc-69 for help-gnu-emacs@gnu.org; Fri, 10 Jun 2022 03:50:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9JQUZxqXh6kD0BWIkjXt5XklkwogbGPCF38mvpp7yh8=; b=O/gNhAARm0HT Nv0kZn0ghdTZs720vniCtJhKRP1FcKc+XsOz82z1FIqgNY39zcqJZ9J2fcPsPN1iyCrcaAjmTplIg J5+cHaWKX9sRU3pWe+myLeCh57lHd0cu9S4/YqcbcNHVfq468JZsTViy8uqH9Svug2TvaqMWJG33k Ws0bX9qtySybkNHi1Aj8GqJSNBOF/R6WV7Dq2FLvnCNcfRcIcOr+fwpnrz6+BSjQGbMH3enOZ8u0/ NNDyib4M/rpIQgysbVnwrmI5NbntY7QA2eyoE0L6UygXLEwc5sfMMazaI/xV9+Iura7CxLEU+sDyn 2GyE8+81qRpU0psW1NEzBg==; Original-Received: from [87.69.77.57] (port=3213 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzZPB-0003fE-77 for help-gnu-emacs@gnu.org; Fri, 10 Jun 2022 03:50:17 -0400 In-Reply-To: (message from goncholden on Fri, 10 Jun 2022 07:42:19 +0000) 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:137593 Archived-At: > Date: Fri, 10 Jun 2022 07:42:19 +0000 > From: goncholden > Cc: help-gnu-emacs@gnu.org > > > I think your current views are because you are trying to fight Emacs > > features instead of using them to your benefit. Why do you need to > > insert literal TABs so much? You never explained that. > > It usually happens with legacy code where people used tabs most times. Then if the setting in for spaces, the file would end with a mix of tabs and spaces. Indentation could get mixed up this way. What could be a solution? Still with 'C-q TAB' ? One solution is to mark the portion of the buffer (or the entire buffer), then use either "M-x tabify" (if you want to have a mix of TABs and SPACEs) or "M-x untabify" (if you want to have only SPACEs). After you do one of these, the setting of indent-tabs-mode will take care of the new/modified code. Another possibility, for the code where each indentation level is made only out of TABs, is to set the indentation levels to correspond to the existing code. Then TAB will always insert only literal TAB characters, due to the setting of tab stops. I'm not yet sure I understand what situation you describe, so the answer is somewhat ambiguous and imprecise. I suggest to tell more and perhaps show an example, so that the advice could be more to the point.