From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4C9bF+9JLmFXRgEAgWs5BA (envelope-from ) for ; Tue, 31 Aug 2021 17:25:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qJLuEu9JLmH4RQAAbx9fmQ (envelope-from ) for ; Tue, 31 Aug 2021 15:25:35 +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 A743022EA3 for ; Tue, 31 Aug 2021 17:25:34 +0200 (CEST) Received: from localhost ([::1]:44450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL5dl-0007Iu-59 for larch@yhetil.org; Tue, 31 Aug 2021 11:25:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL5cr-0007H9-QK for emacs-orgmode@gnu.org; Tue, 31 Aug 2021 11:24:37 -0400 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]:41743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mL5cp-0002Wj-UG for emacs-orgmode@gnu.org; Tue, 31 Aug 2021 11:24:37 -0400 Received: by mail-il1-x136.google.com with SMTP id l10so20359323ilh.8 for ; Tue, 31 Aug 2021 08:24:34 -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=wn9t21nINCorKniiytb42jQadGqxIjgXxLM5K+smKsE=; b=ox7RNbYF45tumbupmKro8b7rkWibzs37goXfFODTUSnEUBQ9SKaBJvYRQmV3Nbzuu4 dY1AbAZtxGWprSfk7pPyqPNGjIkXV1a8Kp9jqMlGiUTLF+Viq7QlaRR2tRdL0iXABnpP DkimEsRF0Gw3Cuf8xz8sdHMZdVtitX3xVHNf0rv+zZXUz8gyENA8ZIXAGpWuB5/S57wW O8VPfEjQ9x8vYmcdmiPH9QQd3kmuu+nDKkn/Z+KLN71bW40t+sHcoqIXDxQEoSldUw4u bCjKcvEq3Mr9OlgmYsrThQMKmN9T6BEirzP2yEXUrT68ovWxRWbYAKt5f2zz0TACIpof fxLQ== 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=wn9t21nINCorKniiytb42jQadGqxIjgXxLM5K+smKsE=; b=U7e1BFRFBAr7kQA2YEzqahjp1Iw3T7bQKGgNn2urZNjEjcfUGanULzP/RwAaPkzLZe kHRlpL1jEQhtZvXnGMQ9ok4S5XzjRqMr0NhhT/NYoefmTRaYWN4ia9UFDJk411aWjBxB rFXZdAArZfMME3NMc6VNJkQrEc8YX5tjgZTWY+SNTaIYVq9+ed42tBa+a0ByKEtKHV/4 5YdUZ4EDaDx954gZGD3GppLQRFnTtyLlQKPGTLCLqxyXYU8eVqRH5ynLazN20nGYTnoT 3JLJphrsyi3Aq6iAfjJPxUlrGziVeQXRE7wPTle72CG2PPM2wQv2Mv9CSE/trLk5FsO1 kslg== X-Gm-Message-State: AOAM531EqFJxvVEPZmsLgHeXY5W0NG71JXw4JNbTQtifXHExqqTPLAfq 10TIXAShvRa01m4KFLVT+wPG3FKUdb7Y1dhknsc= X-Google-Smtp-Source: ABdhPJyqiLjreyH4Dm0aZMf1iam6WsMVlihJHcBgSAY+moWvJ8/yjypD23LhihLnxeG2ubkdCNork5j+Taane4siZ8Y= X-Received: by 2002:a05:6e02:d03:: with SMTP id g3mr21140981ilj.127.1630423473555; Tue, 31 Aug 2021 08:24:33 -0700 (PDT) MIME-Version: 1.0 References: <87lf4hoh5c.fsf@gmail.com> In-Reply-To: <87lf4hoh5c.fsf@gmail.com> From: =?UTF-8?B?RGF2aWQgTHVrZcWh?= Date: Tue, 31 Aug 2021 17:24:22 +0200 Message-ID: Subject: Re: org-indent-indentation-per-level may be broken To: Timothy Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::136; envelope-from=dafydd.lukes@gmail.com; helo=mail-il1-x136.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: , 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=1630423534; 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=wn9t21nINCorKniiytb42jQadGqxIjgXxLM5K+smKsE=; b=bb/hwoBnC8cjoJJlVb9sF3XYXdxqwc3eyYYetlnWbVunmZoyix0nNDOe/v5cDSi6w6qTGy rCEfYG2D3m7P2ZWuM3XHZpLiLk7EbYnd4pitO2IOrOVnyx+L/3I2foiyiHW7L2EIcwA5Oh l/Bmt1BvdYvem45bXbW8Smqq62iu06tCzVJeYNsZnj7G+8pLsZkIskABExhWCDMAeu38BX +wFWDj6lbkcRvqKzQVWmh5ip5Wsp3aT5yw1my9+UBRz/RQbnYbrD6Hr2i4DTMrDEox4S6o Rq2p6PTyx6/ygr4u7P2NwhrlZKFQNqevgbHrR0fnCrYk9gyoA8NafRuI6r9rVQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630423534; a=rsa-sha256; cv=none; b=hR0i+kihT7mrF5JILXmRFOjc220s5Wepw/uHG20iSVwkpc8mx+wI6ZYJSxiK6BvUug5uR+ mjoo7ano5i6XzMcndx2omCKfYP3Z+h63344NmAO//Xk39a4ve40iO+0JZL5z8r7MFP8ZKP PE+QTXSS71NaUIfD2PA/T/VNKA36pFU2+mp3pxru3rDnXthfMrSVAm8MUVwcv2AxWwNfI0 5w+1pLREYK9UPLgXvfmoPVE6xNhdLAXrk3NzghOiHdUsX8Nywr3SvYKJxN1ED1JkiiMsT+ z9+ryyQHArI3Ja+9bSkVmVDEL9movquVIcdbUU532cvfeX5HgRfLkWz9uThf8Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=ox7RNbYF; 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: -1.62 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=ox7RNbYF; 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: A743022EA3 X-Spam-Score: -1.62 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5IgtIK9Fp3qa Hi Timothy, Thanks for getting back to me! > Is the patch in your original email a good fix for this? Basically yes, though I've simplified it to this: --8<--------------------------------------------------------------->8-- diff --git a/lisp/org-indent.el b/lisp/org-indent.el index ea7ea07..2091083 100644 --- a/lisp/org-indent.el +++ b/lisp/org-indent.el @@ -126,6 +126,7 @@ useful to make it ever so slightly different." (make-vector org-indent--deepest-level nil)) (setq org-indent--text-line-prefixes (make-vector org-indent--deepest-level nil)) + (when (> org-indent-indentation-per-level 0) (dotimes (n org-indent--deepest-level) (let ((indentation (if (<= n 1) 0 (* (1- org-indent-indentation-per-level) @@ -150,7 +151,7 @@ useful to make it ever so slightly different." (concat (make-string (+ n indentation) ?\s) (and (> n 0) (char-to-string org-indent-boundary-char))) - nil 'face 'org-indent))))) + nil 'face 'org-indent)))))) (defsubst org-indent-remove-properties (beg end) "Remove indentations between BEG and END." --8<--------------------------------------------------------------->8-- It turns org-indent--compute-prefixes into a no-op, except for initializing the various prefix vectors, on the assumption that when org-indent-indentation-per-level is 0, there should simply be no prefixes. Disclaimer: I didn't really try to understand the entire reasoning behind how the prefixes are computed, why it's done the way it's done, what are the various edge cases etc. But AFAICS, my patch shouldn't break anything that was working before: when org-indent-indentation-per-level is greater than 0, everything runs as before. And when it's 0, then instead of an error, something reasonable now happens. If there are disagreements about the details of what should happen, then they can probably be discussed after this stopgap patch gets merged. For instance, maybe there's a feature of Org Mode I don't use and which should get some special treatment when org-indent-indentation-per-level is 0. But seeing as no one seems to have been inconvenienced by the fact that it didn't work at all until now, I'm not expecting much of an uproar :) Also, maybe it would still make sense to change (if (<= n 1) 0 ...) to (max 0 ...), as a more catch-all way to ensure that indentation is reliably greater than 0 (so that (make-string indentation ?*) doesn't fail)? It's not needed with the when-condition placed as it is in the patch above, but maybe just to be on the safe side. Dunno. Best, David