Add features of leading stars with text properties & reverse outline path for consult-org-heading #1083
Replies: 4 comments 4 replies
-
Hi, @minad, good day! All other problems are minor, but here's a problem when commas that a heading candidate including them, will cause its sub-heading condidates not being able to be matched. The problem also occurs when using the original code. Here's the demo: consult-org-heading-discussion-comma-problem.mp4 |
Beta Was this translation helpful? Give feedback.
-
Are you using orderless with the default configuration? It uses comma to indicate you want a term to match as an initialism, so |
Beta Was this translation helpful? Give feedback.
-
Thanks. Regarding the candidate string generation I hope we can avoid obtaining the headline path, splitting it, and putting it together again. The concatenation should only be done once to avoid significant overhead. |
Beta Was this translation helpful? Give feedback.
-
Here's the complete version of the implementation, I've used it a couple of weeks, and it just works, just to share here, someone may find it interesting and improve it to be more generic so that can be added to the repo's wiki. Since I actually got no much confidence in my code quality.
The first part:
The second part:
A fix for a bug of Note: This may have been fixed if you're using the latest org-mode version, so you don't have to use the code below, only if you encounter such similar issues, then just try to use it.
Disable orderless to prevent mismatching for special characters specified in headings, so
Note that if you specify a subheading with unmatched heading level to its father heading, for example, the father is first level heading, and a subheading direct to it is third level heading, the font-lock color for the sub-heading will be displayed improperly, this is a historic problem in org-mode, here's the post in org-mode bug tracker: https://lists.gnu.org/archive/html/emacs-orgmode/2024-10/msg00207.html That's pretty much it. Lately I'll post a demo video, it's actually quite nice, my dream actually has come true to have a fully note-taking system in Emacs without a mouse! If someone trying to use the code and has questions, please just ask, I may have something necessary neglected to post for the code. |
Beta Was this translation helpful? Give feedback.
-
I managed to implement it to barely work, but it needs some improvements.
For someone new here, Here's where is the feature proposal that I mentioned: #862 It explains why these features are useful for.
Features:
consult-org-heading-add-leading-stars
to set if to display leading stars of a condidate or not & corresponding implementation.consult-org-heading-reverse-path
to set if to reverse order of outline path of a candidate or not & corresponding implementation.Some problems that I encountered(I need some help!):
I found no way to do:
heading
local variable to be set when both "reverse outline" & "leading stars" features are not required(their custom variables are set tonil
)leading-stars
local variable to be set when "leading stars" feature is not required(it's custom variables are set tonil
)If setting the local variables as
nil
rather than not defining them, then it's doable, but I'm not sure if that's the right way.Tab
) for the selected candidate, the sub-heading candidates won't be matched, which I don't know why. it needs to backspace once in order to display sub-heading candidates normally.Here's the code:
Beta Was this translation helpful? Give feedback.
All reactions