From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2PdWEPOOE2Eq5wAAgWs5BA (envelope-from ) for ; Wed, 11 Aug 2021 10:48:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mJLTC/OOE2H1cQAAB5/wlQ (envelope-from ) for ; Wed, 11 Aug 2021 08:48:51 +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 8BB2E1D301 for ; Wed, 11 Aug 2021 10:48:50 +0200 (CEST) Received: from localhost ([::1]:52864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDjur-00021j-C5 for larch@yhetil.org; Wed, 11 Aug 2021 04:48:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDjuM-00021N-Fy for emacs-orgmode@gnu.org; Wed, 11 Aug 2021 04:48:18 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]:44696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mDjuK-0004Bv-Sv for emacs-orgmode@gnu.org; Wed, 11 Aug 2021 04:48:18 -0400 Received: by mail-io1-xd33.google.com with SMTP id d22so2620991ioy.11 for ; Wed, 11 Aug 2021 01:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7cKbtF9cIwAgzh4q5gC72dS/86PUsHQYC/kiCQ14y3E=; b=e2eKKautSUHiXd8hDNG40SLDu7G8g8RGkTSbDgQmB2ti3D9BkLZfHISPWdbUow5zDM VbYtHdPbpXgm4QHtCBoh3B7VTXb01K2wGVIhWdXqvBkuBLX6hpDMPUorDAVjACHiN1I/ ALtbEvaZmOZvV8+vmU7RCrMROhuvAe89xpzgn1KDiianAnPIiKTlLkjotpZTeL1F5kDM vts7ArxMYqq44lM3evGRM5KgL4FjYjjJWIVcm3Nd7Vc1yyVVrc3mDF6RwZ6w9XAm6/38 PPXQem0Gk+xO5RCn0BDXy9P2lvDQ3MuOeMlogTXKAVnTwkMO7QVKfigPvVbfAHzYImYO MldQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7cKbtF9cIwAgzh4q5gC72dS/86PUsHQYC/kiCQ14y3E=; b=E+mAzRU1y/bNY0QDJr2XCTzhr7AyoSciHkkRAgu4mbL1pKl9ght4fOmKv6yQh49VbX WWY6azO8/YyRbO3QB+S5NxaJdgg/0+6Vt093yRVt2Wn1srZSRgvn9Lc0EjqYitmfwmiG fZbhvFaliirvAPiRzjO6uFGMhaErJCRZdtSm1YOv81i3b30LGWOSOXkd2i5CTH4KFISE hC9GkRfJmh8KY3pruGEKJTxdeww+kNxOF1ouGx/DY/J4tZCLMFeiPcSO5QZNoOoZQqzu tSqKxbmrERMMFeopUR9tx+DbUkwbjngHkBGYlg8fxEB8Pm01PRxZg6F/V7YtzgC5nHjf CSqQ== X-Gm-Message-State: AOAM531QvVkkkFeCsmhQxPKdrQpKGB+c2bjaQF4vv0XcVAKIxD58UCND yFkCXSv1vYR87QqtUZGCh7u248Fvrxjqo8aS3mYtUTTwAwE= X-Google-Smtp-Source: ABdhPJxqr853fimKzkYC3XmXvdgZFYH5MUpCSi516BArpCAl9KhJpXyEK1ow9S705Bx4ykel9tCMomiFNiQXl8ppxXs= X-Received: by 2002:a05:6602:38a:: with SMTP id f10mr103232iov.172.1628671695446; Wed, 11 Aug 2021 01:48:15 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?RGF2aWQgTHVrZcWh?= Date: Wed, 11 Aug 2021 10:48:04 +0200 Message-ID: Subject: org-indent-indentation-per-level may be broken To: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::d33; envelope-from=dafydd.lukes@gmail.com; helo=mail-io1-xd33.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=1628671731; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=7cKbtF9cIwAgzh4q5gC72dS/86PUsHQYC/kiCQ14y3E=; b=aATLOtoS4K1kHYKk0TlD5VMJDW5K+2pYBP59q3iNUgpL5mkl5TCgaAY50IzDp4KXKHf5g2 JHDkpYn88BdwA4wGVnO3+1p+6qmX+3162Hm9ydLLh5B32BEjq5OqGSeSSNS0e2DYugXRiv 9O0eSjTu1A+Cf8AqqFIRGoXC60lRlLQ8DhF4szilqSkruq/fqNvztd17Ra+0f0VlqaWNcp 7rxuhuIqvMuPJPYveeKs9Md5dNbmpgwJKFIP58W+JcSXwnFakaIE1H9NknvIQ9Eix0tDYp pSLVTrJm4Uj2/948qOsYJMyJjRhkKiaS/r10fN/xXdLlSNmww4aTfZXx/mIDJQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628671731; a=rsa-sha256; cv=none; b=ZEcfbMzgdtjObUmXMKkIvC14Z0ds3jJ+kk3r7fYYuq6nYDsGLvU017UfY0xtCu4TaXDudC fxQZgRE9ARyX4sEbKFCrNMLSjALWEpfEBp5pg0DcSJ5VZYr5p973vnK0Wv/4oKa2nyKE3G 6O5cchpyA9gRbGPOhfSpZC25rEJXjX4NgeeW/Tfn7VT8M7AWHwfYbSC2l6Zz1pmgguq9mT pSTOyPfZrfuUUO1IOG7H+BfyIYADgaM3nsf4ERnLYoZm2bIIl9duukM+4u5QzcgGjogj21 uGm0n1bzAUTTueCsSPr81fFA5B6xwbpytQy6LD1giX2/1O/nuyJsIDr3JBufxg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=e2eKKaut; 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.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=e2eKKaut; 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: 8BB2E1D301 X-Spam-Score: -3.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: NDyCigYiJJAK Hi all, I'd like to use visual-line-mode to soft-wrap lines in Org files, while keeping continuation lines in list items properly indented: - long line that goes on to the edge of the screen and soft wraps like I want it to Instead of this: - long line that goes on to the edge of the screen and soft wraps like I *don't* want it to I figured it should be possible to achieve this with org-indent-mode. However, that mode also adds visual pre-indentation for each heading level, which I'd rather avoid, I'd like the content under the headings to start flush with the left margin. So the overall result should look like this: * Heading - long line that goes on to the edge of the screen and soft wraps like I want it to Not like this: * Heading - long line that goes on to the edge of the screen and soft wraps like I want it to I thought I could achieve this by setting org-indent-indentation-per-level to 0, and historically, people seem to have been able to use it for this purpose [1] (if I understand the comment correctly). [1]: https://www.reddit.com/r/emacs/comments/97naje/what_is_everyones_org_mode_indentation_preferences/e4a6qqt?utm_source=share&utm_medium=web2x&context=3 However, when I set the option to 0 and start org-indent-mode, I currently get the following error: Debugger entered--Lisp error: (wrong-type-argument wholenump -1) make-string(-1 42) org-indent--compute-prefixes() org-indent-mode(toggle) funcall-interactively(org-indent-mode toggle) call-interactively(org-indent-mode record nil) command-execute(org-indent-mode record) execute-extended-command(nil "org-indent-mode" "org-indent-m") funcall-interactively(execute-extended-command nil "org-indent-mode" "org-indent-m") call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command) So it seems like the logic that computes the actual indentation based on org-indent-indentation-per-level is broken? And maybe in more than one way, because when I set it to e.g. 5, I would expect the amount of indentation when I run org-indent-mode to increase appropriately, but it doesn't, it's the same as with the default value of 2. FWIW, I can avoid the error and get the effect that I was originally looking for by applying the following patch: --- a/org-indent.el 2021-08-11 09:30:45.000000000 +0200 +++ b/org-indent.el 2021-08-11 10:45:13.000000000 +0200 @@ -130,8 +130,9 @@ (make-vector org-indent--deepest-level nil)) (dotimes (n org-indent--deepest-level) (let ((indentation (if (<= n 1) 0 + (max 0 (* (1- org-indent-indentation-per-level) - (1- n))))) + (1- n)))))) ;; Headlines line prefixes. (let ((heading-prefix (make-string indentation ?*))) (aset org-indent--heading-line-prefixes @@ -146,13 +147,14 @@ (substring heading-prefix 1))) (t (org-add-props heading-prefix nil 'face 'org-indent))))) ;; Text line prefixes. + (if (> org-indent-indentation-per-level 0) (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))))) + nil 'face 'org-indent)))))) (defsubst org-indent-remove-properties (beg end) "Remove indentations between BEG and END." But that's just a workaround for my particular case, setting org-indent-indentation-per-level to values greater than 2 still has no discernible effect after these changes. Here are the contents of the init.el file I'm testing this with: (setq org-indent-indentation-per-level 0 org-adapt-indentation nil debug-on-error t) (global-visual-line-mode 1) And here's my version info: GNU Emacs 27.2 (build 1, aarch64-apple-darwin20.3.0, Carbon Version 164 AppKit 2022.3) of 2021-06-11 Org mode version 9.4.6 (9.4.6-12-gdcc3a8-elpa @ /Users/david/.emacs.d/elpa/org-20210809/) (Please let me know if I should provide some more!) Best, David