[-- Attachment #1.1: Type: text/plain, Size: 869 bytes --]
Hello everyone,
I looked into using text properties to hide all the stars in org headings
(with org-starless-mode [1]),
and noticed that `org-cycle' didn't reliably cycle the visibility of
headings anymore.
Trying to find the reason for this, I found that `org-cycle' uses
`move-beginning-of-line' in combination
with a regexp to detect headings. The problem is that
`move-beginning-of-line' ignores invisible text
such that the regexp fails to match. The attached patch changes
`move-beginning-of-line' to
`beginning-of-line', which does not ignore invisible text.
This solves the issue with hidden stars, but I have a feeling that I'm
missing something. Is there a
problem with using `beginning-of-line' instead of `move-beginning-of-line'
or could this patch be
applied?
Thanks a lot for looking into this,
Marlin
[1] https://github.com/TonCherAmi/org-starless
[-- Attachment #1.2: Type: text/html, Size: 1196 bytes --]
[-- Attachment #2: 0001-org.el-Adapt-org-cycle-to-work-with-headlines-with-h.patch --]
[-- Type: application/octet-stream, Size: 1191 bytes --]
From 4ba5026a96c6cee4f0320f70f46245b551af2647 Mon Sep 17 00:00:00 2001
From: Marlin Strub <marlin@Marlins-MacBook-Pro.local>
Date: Fri, 11 Sep 2020 13:50:06 +0200
Subject: [PATCH] org.el: Adapt org-cycle to work with headlines with hidden
stars
* lisp/org.el (org-cycle): Use `beginning-of-line' instead of
`move-beginning-of-line' to move point to the beginning of
line (including any invisible characters) such that org-outline-regexp
matches headlines with hidden stars (such as those produced by
[[https://github.com/TonCherAmi/org-starless][org-starless-mode]]).
TINYCHANGE
---
lisp/org.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index 71dbc611e..722338ff0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6346,7 +6346,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
(= (line-beginning-position)
(org-element-property :post-affiliated
item)))))
- (save-excursion (move-beginning-of-line 1)
+ (save-excursion (beginning-of-line 1)
(looking-at org-outline-regexp)))
(or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
(org-cycle-internal-local))
--
2.28.0