emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Recent changes in org-fold regarding emphasize visibility
@ 2022-05-04 13:07 Daniel Fleischer
  2022-05-04 14:43 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Fleischer @ 2022-05-04 13:07 UTC (permalink / raw)
  To: emacs-orgmode

There are some recent (week old) changes to org-fold that changes
fold/emphasize behavior. Before the changes, I used to have

    (setq org-fold-catch-invisible-edits 'show-and-error)

in order to prevent accidental write in the following places:

    :PROPERTIES:|...

But now, hidden emphasize symbols are considered "folded" so when I
write:

    *Hello*|

and about to press "space" I get a warning.

I think this is a regression. I don't want to change the
`org-fold-catch-invisible-edits' variable to something else because I
worry more about accidental edits in real folded regions. I don't
understand why emphasize markers are treated as folded text.

`org-hide-emphasis-markers` is set to non-nil. 

Best,

-- 

Daniel Fleischer


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

* Re: Recent changes in org-fold regarding emphasize visibility
  2022-05-04 13:07 Recent changes in org-fold regarding emphasize visibility Daniel Fleischer
@ 2022-05-04 14:43 ` Ihor Radchenko
  2022-05-05 19:42   ` Daniel Fleischer
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-05-04 14:43 UTC (permalink / raw)
  To: Daniel Fleischer; +Cc: emacs-orgmode

Daniel Fleischer <danflscr@gmail.com> writes:

>     (setq org-fold-catch-invisible-edits 'show-and-error)
>
> in order to prevent accidental write in the following places:
>
>     :PROPERTIES:|...
>
> But now, hidden emphasize symbols are considered "folded" so when I
> write:
>
>     *Hello*|
>
> and about to press "space" I get a warning.
>
> I think this is a regression. I don't want to change the
> `org-fold-catch-invisible-edits' variable to something else because I
> worry more about accidental edits in real folded regions. I don't
> understand why emphasize markers are treated as folded text.
>
> `org-hide-emphasis-markers` is set to non-nil. 

Fixed on main by d2a459d25

Best,
Ihor


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

* Re: Recent changes in org-fold regarding emphasize visibility
  2022-05-04 14:43 ` Ihor Radchenko
@ 2022-05-05 19:42   ` Daniel Fleischer
  2022-05-07  4:22     ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Fleischer @ 2022-05-05 19:42 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@gmail.com> writes:

> Fixed on main by d2a459d25

I've tried the commit. I think there are still issues. E.g. given a
folded headline

    * Introduction...|
    * Section

Inserting text at that point will do the following thing depending on
`org-fold-catch-invisible-edits':

- error : it inserts the text without unfolding; most dangerous.
- show : unfold, insert the text without displaying it; dangerous.
- show-and-error: unfold but inserts the text anyways.


Thanks,

-- 

Daniel Fleischer


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

* Re: Recent changes in org-fold regarding emphasize visibility
  2022-05-05 19:42   ` Daniel Fleischer
@ 2022-05-07  4:22     ` Ihor Radchenko
  2022-05-07  6:57       ` Daniel Fleischer
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-05-07  4:22 UTC (permalink / raw)
  To: Daniel Fleischer; +Cc: emacs-orgmode

Daniel Fleischer <danflscr@gmail.com> writes:

> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> Fixed on main by d2a459d25
>
> I've tried the commit. I think there are still issues. E.g. given a
> folded headline
>
>     * Introduction...|
>     * Section
>
> Inserting text at that point will do the following thing depending on
> `org-fold-catch-invisible-edits':
>
> - error : it inserts the text without unfolding; most dangerous.
> - show : unfold, insert the text without displaying it; dangerous.
> - show-and-error: unfold but inserts the text anyways.

Thanks for testing!

The problem here is that emphasis markers and links are also partially
hidden and it is a good idea to check invisible edits there.
It's just that they were ignored by org-catch-invisible-edits in the
past. But not anymore.

I afraid that it is impossible to follow the present docstring for
org-catch-invisible-edits without mixing 'error/'show-and-error with
'smart. It's perfectly fine to insert text right after trailing ]] of
the links, but, as you showed, not after folded headline contents.

Now, we have different kinds of hidden text at hand:
- folded headlines/lists
- folded drawers
- folded blocks
- folded links/emphasis

The question is what should be the logical behaviour of Org when editing
text inside or at the border of these hidden text types? How should we
interpret the values of org-catch-invisible-edits (nil error show
show-and-error smart)?

Best,
Ihor


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

* Re: Recent changes in org-fold regarding emphasize visibility
  2022-05-07  4:22     ` Ihor Radchenko
@ 2022-05-07  6:57       ` Daniel Fleischer
  2022-05-08  9:53         ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Fleischer @ 2022-05-07  6:57 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko [2022-05-07 Sat 12:22] wrote:

> Now, we have different kinds of hidden text at hand:
> - folded headlines/lists
> - folded drawers
> - folded blocks
> - folded links/emphasis
>
> The question is what should be the logical behaviour of Org when editing
> text inside or at the border of these hidden text types? How should we
> interpret the values of org-catch-invisible-edits (nil error show
> show-and-error smart)?

Hi Ihor,

Not sure we need to reinterpret the settings; roughly they cover the
different options of what to do when you edit a hidden text: edit
anyways, throw an error, unfold but do nothing, unfold and do what you
wanted to do and the only thing I don't have an intuition about is the
smart option.

BTW, there are no issues when the folding core style is "overlays". So
why not follow what happens in that case, even formalize it into tests?

Best, 

-- 

Daniel Fleischer


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

* Re: Recent changes in org-fold regarding emphasize visibility
  2022-05-07  6:57       ` Daniel Fleischer
@ 2022-05-08  9:53         ` Ihor Radchenko
  2022-05-08 14:28           ` Daniel Fleischer
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2022-05-08  9:53 UTC (permalink / raw)
  To: Daniel Fleischer; +Cc: emacs-orgmode

Daniel Fleischer <danflscr@gmail.com> writes:

>> The question is what should be the logical behaviour of Org when editing
>> text inside or at the border of these hidden text types? How should we
>> interpret the values of org-catch-invisible-edits (nil error show
>> show-and-error smart)?
>
> Not sure we need to reinterpret the settings; roughly they cover the
> different options of what to do when you edit a hidden text: edit
> anyways, throw an error, unfold but do nothing, unfold and do what you
> wanted to do and the only thing I don't have an intuition about is the
> smart option.
>
> BTW, there are no issues when the folding core style is "overlays". So
> why not follow what happens in that case, even formalize it into tests?

Reasonable.
I have made changes in invisible edit handling.
Now, when using 'text-properties style,
org-fold-check-before-invisible-edits ignores folded links just like it
does with overlays style.

The commit is 2e4ed52b1.

Let me know if you are getting the expected behaviour now.

Best,
Ihor


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

* Re: Recent changes in org-fold regarding emphasize visibility
  2022-05-08  9:53         ` Ihor Radchenko
@ 2022-05-08 14:28           ` Daniel Fleischer
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Fleischer @ 2022-05-08 14:28 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@gmail.com> writes:

> I have made changes in invisible edit handling.
> Now, when using 'text-properties style,
> org-fold-check-before-invisible-edits ignores folded links just like it
> does with overlays style.
>
> The commit is 2e4ed52b1.

Looks good; thank you Ihor!


-- 

Daniel Fleischer


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

end of thread, other threads:[~2022-05-08 14:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 13:07 Recent changes in org-fold regarding emphasize visibility Daniel Fleischer
2022-05-04 14:43 ` Ihor Radchenko
2022-05-05 19:42   ` Daniel Fleischer
2022-05-07  4:22     ` Ihor Radchenko
2022-05-07  6:57       ` Daniel Fleischer
2022-05-08  9:53         ` Ihor Radchenko
2022-05-08 14:28           ` Daniel Fleischer

Code repositories for project(s) associated with this 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).