Fix: (-view--format-element) Remove text properties from keywords

Modes like org-indent-mode and org-modern can add text properties to
to-do keywords in Org buffers, and those properties can "bleed over"
when org-element copies those regions into strings.  When those
strings are then displayed in an org-ql-view buffer, they can affect
how the keywords appear, e.g. having extra spaces prefixing them,
which breaks alignment.  We apply faces to the keywords ourselves, so
we don't need any properties from the source buffer.

Fixes #455.
This commit is contained in:
Adam Porter 2024-08-29 14:21:50 -05:00
parent b6704c2814
commit 357d533b75
3 changed files with 51 additions and 45 deletions

View file

@ -555,7 +555,8 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
** 0.8.8-pre
Nothing new yet.
*Fixes*
+ Remove text properties from to-do keywords before displaying them in an ~org-ql-view~ buffer. (Such text properties could cause them to, e.g. display with extra leading spaces, depending on which other modes might be enabled in the source Org buffer.)
** 0.8.7

View file

@ -872,7 +872,8 @@ return an empty string."
(title (--> (org-ql-view--add-faces element)
(org-element-property :raw-value it)))
(todo-keyword (-some--> (org-element-property :todo-keyword element)
(org-ql-view--add-todo-face it)))
(org-ql-view--add-todo-face
(substring-no-properties it))))
(tag-list (if org-use-tag-inheritance
;; MAYBE: Use our own variable instead of `org-use-tag-inheritance'.
(if-let ((marker (or (org-element-property :org-hd-marker element)

View file

@ -1082,7 +1082,11 @@ File: README.info, Node: 088-pre, Next: 087, Up: Changelog
5.1 0.8.8-pre
=============
Nothing new yet.
*Fixes*
• Remove text properties from to-do keywords before displaying them
in an org-ql-view buffer. (Such text properties could cause them
to, e.g. display with extra leading spaces, depending on which
other modes might be enabled in the source Org buffer.)

File: README.info, Node: 087, Next: 086, Prev: 088-pre, Up: Changelog
@ -2040,48 +2044,48 @@ Node: Links38925
Node: Tips39612
Node: Changelog39936
Node: 088-pre40872
Node: 08740984
Node: 08642216
Node: 08542450
Node: 08443106
Node: 08343558
Node: 08243899
Node: 08144292
Node: 0844713
Node: 07447437
Node: 07347662
Node: 07248396
Node: 07149317
Node: 0750128
Node: 06352994
Node: 06253527
Node: 06153834
Node: 0654404
Node: 05257460
Node: 05157762
Node: 0558187
Node: 04959718
Node: 04860000
Node: 04760349
Node: 04660758
Node: 04561166
Node: 04461527
Node: 04361886
Node: 04262089
Node: 04162250
Node: 0462497
Node: 03266598
Node: 03167001
Node: 0367198
Node: 02370498
Node: 02270732
Node: 02171012
Node: 0271217
Node: 0175295
Node: Notes75396
Node: Comparison with Org Agenda searches75558
Node: org-sidebar76447
Node: License76726
Node: 08741255
Node: 08642487
Node: 08542721
Node: 08443377
Node: 08343829
Node: 08244170
Node: 08144563
Node: 0844984
Node: 07447708
Node: 07347933
Node: 07248667
Node: 07149588
Node: 0750399
Node: 06353265
Node: 06253798
Node: 06154105
Node: 0654675
Node: 05257731
Node: 05158033
Node: 0558458
Node: 04959989
Node: 04860271
Node: 04760620
Node: 04661029
Node: 04561437
Node: 04461798
Node: 04362157
Node: 04262360
Node: 04162521
Node: 0462768
Node: 03266869
Node: 03167272
Node: 0367469
Node: 02370769
Node: 02271003
Node: 02171283
Node: 0271488
Node: 0175566
Node: Notes75667
Node: Comparison with Org Agenda searches75829
Node: org-sidebar76718
Node: License76997

End Tag Table