emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org.el: Adapt org-cycle to work with headlines with hidden stars
@ 2020-09-11 12:45 Marlin Strub
  2020-09-13 17:18 ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Marlin Strub @ 2020-09-11 12:45 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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

Thanks a lot for looking into this,

[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

* 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

 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
-		     (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))))

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-14 13:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-11 12:45 [PATCH] org.el: Adapt org-cycle to work with headlines with hidden stars Marlin Strub
2020-09-13 17:18 ` Bastien
2020-09-14  7:12   ` Marlin Strub
2020-09-14 13:37     ` Bastien
2020-09-14 13:48       ` Marlin Strub

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).