"J.D. Smith" <[email protected]> writes:

>> I see. I thought that you only need this for 'cursor-sensor-functions.
>> I am a bit confused why you need read-nonsticky for invisible.
>> It is commented now and does not cause any issues. Does org-inside
>> change anything in this regard?
>
> Yes.  It's a subtle point related to point adjustment (emphasis added).
>> I am proposing
>> (add-text-properties (1- pos) pos (delq 'invisible (list 'rear-nonsticky 
>> org-nonsticky-props)))
>
> I see.  So effectively org-rear-nonsticky-at for everything _but_
> 'invisible.  For the reasons described above, this will not work: we
> need rns+=invisible to achieve the necessary point adjustment behavior.
> It's the important member of 'org-nonsticky-props for us.

Understood.
Then, let's keep it only when org-inside is enabled.
Enabling org-inside-mode will already change the cursor behavior, so
people will not be surprised.

I had another review pass on the code.

More comments:

1. There are warnings when compiling with Emacs 29

In toplevel form:
org-inside.el:190:16: Warning: variable ‘_’ not left unused
org-inside.el:433:17: Warning: variable ‘_’ not left unused

In end of data:
org-inside.el:201:8: Warning: the function ‘set-window-cursor-type’ is not 
known to be defined.
org-inside.el:200:50: Warning: the function ‘window-cursor-type’ is not known 
to be defined.

2. I think it is a good idea to reset font-lock when disabling
   org-inside. That will clear rear-nonsticky setup.

3. org--extra-unfontify-properties value is declared to be prop t, but
it is not how org-inside uses it. See the proposed fix below:

org-unfontify-region: Fix argument value for `remove-text-properties'

* lisp/org.el (org--extra-unfontify-properties): Fix docstring
according to how this variable is set by org-inside.el - list of
property symbols.
(org-unfontify-region): Pass 'property t to `remove-text-properties'.

1 file changed, 8 insertions(+), 7 deletions(-)
lisp/org.el | 15 ++++++++-------

modified   lisp/org.el
@@ -6423,19 +6423,20 @@ (defun org-font-lock-add-tag-faces (limit)
 
 (defvar org--extra-unfontify-properties nil
   "Extra properties to unfontify.
-Specify as `(PROP1 t PROP2 t ...)'.")
+Specify as `(PROP1 PROP2 ...)'.")
 
 (defun org-unfontify-region (beg end &optional _maybe_loudly)
   "Remove fontification and activation overlays from links."
   (font-lock-default-unfontify-region beg end)
   (with-silent-modifications
     (decompose-region beg end)
-    (remove-text-properties beg end
-                           `(mouse-face t keymap t org-linked-text t
-                                        invisible t intangible t
-                                        org-emphasis t
-                                         syntax-table t
-                                         ,@org--extra-unfontify-properties))
+    (remove-text-properties
+     beg end
+     `( mouse-face t keymap t org-linked-text t
+       invisible t intangible t
+       org-emphasis t
+        syntax-table t
+        ,@(mapcan (lambda (p) (list p t)) org--extra-unfontify-properties)))


-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to