Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-26 Thread Ihor Radchenko
Bastien  writes:

> Ihor Radchenko  writes:
>
>> If you confirm, I can just remove the call to `org-fold-reveal'.
>
> Yes, I do confirm -- thanks for the quick feedback.

Fixed in 4280762e4.

Best,
Ihor




Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-25 Thread Kévin Le Gouguec
Ihor Radchenko  writes:

> I think I addressed the raised issues.
> Just merged org-fold upstream.

👏

> Kévin Le Gouguec  writes:
>
>> My recipe (based on commit f9dd109bc, Emacs 29.0.50 commit 864c8013fd):
>>
>> $ git switch feature/org-fold-universal-core-tidy
>> $ make autoloads
>> $ emacs -Q -L lisp -eval "(setq org-startup-folded t)" repro.org
>>
>> Restarting Emacs with the above between each step:
>>
>> (1) C-s abc ⇒ no logbook is unfolded,
>> (2) C-s def ⇒ no logbook is unfolded,
>> (3) C-s ghi ⇒ some logbooks are unfolded.
>>
>> Assuming you can reproduce: is it expected that logbooks are expanded in
>> case (3)?  I don't see what's "conceptually" different in situation (3)
>> vs. (1) and (2), so I'm puzzled to get different results.
>
> I had a hard time to reproduce your recipe because it was related to
> font-locking. The only way was increasing the font size, so that line
> widths were larger than the frame width.

Huh!  Interesting; here I could trigger the bug with all lines fitting
comfortably within the frame width; the longest is 70 columns long (line
69).

((frame-width) is 80; M-x describe-char says "DejaVu Sans Mono" 15)

Anyway, thanks for your patience!  font-lock problems are no joke 😕

> I believe I fixed the issue now.

Seems fixed to me!



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-25 Thread Bastien
Ihor Radchenko  writes:

> If you confirm, I can just remove the call to `org-fold-reveal'.

Yes, I do confirm -- thanks for the quick feedback.

-- 
 Bastien



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-25 Thread Ihor Radchenko
Bastien  writes:

> Ihor Radchenko  writes:
>
>> I think I addressed the raised issues.
>> Just merged org-fold upstream.
>
> Great!  Thanks again for the hard work and the merge.
>
> One glitch: when refiling an entry to a folded section, the section
> gets unfolded.
>
> Can you reproduce this?  Let me know if you need a detailed recipe.

Apparently I did it on purpose at some point when I was tuning the
differences between Emacs handling of overlays and text properties.

If I am correct about the cause, commenting out the org-fold-reveal' in
org-refile should solve the problem.

   ;; (org-fold-reveal)
   (org-paste-subtree level nil nil t)

