From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GK95FDdty2AMjwAAgWs5BA (envelope-from ) for ; Thu, 17 Jun 2021 17:41:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id AFHRDzdty2C+FQAA1q6Kng (envelope-from ) for ; Thu, 17 Jun 2021 15:41:43 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AEC671A47E for ; Thu, 17 Jun 2021 17:41:42 +0200 (CEST) Received: from localhost ([::1]:48366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltu9E-0008PH-B0 for larch@yhetil.org; Thu, 17 Jun 2021 11:41:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltu8U-0008MQ-4z for emacs-orgmode@gnu.org; Thu, 17 Jun 2021 11:40:56 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]:43623) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltu8R-0001yJ-AD for emacs-orgmode@gnu.org; Thu, 17 Jun 2021 11:40:53 -0400 Received: by mail-lj1-x22b.google.com with SMTP id l15so5400141lje.10 for ; Thu, 17 Jun 2021 08:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/wVe8bAvDbiS5rMOVCSOLw8C9LM4gB97DTpitIWtJfA=; b=gsvG3iIp4FI3MrCinDCLdlPENiAJVCjEJJUj//11Pb0SrtI+akQSYhUOzyyBvxsjxJ GnjWON+Scw2OEh/g/pAdZRZDxY9UdZvBb/ZcCvuESw2AxSeEdpgeV9B1S3LG9m9d7ymg a6wqEpF626IPyI7d2Xi5WEVk1wKH9RiktPx2QINb3M1GLjtFuR4hBdQu6RNydpcUJKeQ mwK7Ms3HUwJ7VEy3fle7uTSWmU5SyS+KI3oWINO+MzBTy4kdzNtr1CukgzlsY3ANMD7W Are+WArxwbqu75gUOgarTJxaaQL/CMa5VgHr2Ci4EFnwfbs833Vs3wwNg8+2E8GJ+i4p nl7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/wVe8bAvDbiS5rMOVCSOLw8C9LM4gB97DTpitIWtJfA=; b=DW9MOburiuA2k+UdxNkNfqHLWIXG0/zj42hUyfjJbvZu999pAjs91Gub73/GPERV8Y kasfDoxeo6DRQeWVoc5y0xGslb2e9OP2KPochuZ7VHb4TugTiWPclj6UTj16K76ZNEg8 IXzTz8As6Atc1xZ1ZUEyrNNnn0HjsCKNmnSs+75cwool7MQ9vddzzYA5gIKkh5BH8tPS IXmFaDpmn7mdES6lIxB+Qk0ktEqJRXsBrzPH4gUKR0ZCNG+sRgSGkUk1hifuJlydx3i2 ptQ9uLQ+3N7ctwiaL5Q3jVAkD31Gp/XZbbCNEgsC/UPEhFIDEaRIs20XIGBp6DjcjCVa dREA== X-Gm-Message-State: AOAM533k/NSvjWcfpoiKG1oo1XPNz69LrrOKMz6Xgsb+xAe/f5vDbMUK drFvkvImHn/vmbqI2HeaaRNMsxzlVzIMn0OiFnc= X-Google-Smtp-Source: ABdhPJz/BJGZPnacl3VWNgYB/rAJEBZb3xiqZxXlG8T9SR608z3l4Bdw7MsqOrcMkdSVIrbCTDLHZdphMv01r4F9gMM= X-Received: by 2002:a05:651c:1077:: with SMTP id y23mr5203023ljm.427.1623944449393; Thu, 17 Jun 2021 08:40:49 -0700 (PDT) MIME-Version: 1.0 References: <87lf835yp4.fsf@gmail.com> In-Reply-To: <87lf835yp4.fsf@gmail.com> From: Michael Dauer Date: Thu, 17 Jun 2021 17:40:38 +0200 Message-ID: Subject: Re: misaligned tab and spaces in src block To: Tim Cross Content-Type: multipart/alternative; boundary="0000000000000a881e05c4f80815" Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=mick.dauer@gmail.com; helo=mail-lj1-x22b.google.com 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1623944502; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/wVe8bAvDbiS5rMOVCSOLw8C9LM4gB97DTpitIWtJfA=; b=pGvJlDN3ckQjwB1Haez0x9hqfnbiWKqd2c4xY7ABsug6qta4Y0iWpCO55F6hKR6/Sgh+S7 WDBQGWnY8YuZfRqPbL9RYEM9rmP6/m35qntdQFprsHJdzsRuEv3CrozXk/+bdQeCAJisTr CJkX17AkS28uH65Fu6D1H0HjCCbP/B1xN+6nBRv27LabVkiQOUORfR0IMYW9VhANugWmiH UeGIgRvx+aMdi3iOBg7KZZ4HaFkGsZW22MSs640EqlDHFQMt0Wl0r/UkANPYuBhAixVqWL x9n+jrqaWVBrbd8VFL+VkqlcnW+uyxf9m1sq5wfNnLvkf2OG8mBVzvC0CjIbQw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623944502; a=rsa-sha256; cv=none; b=ubVzrg521ofRwQCDOCWsTuJ3BbSptu2g2APo+pXEx3hTgYJY7Vd9EVNfTd89GQureilvXQ 2YuDZyKcbmIUNrG2TCzrUFtgQDVGiHozzJ6m0BXNimbuD+3WMENWIuRJoEfN6hGdQd378W r0V6Ik7JcnNZY1uKHVAHboFsg5wluUM9VLI6ecYCzB+ApQFrTa73xc3+cyr7zSC112RDbf uMQHkMJ0sCmI/nwoIDm5jAd7Jq4yop1W8GjkOwd7m3DDMMSNQCk6uPWoEXOJedgJu/H5In VxAVdDk+RA5WicDoYyI7qZu0iPWPCNOulkJRAsEBhSTsGpPS/EhUx9QTffx8OQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gsvG3iIp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gsvG3iIp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: AEC671A47E X-Spam-Score: -3.12 X-Migadu-Scanner: scn1.migadu.com X-TUID: OfMw6t1zBCNc --0000000000000a881e05c4f80815 Content-Type: text/plain; charset="UTF-8" Hi Tim, indent-tabs-mode was exactly what I was looking for. Thank you, Michael Am Di., 25. Mai 2021 um 04:39 Uhr schrieb Tim Cross : > > Michael Dauer writes: > > > Hi, > > > > #+begin_src elisp :results output > > (aaa > > bbb ( > > #x09#x09#x09ccc)) > > ccc > > #+end_src > > looks like this in the editor > > (aaa > > bbb ( > > ccc)) > > ccc > > > > Line 1-3 were indented automatically by pressing Tab. In line 4 I > inserted 6 spaces manually. This is what I would expect to find in line 3 > too. But at my > > surprise there are 3 tab chars in line 3. Line 2 was indented > automatically with 1 space. > > > > 1. So why is line 3 indented with 3 tabs instead of 6 spaces? > > 2. How can I prevent this? > > 3. Why does a tab have a width between 1 and 2 spaces? > > 4. How can I prevent this misalignment? > > > >I don't understand what org-block face has fixed-pitch. > > > > Org mode version 9.4.6 (9.4.6-gcf30f7 > > (setq-default tab-width 2) > > (setq org-src-fontify-natively t > > org-src-window-setup 'current-window > > org-src-strip-leading-and-trailing-blank-lines t > > org-src-preserve-indentation t > > org-src-tab-acts-natively t) > > > > Are you editing the source block using org-edit-special (C-c ,)? If not, > then you are not editing the source block with the correct syntax for > elisp and this will throw out auto formatting. > > Your example block is invalid elisp code which is > #+begin_src elisp :results output > (aaa > bbb ( > #x09#x09#x09ccc)) > ccc > #+end_src > > but I don't see how you can get any output as it is not valid elisp. It > is not clear to me what you are trying to do. You have 3 tab characters > (#x09), so don't see why you would expect them to be spaces? > > If what you want is for hitting tab to insert only spaces, have a look > at the variable indent-tab-mode. You can, for example, do > > (setq-default indent-tab-mode nil) > > to force use of spaces instead of tabs. However, be careful about doing > this globally if you also want to contribute to projects where tabs are > used as this will cause havoc with diffs and git. You can also set this > on a per language (via mode hooks) or per project (via local variables). > > To get a better feel for how language modes align code etc, you really > need to make sure the code you are trying to align is syntactically > valid and you are using the correct coding style for the language. > -- > Tim Cross > > > -- > Confidentiality Notice:This email and any attachments it may contain are > intended for the individual or entity above and may be confidential and > protected by legal privilege. SmartPM Technologies, Inc. makes no > warranties, express or implied, concerning the accuracy of the information > contained herein, which is subject to change without notice. Unintended > recipients should be aware that use of this e-mail or any of its > attachments in any way is forbidden. > --0000000000000a881e05c4f80815 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Tim,

