* [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
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] org.el: Adapt org-cycle to work with headlines with hidden stars
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
0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2020-09-13 17:18 UTC (permalink / raw)
To: Marlin Strub; +Cc: emacs-orgmode
Hi Marlin,
Marlin Strub <marlin.strub@gmail.com> writes:
> 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.
there was a recent fix for this in the master branch: can you test
latest Org (from master) and see if your fix is still needed?
Thanks a lot,
--
Bastien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] org.el: Adapt org-cycle to work with headlines with hidden stars
2020-09-13 17:18 ` Bastien
@ 2020-09-14 7:12 ` Marlin Strub
2020-09-14 13:37 ` Bastien
0 siblings, 1 reply; 5+ messages in thread
From: Marlin Strub @ 2020-09-14 7:12 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 692 bytes --]
Hi Bastien,
Thanks for looking into this. I just tested with 9c31cba00 and
org-cycle does not work reliably when org-starless-mode is
enabled unless the patch is applied.
Best,
Marlin
On Sun, 13 Sep 2020 at 19:18, Bastien <bzg@gnu.org> wrote:
> Hi Marlin,
>
> Marlin Strub <marlin.strub@gmail.com> writes:
>
> > 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.
>
> there was a recent fix for this in the master branch: can you test
> latest Org (from master) and see if your fix is still needed?
>
> Thanks a lot,
>
> --
> Bastien
>
[-- Attachment #2: Type: text/html, Size: 1182 bytes --]
^ permalink raw reply [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
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).