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 8Mr5MTu2LmE4pgAAgWs5BA (envelope-from ) for ; Wed, 01 Sep 2021 01:07:39 +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 O5iYLTu2LmGODAAAbx9fmQ (envelope-from ) for ; Tue, 31 Aug 2021 23:07:39 +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 F09432B234 for ; Wed, 1 Sep 2021 01:07:38 +0200 (CEST) Received: from localhost ([::1]:46744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLCqv-0001iz-GC for larch@yhetil.org; Tue, 31 Aug 2021 19:07:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLCqI-0001ip-7M for emacs-orgmode@gnu.org; Tue, 31 Aug 2021 19:06:58 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mLCqG-0003Qk-JP for emacs-orgmode@gnu.org; Tue, 31 Aug 2021 19:06:57 -0400 Received: by mail-wr1-x42a.google.com with SMTP id n5so1533149wro.12 for ; Tue, 31 Aug 2021 16:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e7kVhqjYODtAC8/3G9Z+C8uJGZAngZpHojlaRQM1iGA=; b=aH+c4an4IqCIW7WjDnjsipZj7HV9IEtmoLZxNA7hFQIAi1QbkCZYMxDD9X3ImZzqkH MxVH8dyuCft+PwiNGt+dTUthSTwsDT7GWWYNxEtfdrtflnC3GD59wHUFRGhwRz06U0jZ G+AVecdHwpXhO/QdzlS1YWOlNbvwWb9q5Iv0vUa99YU1TfB2ZVf5izA/k+CZ+tWMccgQ FX3gPiVGFsMXPV1w4P73e/I6NduhKrMzSeda9Pp7T4BUWlA5O4X3uXC+PqnUuuZZbIEH 5jq9GW8kmEvMyVW8rFcWPR/CrVDDG8V46c6FkKyjkZN2ggt75H86auhamTSDjv/xTsjm +84Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=e7kVhqjYODtAC8/3G9Z+C8uJGZAngZpHojlaRQM1iGA=; b=FJVcR4+dnIkqE9R2lYWMyFN++ZTjPMxnGvPk4Dve8PzXVgW3qGi6j/a7Cdr7At/8Xd CupUBrroVVpSTdPtYx9uuzhTo4V2+nmYUn8he26oQGNybSUJWFs4F8wUuzAX4GdWFNpJ FtY5IRb73VjF+4TImavOu2Z0JQ8OCw+XeQ80wQnjVQ/13I+6F61GNeWHvahsXIQOe134 RS+GwxlBEKZkicqjEXUctz5af/ehorgR6/TbWgXSFdjsg/sqHlp/yAQ6EHLsob24uqM9 oDRkynuU0bz2vcjTt+EPdLjdhZJP1xH+ac3+p3Zstow/lDo6Z5KLWPjlxRkKpNbBxcGX PjUw== X-Gm-Message-State: AOAM530nBhyB1A5qym3fat8iQqJsCFzLy9T2VOA8PgES0vgHG04PnirQ qsA9jj2AyNvmN5dqNHjyXTdhVbjJDus= X-Google-Smtp-Source: ABdhPJwm8HZ9Lyiwhcz5jbFtiawBD5kf8kictt/mpld5b5g5jmcizC1/nVqhA2kZkkAKUSaPt/IyBw== X-Received: by 2002:a5d:64e3:: with SMTP id g3mr232727wri.396.1630451214773; Tue, 31 Aug 2021 16:06:54 -0700 (PDT) Received: from localhost.localdomain (ip-94-112-239-247.net.upcbroadband.cz. [94.112.239.247]) by smtp.gmail.com with ESMTPSA id n4sm19098045wri.78.2021.08.31.16.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 16:06:54 -0700 (PDT) From: David Lukes To: emacs-orgmode@gnu.org Subject: [PATCH] org-indent: Allow indentation per level to be 0 Date: Wed, 1 Sep 2021 01:06:51 +0200 Message-Id: <20210831230651.82962-1-dafydd.lukes@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=dafydd.lukes@gmail.com; helo=mail-wr1-x42a.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: David Lukes 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=1630451259; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=e7kVhqjYODtAC8/3G9Z+C8uJGZAngZpHojlaRQM1iGA=; b=bSFOn2Fx8i0z3oinCPn9kK3Lg5eApTKzLh2onwLQZXQs1GLRBVelpecWeD3HCZfXQ21oX8 TX4I9mG2baiqxMDxfjwdneqh4mXHOoDAy/2OCC8s28vtnBhLcy73IA0JM8a/38DVrD5HDp zh+uYh13fx6KT0IS3Y5Z73EmxTWMnrRE9gsmQ6d6BLJjWkO3TtP+g1A4TbNaAFI3O+wIm6 G13BoHuTe3YgwOi+irtRYOeJSvkLMovwOUv47VU8FkmC3+34hFzIKvVqxxlZtkZfblpphl zIXPRVcVkVfWRO9RIrA9qxJ4omtN3HvQkunK+RDF4Xp7KFujDwZCck2w7f459g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630451259; a=rsa-sha256; cv=none; b=djdho3QSh5b8WyyPjVeJEBvlSymRP9ehqu2tzSEbF69vc7nh6n+g+bRX/WVHau3XE4muD7 VJCKzfIO4qSBHyBXJ2h3JhpN91YJTml5T31NdPiY7o6tu6F54/vJEF9ZuA9n6PQ7/jiCkp L1UpfxsPq//aFkBafVKa0iMGfNeiX8vLj51moQBoOb096i4imj3LmhM/HyfEoxC/ADEOVD qZYMzqWkbFRvxSE1pBuX0tBpAMWmZxG+zj7o0cCYZMB2KA699T71YeTA+kW9MgPixumrcm 03UbzDFFR6NOYnNCd9lCdIgccnve1bOZU6g2pUIDYZgDG9WcX4qRuc8o/ivObQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=aH+c4an4; 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: 0.88 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=aH+c4an4; 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: F09432B234 X-Spam-Score: 0.88 X-Migadu-Scanner: scn0.migadu.com X-TUID: c8r46EFd1z7A * lisp/org-indent.el (org-indent--compute-prefixes): Prefixes should only be computed when `org-indent-indentation-per-level' is greater than 0. For one thing, the current algorithm leads to an error otherwise, and for another, this makes it possible to use org-indent just to preserve indentation on continuation lines, without adding any additional indentation per level (by setting the option to 0). TINYCHANGE --- lisp/org-indent.el | 49 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/lisp/org-indent.el b/lisp/org-indent.el index ea7ea071b..b87cc4e5f 100644 --- a/lisp/org-indent.el +++ b/lisp/org-indent.el @@ -126,31 +126,32 @@ 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)) - (dotimes (n org-indent--deepest-level) - (let ((indentation (if (<= n 1) 0 - (* (1- org-indent-indentation-per-level) - (1- n))))) - ;; Headlines line prefixes. - (let ((heading-prefix (make-string indentation ?*))) - (aset org-indent--heading-line-prefixes + (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) + (1- n))))) + ;; Headlines line prefixes. + (let ((heading-prefix (make-string indentation ?*))) + (aset org-indent--heading-line-prefixes + n + (org-add-props heading-prefix nil 'face 'org-indent)) + ;; Inline tasks line prefixes + (aset org-indent--inlinetask-line-prefixes + n + (cond ((<= n 1) "") + ((bound-and-true-p org-inlinetask-show-first-star) + (concat org-indent-inlinetask-first-star + (substring heading-prefix 1))) + (t (org-add-props heading-prefix nil 'face 'org-indent))))) + ;; Text line prefixes. + (aset org-indent--text-line-prefixes n - (org-add-props heading-prefix nil 'face 'org-indent)) - ;; Inline tasks line prefixes - (aset org-indent--inlinetask-line-prefixes - n - (cond ((<= n 1) "") - ((bound-and-true-p org-inlinetask-show-first-star) - (concat org-indent-inlinetask-first-star - (substring heading-prefix 1))) - (t (org-add-props heading-prefix nil 'face 'org-indent))))) - ;; Text line prefixes. - (aset org-indent--text-line-prefixes - n - (org-add-props - (concat (make-string (+ n indentation) ?\s) - (and (> n 0) - (char-to-string org-indent-boundary-char))) - nil 'face 'org-indent))))) + (org-add-props + (concat (make-string (+ n indentation) ?\s) + (and (> n 0) + (char-to-string org-indent-boundary-char))) + nil 'face 'org-indent)))))) (defsubst org-indent-remove-properties (beg end) "Remove indentations between BEG and END." -- 2.32.0