indent-tabs-mode was exactly wh= at I was looking for.

Thank you,
Mic= hael

Am Di., 25. Mai 2021 um 04:39=C2=A0Uhr schrieb Tim Cross <theophilusx@gmail.com>:

Michael Dauer <mick.dauer@gmail.com> writes:

> Hi,
>
> #+begin_src elisp :results output
> (aaa
>=C2=A0 bbb (
> #x09#x09#x09ccc))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0ccc
> #+end_src
> looks like this in the editor
> (aaa
>=C2=A0 bbb (
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ccc))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ccc
>
> Line 1-3 were indented automatically by pressing Tab. In line 4 I inse= rted 6 spaces manually. This is what I would expect to find in line 3 too. = But at my
> surprise there are 3 tab chars in line 3. Line 2 was indented automati= cally with 1 space.
>
> 1. So why is line 3 indented with 3 tabs instead of 6 spaces?
> 2. How can I prevent this?
> 3. Why does a tab have a width between 1 and 2 spaces?
> 4. How can I prevent this misalignment?
>
>I don't understand what=C2=A0 org-block face has fixed-pitch.
>
> Org mode version 9.4.6 (9.4.6-gcf30f7
> (setq-default tab-width 2)
> (setq org-src-fontify-natively t
> org-src-window-setup 'current-window
> org-src-strip-leading-and-trailing-blank-lines t
> org-src-preserve-indentation t
> org-src-tab-acts-natively t)
>

Are you editing the source block using org-edit-special (C-c ,)? If not, then you are not editing the source block with the correct syntax for
elisp and this will throw out auto formatting.

Your example block is invalid elisp code which is
#+begin_src elisp :results output
=C2=A0 (aaa
=C2=A0 =C2=A0bbb (
=C2=A0 =C2=A0 =C2=A0 =C2=A0 #x09#x09#x09ccc))
=C2=A0 ccc
#+end_src

but I don't see how you can get any output as it is not valid elisp. It=
is not clear to me what you are trying to do. You have 3 tab characters
(#x09), so don't see why you would expect them to be spaces?

If what you want is for hitting tab to insert only spaces, have a look
at the variable indent-tab-mode. You can, for example, do

(setq-default indent-tab-mode nil)

to force use of spaces instead of tabs. However, be careful about doing
this globally if you also want to contribute to projects where tabs are
used as this will cause havoc with diffs and git. You can also set this
on a per language (via mode hooks) or per project (via local variables).
To get a better feel for how language modes align code etc, you really
need to make sure the code you are trying to align is syntactically
valid and you are using the correct coding style for the language.
--
Tim Cross


--
Confidentiality Notice:This email and any attachments it may contain are intended for the individual or entity above and may be confidential and protected by legal privilege. SmartPM Technologies, Inc. makes no
warranties, express or implied, concerning the accuracy of the information =
contained herein, which is subject to change without notice. Unintended recipients should be aware that use of this e-mail or any of its
attachments in any way is forbidden.
--0000000000000a881e05c4f80815--