From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cPPnBFdjrGAlPwEAgWs5BA (envelope-from ) for ; Tue, 25 May 2021 04:39:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id eKOdAFdjrGD5NAAAB5/wlQ (envelope-from ) for ; Tue, 25 May 2021 02:39:19 +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 732189A8C for ; Tue, 25 May 2021 04:39:17 +0200 (CEST) Received: from localhost ([::1]:50336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llMyR-000625-Gq for larch@yhetil.org; Mon, 24 May 2021 22:39:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llMtV-0006FS-Cb for emacs-orgmode@gnu.org; Mon, 24 May 2021 22:34:09 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:35338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llMtT-0002d9-GE for emacs-orgmode@gnu.org; Mon, 24 May 2021 22:34:09 -0400 Received: by mail-pj1-x1036.google.com with SMTP id lx17-20020a17090b4b11b029015f3b32b8dbso10598116pjb.0 for ; Mon, 24 May 2021 19:34:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=03u8PL64a3t+kXKEK6SK4qJ9+qT6gCA6W+xIzkgHK6g=; b=NhZq+lBKOjzboQBAkftszFS+v0Cw5vNfiouD3/U2puTc6a/BnRAuPrBvnBb9XIeocs luIKZGLZB2ZnfissdNrLEwDqliTedfWOe7O+oBYpnfoR72E9kjf4wOo4Gf7NbkpuuUyC y5gFGh+A+VyKYKj/BwWKi1WsybWplWI4laGx/3rkLt/k32Ae3l4H0u/hLgS3qYRSzIP3 lRM85W60HBOBMWAg0Oaakp2TOxREWzATbWgLsQEq1arE6VueMlZPis/lJEuEuHva2LXm hd3r3M5+dyHr8IPhNHPVxvCpphBi08FUswmbrlKakcntwiG2Fe0YWhoZazw8+2syef/H z8Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=03u8PL64a3t+kXKEK6SK4qJ9+qT6gCA6W+xIzkgHK6g=; b=I94nETLuoK/h8sYiQhITI1R5mgf3Rq7KRnB4izynUBM5awMoG3fbLV8/nBi2jtX64K Yh7oSefSEStKY46trHT2jnwEdUg55MwO5uJWpDgtGbfIrHTbyrZb0daEcgN3wm1cWIfo TaLJ+LTYIAJjJspaEI3iPDvtUOID1y6bTwgM3DVObPYXIF9i+hqZe2RDSiBxdoUlWSP+ x3QpRLJ+tuCjwA01f9NlAd5eamy9I0Tufs/WAfPTkOxee3J0ZK3+6AGTZ+57jRAt+HvW NQKtt38N06s935klJLgymrLdcQJZtvPGoNtAomUOIvdjaY+XgPVFbslWUBJp9zd0duGI ehUQ== X-Gm-Message-State: AOAM533WReyV0m35yCdQbkqZUMWu5hP+D8imqHCl33rzY0B2vvIsRkdL nAgQ7YninORUkyqWWB9yy4tzSpBvjdU= X-Google-Smtp-Source: ABdhPJweC9l7XUunWNAWhazBRR7AwXXbQDmVND0rtyIS+tOdkg0AjXEWSqhjPFKA20+JqEIjuTZWtQ== X-Received: by 2002:a17:902:da8a:b029:f6:7750:c2f3 with SMTP id j10-20020a170902da8ab02900f67750c2f3mr23911608plx.28.1621910043486; Mon, 24 May 2021 19:34:03 -0700 (PDT) Received: from tim-desktop (106-69-76-246.dyn.iinet.net.au. [106.69.76.246]) by smtp.gmail.com with ESMTPSA id i29sm12945191pgn.72.2021.05.24.19.34.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 19:34:03 -0700 (PDT) References: User-agent: mu4e 1.5.13; emacs 27.2.50 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: misaligned tab and spaces in src block Date: Tue, 25 May 2021 11:51:26 +1000 In-reply-to: Message-ID: <87lf835yp4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=theophilusx@gmail.com; helo=mail-pj1-x1036.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, 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: , 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=1621910358; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=03u8PL64a3t+kXKEK6SK4qJ9+qT6gCA6W+xIzkgHK6g=; b=LmpTQg42NQj+Iw+qip0Gce3WU+5et9AjfC+eGsflHOgs1b0a4nw+swMZQ8x3dLUto7PiJ8 ZKYqQEL5ERc90bWPfSf1zqzY3cd8R7Cm7IFcAll1/YcIYJsqfKWzern8ZuDdrj7Pg5TLFq qy3vwoBEo/pbEfRtxzkeCeU2V68+ChIDtcsI/baohJnUM9bRVnGfwGk/y0LXupF4KCl40Z Icx/YL6JomvjJibLu7utbqZoyt0XfkCT/z5+tfS2r3HiEnG3qiPvlp3lCUZ+ny1MHDjYDY vrQOOwwNmUAxcQJazixm1DRY5xY8pWpsK47hb+sdBSxD6hLf9g/pFtyry2oV/g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621910358; a=rsa-sha256; cv=none; b=DtP6BhoFVBrDbAIGZIoikBMgknqqJbQgCTIPM49lFd4VhHnk0aMoFet54JkgI/hsYQXaT2 pC7byV7cRMOEDnPrXvXYvYja9qzJ/dLOVxaW+i+YTrnCnquygdxZowKP95UTEmIiQ2Djur bg5m5iyLfXRMDYvzngD/+J/pYxQcg6jI4m5YI5iURoL+FfjxTFJRwfzavpinO6IX8caHDd tVyOIHm/8k5UeOwN23tofBz2u1KJBxSuT154ipVgdWTkpsLBbNow6Dl9kX0jPsjpT8JZcx A+J7CVpS7sPbTvRiiGcuLLhLS9eVkrNICCMQwbLQ/za/Cs4Muii2DgF79xrzbw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=NhZq+lBK; 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.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=NhZq+lBK; 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: 732189A8C X-Spam-Score: -3.13 X-Migadu-Scanner: scn1.migadu.com X-TUID: FaKcHR2gpAca 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