If you confirm, I can just remove the call to `org-fold-reveal'.

Best,
Ihor



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-25 Thread Bastien
Hi Ihor,

Ihor Radchenko  writes:

> I think I addressed the raised issues.
> Just merged org-fold upstream.

Great!  Thanks again for the hard work and the merge.

One glitch: when refiling an entry to a folded section, the section
gets unfolded.

Can you reproduce this?  Let me know if you need a detailed recipe.

-- 
 Bastien



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-25 Thread Ihor Radchenko


I think I addressed the raised issues.
Just merged org-fold upstream.

Kévin Le Gouguec  writes:

> My recipe (based on commit f9dd109bc, Emacs 29.0.50 commit 864c8013fd):
>
> $ git switch feature/org-fold-universal-core-tidy
> $ make autoloads
> $ emacs -Q -L lisp -eval "(setq org-startup-folded t)" repro.org
>
> Restarting Emacs with the above between each step:
>
> (1) C-s abc ⇒ no logbook is unfolded,
> (2) C-s def ⇒ no logbook is unfolded,
> (3) C-s ghi ⇒ some logbooks are unfolded.
>
> Assuming you can reproduce: is it expected that logbooks are expanded in
> case (3)?  I don't see what's "conceptually" different in situation (3)
> vs. (1) and (2), so I'm puzzled to get different results.

I had a hard time to reproduce your recipe because it was related to
font-locking. The only way was increasing the font size, so that line
widths were larger than the frame width.

I believe I fixed the issue now.

> Also, a bit of idle curiosity:
>
>> (defun org-fold--isearch-reveal (&rest _)
>>   "Reveal text at POS found by isearch."
>>   (org-fold-show-set-visibility 'isearch))
>
> org-fold-show-set-visibility calls either
> org-fold-show-set-visibility--overlays, or
> org-fold-show-set-visibility--text-properties, and AFAICT neither of
> these handle 'isearch as an argument…  Is there a (cdr (assq 'isearch
> org-fold-show-context-detail)) missing?
>
> (This comes from a very cursory reading of the code; apologies if I've
> missed something)

You are right. I supposed to use org-fold-show-context. Fixed now.

Best,
Ihor




Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-25 Thread Ihor Radchenko


I think I addressed the raised issues.
Just merged org-fold upstream.

Kévin Le Gouguec  writes:

> My recipe (based on commit f9dd109bc, Emacs 29.0.50 commit 864c8013fd):
>
> $ git switch feature/org-fold-universal-core-tidy
> $ make autoloads
> $ emacs -Q -L lisp -eval "(setq org-startup-folded t)" repro.org
>
> Restarting Emacs with the above between each step:
>
> (1) C-s abc ⇒ no logbook is unfolded,
> (2) C-s def ⇒ no logbook is unfolded,
> (3) C-s ghi ⇒ some logbooks are unfolded.
>
> Assuming you can reproduce: is it expected that logbooks are expanded in
> case (3)?  I don't see what's "conceptually" different in situation (3)
> vs. (1) and (2), so I'm puzzled to get different results.

I had a hard time to reproduce your recipe because it was related to
font-locking. The only way was increasing the font size, so that line
widths were larger than the frame width.

I believe I fixed the issue now.

> Also, a bit of idle curiosity:
>
>> (defun org-fold--isearch-reveal (&rest _)
>>   "Reveal text at POS found by isearch."
>>   (org-fold-show-set-visibility 'isearch))
>
> org-fold-show-set-visibility calls either
> org-fold-show-set-visibility--overlays, or
> org-fold-show-set-visibility--text-properties, and AFAICT neither of
> these handle 'isearch as an argument…  Is there a (cdr (assq 'isearch
> org-fold-show-context-detail)) missing?
>
> (This comes from a very cursory reading of the code; apologies if I've
> missed something)

You are right. I supposed to use org-fold-show-context. Fixed now.

Best,
Ihor




Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-22 Thread Kévin Le Gouguec
Hey Ihor!

Ihor Radchenko  writes:

> This is the final version of the patch. I am going to merge it this
> weekend. If there are any comments, please send them ASAP.

I've thrown a couple of LOGBOOK-heavy Org files at your branch; I'm
observing something that I can't make sense of.  I tried to condense one
of these files into a small reproducer, see attached file; couldn't find
the time to make it smaller, sorry!

My recipe (based on commit f9dd109bc, Emacs 29.0.50 commit 864c8013fd):

$ git switch feature/org-fold-universal-core-tidy
$ make autoloads
$ emacs -Q -L lisp -eval "(setq org-startup-folded t)" repro.org

Restarting Emacs with the above between each step:

(1) C-s abc ⇒ no logbook is unfolded,
(2) C-s def ⇒ no logbook is unfolded,
(3) C-s ghi ⇒ some logbooks are unfolded.

Assuming you can reproduce: is it expected that logbooks are expanded in
case (3)?  I don't see what's "conceptually" different in situation (3)
vs. (1) and (2), so I'm puzzled to get different results.


Also, a bit of idle curiosity:

> (defun org-fold--isearch-reveal (&rest _)
>   "Reveal text at POS found by isearch."
>   (org-fold-show-set-visibility 'isearch))

org-fold-show-set-visibility calls either
org-fold-show-set-visibility--overlays, or
org-fold-show-set-visibility--text-properties, and AFAICT neither of
these handle 'isearch as an argument…  Is there a (cdr (assq 'isearch
org-fold-show-context-detail)) missing?

(This comes from a very cursory reading of the code; apologies if I've
missed something)


Other than this logbook oddity, I haven't found anything concerning.
Thanks for your efforts!


* xxx 
:LOGBOOK:
CLOCK: [2021-11-02 Tue 17:18]--[2021-11-02 Tue 17:25] =>  0:07
:END:
** xxx xxx x
***  [[:xxx/xx/x]]
:LOGBOOK:
CLOCK: [2021-11-03 Wed 13:51]--[2021-11-03 Wed 14:13] =>  0:22
CLOCK: [2021-11-03 Wed 11:52]--[2021-11-03 Wed 12:00] =>  0:08
CLOCK: [2021-11-03 Wed 11:27]--[2021-11-03 Wed 11:42] =>  0:15
CLOCK: [2021-11-03 Wed 09:06]--[2021-11-03 Wed 10:04] =>  0:58
CLOCK: [2021-11-02 Tue 18:11]--[2021-11-02 Tue 18:45] =>  0:34
CLOCK: [2021-11-02 Tue 17:36]--[2021-11-02 Tue 17:38] =>  0:02
CLOCK: [2021-11-02 Tue 17:25]--[2021-11-02 Tue 17:31] =>  0:06
:END:
- [ ] x://.xx.xxx.xxx/xxx/ ?
  (.xx x xx xxx)
- 🙌
  - "xxx abc xxx  xx"
 [[x://.xxx.xxx/xxx/#/xxx/][xxx xxx  xxx]]
 [[x://.xxx.xxx/xxx/xx/x#x-xxx-xx-xx][x xxx xx xx]]
 [[x://.xxx.xxx/xxx/xx/x#xx-xx][xx xx]]
- def xx:
  - x ()
  - x ()
 [[x://.xxx.xxx/xxx/xx/x#--xxx-xxx-x][xxx xxx]]
xx xx xxx xx xxx xxx? ⇒
xxx-x...@xxx.xxx
 [[:]]
: ~xxx..xxx:/xxx/-~
***  [[x://.xx.xxx//x/xxx-/][xx xxx]]
:LOGBOOK:
CLOCK: [2021-11-03 Wed 15:13]--[2021-11-03 Wed 15:14] =>  0:01
CLOCK: [2021-11-03 Wed 14:55]--[2021-11-03 Wed 14:57] =>  0:02
:END:
***  [[x://.xx.xxx//x//][ xxx xx xx xxx xxx]]
:LOGBOOK:
CLOCK: [2021-11-03 Wed 15:14]--[2021-11-03 Wed 15:17] =>  0:03
:END:
***  [[x://.xx.xxx//x/xx_x/][xx xx xxx xxx]]
:LOGBOOK:
CLOCK: [2021-11-03 Wed 16:00]--[2021-11-03 Wed 16:30] =>  0:30
:END:
***  [[:xxx/]]
:LOGBOOK:
CLOCK: [2021-11-05 Fri 11:02]--[2021-11-05 Fri 11:18] =>  0:16
CLOCK: [2021-11-05 Fri 09:42]--[2021-11-05 Fri 09:55] =>  0:13
CLOCK: [2021-11-04 Thu 18:30]--[2021-11-04 Thu 18:32] =>  0:02
CLOCK: [2021-11-04 Thu 12:07]--[2021-11-04 Thu 12:14] =>  0:07
CLOCK: [2021-11-04 Thu 11:10]--[2021-11-04 Thu 12:00] =>  0:50
CLOCK: [2021-11-03 Wed 18:11]--[2021-11-03 Wed 18:20] =>  0:09
:END:
-  :: xxx + 
- xx ::   xx  xxx
  - xxx xxx "xx":
- x xx xx   x
- xxx xx xxx ∈ >x xxx
-  :: xx xx  xxx + 
  - xx xx x xxx x
  - xx xx  xx
- xxx :: x//xx x
  -   xx
- 🙌
  - [[:xxx//xxx]]
- " xxx : xx xxx x xxx xxx,  
  xx x x "
- "xx xxx  xx x  xx  xxx"
  - [[x://.xx.xxx//x//#xxx=x][xxx x xxx]]
- " xxx xx  xx x xxx  
  x xxx"
  - [[x://xxx.xxx.xxx/xxx/-

Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-21 Thread Bastien
Ihor Radchenko  writes:

> https://github.com/yantar92/org/tree/feature/org-fold-universal-core-tidy

Thanks -- I confirm the bug I reported is not present in this branch.

-- 
 Bastien



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-21 Thread Ihor Radchenko
Bastien  writes:

>> Since the actual patch does not have the problem, I'd prefer to ignore
>> this problem unless it appears again after merging.
>
> Sure - can you point the exact branch/commit I should test for the 
> version that will be merged?

https://github.com/yantar92/org/tree/feature/org-fold-universal-core-tidy



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-21 Thread Bastien
Hi Ihor,

thanks for double-checking this.

Ihor Radchenko  writes:

> Since the actual patch does not have the problem, I'd prefer to ignore
> this problem unless it appears again after merging.

Sure - can you point the exact branch/commit I should test for the 
version that will be merged?

-- 
 Bastien



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-20 Thread Ihor Radchenko
Bastien  writes:

> I'm on commit e0abbbacf9427b69482c6c47c3ea0975b0e6fa6d from the
> feature/org-fold-universal-core branch of your org repo.
>
> Using Emacs 29.0.50 and this as the content for ~/test.org:
>
> * TODO [[https://orgmode.org][test]]
> SCHEDULED: <2022-04-20 mer.>
>
> Then run:
>
> - emacs -q
> - C-x C-f test.org
> - M-x org-agenda RET
> - < a . n t
>
> You should see the link losing its invisibility specs.

I did see it in fork/feature/org-fold-universal-core and it is very
strange. The properties are suddenly lost after running
add-text-properties and things become normal if I simply move
add-text-properties above org-fold-region in
org-activate-links--text-properties.

What is more strange, the actual patch I proposed
(fork/feature/org-fold-universal-core-tidy) does not have the problem.
At least, I cannot reproduce it with you recipe. And the patch have
exactly same org-activate-links--text-properties...

Since the actual patch does not have the problem, I'd prefer to ignore
this problem unless it appears again after merging.

Best,
Ihor




Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-20 Thread Bastien
Ihor Radchenko  writes:

> Bastien  writes:
>
>> One glitch: in an agenda view with an agenda item that has a link,
>> changing the todo state will make all parts of the link visible.
>>
>> Let me know if you need a more detail recipe to reproduce the bug.
>
> Recipe would be helpftul. I was unable to reproduce using

I'm on commit e0abbbacf9427b69482c6c47c3ea0975b0e6fa6d from the
feature/org-fold-universal-core branch of your org repo.

Using Emacs 29.0.50 and this as the content for ~/test.org:

* TODO [[https://orgmode.org][test]]
SCHEDULED: <2022-04-20 mer.>

Then run:

- emacs -q
- C-x C-f test.org
- M-x org-agenda RET
- < a . n t

You should see the link losing its invisibility specs.

-- 
 Bastien



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-20 Thread Ihor Radchenko
Bastien  writes:

> One glitch: in an agenda view with an agenda item that has a link,
> changing the todo state will make all parts of the link visible.
>
> Let me know if you need a more detail recipe to reproduce the bug.

Recipe would be helpftul. I was unable to reproduce using

* TODO this is test [[https://orgmode.org][org]]
SCHEDULED: <2022-04-20 Wed>

Best,
Ihor



Re: [PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-20 Thread Bastien
Hi Ihor,

thanks for your work on this.

Ihor Radchenko  writes:

> This is the final version of the patch. I am going to merge it this
> weekend. If there are any comments, please send them ASAP.

One glitch: in an agenda view with an agenda item that has a link,
changing the todo state will make all parts of the link visible.

Let me know if you need a more detail recipe to reproduce the bug.

-- 
 Bastien



[PATCH v2 00/38] Final call for comments: Merge org-fold feature branch

2022-04-20 Thread Ihor Radchenko
This is the final version of the patch. I am going to merge it this
weekend. If there are any comments, please send them ASAP.

This version is basically the same as previous, but (1) Rebased onto
current main; (2) org-agenda.el can be native compiled; (3) Fixed some
edge cases with fontification.

Best,
Ihor

Anders Johansson (3):
  Fix typo: delete-duplicates → delete-dups
  Fix bug in org-get-heading
  Rename remaining org-force-cycle-archived → org-cycle-force-archived

Ihor Radchenko (35):
  Add org-fold-core: new folding engine
  Separate folding functions from org.el into new library: org-fold
  Separate cycling functions from org.el into new library: org-cycle
  Remove functions from org.el that are now moved elsewhere
  Disable native-comp in agenda
  org-macs: New function org-find-text-property-region
  org-at-heading-p: Accept optional argument
  org-string-width: Reimplement to work with new folding
  Rename old function call to use org-fold
  Implement link folding
  Implement overlay- and text-property-based versions of some functions
  org-fold: Handle indirect buffer visibility
  Fix subtle differences between overlays and invisible text properties
  Support extra org-fold optimisations for huge buffers
  Alias new org-fold functions to their old shorter names
  Obsolete old function names that are now in org-fold
  org-compat: Work around some third-party packages using outline-*
functions
  Move `org-buffer-list' to org-macs.el
  Restore old visibility behaviour of org-refile
  Add org-fold-related tests
  org-manual: Update to new org-fold function names
  ORG-NEWS: Add list of changes
  Backport contributed commits
  Fix org-fold--hide-drawers--overlays
  org-string-width: Handle undefined behaviour in older Emacs
  org-string-width: Work around `window-pixel-width' bug in old Emacs
  org-fold-show-set-visibility: Fix edge case when folded region is at
BOB
  org-fold-core: Fix fontification inside folded regions
  test-org/string-width: Add tests for strings with prefix properties
  org--string-from-props: Fix handling folds in Emacs <28
  org-link-make-string: Throw error when both LINK and DESCRIPTION are
empty
  test-ol/org-toggle-link-display: Fix compatibility with old Emacs
  org-macs.el: Fix fontification checks take 2
  org-fold-core-fontify-region: Fix cases when fontification is not
registered
  org-agenda.el: Re-enable native compilation

 doc/org-manual.org|   14 +-
 etc/ORG-NEWS  |  104 ++
 lisp/ob-core.el   |   14 +-
 lisp/ob-lilypond.el   |4 +-
 lisp/ob-ref.el|4 +-
 lisp/ol.el|   59 +-
 lisp/org-agenda.el|   48 +-
 lisp/org-archive.el   |   12 +-
 lisp/org-capture.el   |7 +-
 lisp/org-clock.el |  126 +-
 lisp/org-colview.el   |   10 +-
 lisp/org-compat.el|  189 ++-
 lisp/org-crypt.el |8 +-
 lisp/org-cycle.el |  818 +++
 lisp/org-element.el   |   55 +-
 lisp/org-feed.el  |4 +-
 lisp/org-fold-core.el | 1506 +++
 lisp/org-fold.el  | 1132 +++
 lisp/org-footnote.el  |6 +-
 lisp/org-goto.el  |6 +-
 lisp/org-id.el|4 +-
 lisp/org-inlinetask.el|   26 +-
 lisp/org-keys.el  |   26 +-
 lisp/org-lint.el  |3 +-
 lisp/org-list.el  |   84 +-
 lisp/org-macs.el  |  294 +++-
 lisp/org-mobile.el|2 +-
 lisp/org-mouse.el |4 +-
 lisp/org-refile.el|3 +-
 lisp/org-src.el   |6 +-
 lisp/org-timer.el |2 +-
 lisp/org.el   | 2550 +++--
 lisp/ox-org.el|2 +-
 lisp/ox.el|4 +-
 testing/lisp/test-ob.el   |   12 +-
 testing/lisp/test-ol.el   |   24 +
 testing/lisp/test-org-list.el |   75 +-
 testing/lisp/test-org-macs.el |6 +-
 testing/lisp/test-org.el  |  258 +++-
 39 files changed, 5480 insertions(+), 2031 deletions(-)
 create mode 100644 lisp/org-cycle.el
 create mode 100644 lisp/org-fold-core.el
 create mode 100644 lisp/org-fold.el

-- 
2.35.1



-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: yanta...@gmail.com, ihor_radche...@alumni.sutd.edu.sg