-
-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
helm-get-org-candidates-in-file truncates headings at the wrong position #1294
Comments
Thanks to look into this, I have not implemented this myself and BTW I |
See also my comments on #964. Thank you, Thierry! |
* helm-org.el (helm-get-org-candidates-in-file): Do it.
* helm-org.el (helm-get-org-candidates-in-file): Don't use helm-window here, it doesn't already exists.
* helm-org.el (helm-org--get-candidates-in-file): Renamed from helm-get-org-candidates-in-file, unquote lambda's.
* helm-org.el (helm-org--get-candidates-in-file): Remove backquote forest.
* helm-easymenu.el: Do it. * helm-org.el (helm-org-get-candidates): Use helm-flatten-list. (helm-org--get-candidates-in-file): Minor changes.
* helm-org.el (helm-org--get-candidates-in-file): Use apply instead of using a different lambda.
#1294). * helm-org.el (helm-source-org-headings-for-files): Do it. (helm-org--get-candidates-in-file): Fix long lines.
Titus von der Malsburg [email protected] writes:
I tried to improve all this, hope that fixed your problems. Thanks. |
See commits regarding emacs-helm/helm#1294
* helm-org.el (helm-org--get-candidates-in-file): Do it.
With this recent update ( |
Jonathan Gregory [email protected] writes:
Please clarify how you are using this, with a recipe if possible. Thanks. |
I was using it to search bibliographical notes. See: https://gist.github.com/jagrg/39d68432c783df50d199. |
* helm-org.el (helm-source-org-headings-for-files): Implicit nil default for parents. (helm-org-get-candidates): Same use a defun.
Jonathan Gregory [email protected] writes:
Why are you using: (cl-defun helm-bibtex-source-org-headings-for-files (filenames &optional instead of simply passing 2 (min-depth) and 2 (max-depth) to I can't try your code because I have no idea how to install helm-bibtex Also be sure to recompile correctly all your files. |
Matching is apparently still done on the truncated headlines. I used the following org mode file for testing:
When I fire up |
@jagrg your issue is probably independent from helm-bibtex. You could make Thierry's life easier by constructing a minimal reproducible example. |
Titus von der Malsburg [email protected] writes:
Good, thanks for the recipe, will look also into this soon. |
@thierryvolpiatto, here's a test file: https://gist.github.com/jagrg/6305b022557b80d7f012. You don't need helm-bibtex installed. This is what you need to do:
This is what I see:
And this is what I used to see before the commits:
|
* helm-org.el (helm-source-org-headings-for-files): Add a match function. (helm-org--get-candidates-in-file): Add a text property.
Thanks for the recipe. Jonathan Gregory [email protected] writes:
Yes this is what is expected.
This is not related to last commits AFAICT, this was the behavior some months Did you try to pass your arguments directly to helm-org-get-candidates ? |
* helm-org.el (helm-source-org-headings-for-files): Ensure candidate is propertized in match fn (paranoia).
This is the commit where the problem begins: d6c8b7c I know this is the desired behaviour but I'm wanting to control exactly which level to display. In my case, that's level 2. I was hoping that changing min and max-depth would work (and it did before the commit above). I also tried to change (cl-defun helm-org-get-candidates (filenames min-depth max-depth &optional (parents nil))
(helm-flatten-list
(mapcar (lambda (filename)
(helm-org--get-candidates-in-file
filename 2 2
helm-org-headings-fontify
(if parents t helm-org-headings--nofilename)
parents))
filenames))) |
Jonathan Gregory [email protected] writes:
So that's not what your recipe showed, anyway I am here able to change BTW your recipe is not usable, please give me a recipe I can use.
If I change here min-depth and max-depth it works as expected, arguments Be sure to use lexical-binding though.
No, I meant in your code. |
Here example with screenshots: With actual code, I run As you can see all headings are there. And now I come back to test.org and I run again As you can see only heading with 2 level is shown. |
Thanks for the explanation, however you are missing my point (and BTW sorry for not being clear enough). This is what your last screenshot shows:
And this is what I am trying to accomplish (after changing the depth, of course):
If you change min and max-depth prior to d6c8b7c you should see that only level 2 is shown (without the parent headline). In any case, considering the size of the monitor, this becomes especially problematic when using long headlines. Lower level headlines are sometimes unreadable. One solution (just food for thought) would be to use an outline structure instead, similar to org, which IMO is a lot cleaner. So that this:
becomes this:
|
Jonathan Gregory [email protected] writes:
Ok I understand now,
Ok that's clear.
PR's welcome, but IMO the best structure to read org files is org |
Jonathan Gregory [email protected] writes:
I observe the same behavior after reverting all the changes I did |
That's strange. I was even able to reproduce it in Try this:
What do you see? |
* helm-org.el (helm-source-org-headings-for-files): Use nreverse. (helm-org-get-candidates): Use second arg of helm-flatten-list.
* helm-org.el (helm-org-get-candidates): Do it.
* helm-org.el (helm-org--get-candidates-in-file): Apply the args when parents is nil and not the contrary.
Jonathan Gregory [email protected] writes:
I finally was able to reproduce by stepping in all recents changes, it |
* helm-org.el (helm-source-org-capture-templates): Do it.
Thanks. It does work, but there's an issue with changing the depth back and forth, which I think could become a useful feature for cycling through headline levels. Anyhow, here's the problem. Add the following to your test.org file:
This is what I see:
Now, apart from the path which I think shouldn't be there, |
Jonathan Gregory [email protected] writes:
Indeed, is that new of this bug was reproductible in previous versions ? |
* helm-org.el (helm-org--get-candidates-in-file): Do it, num-stars and level are the same thing.
I wasn't able to reproduce with e42e3ed, which I believe is the version prior to when the depth issue was addressed. As you can see, the paths are correct:
|
* helm-org.el (helm-source-org-headings-for-files): Do it.
Changing |
No, this work for you with 2 and 2, but this is not what the original code
|
As I said, yes, your code does work when changing the source code directly and you are welcome to close this. Helm is tricky though. I haven't quite figured out how to create multiple
and eventually a function to cycle through the headline levels back and forth, which I think would make |
* helm-org.el (helm-org-format-outline-path): New user var. (helm-org-headings--nofilename): Removed. (helm-org-show-filename): New user var. (helm-org--get-candidates-in-file): Ensure window-with is called on helm-window (#1294). Use new user vars.
Closing now as all issues are now fixed, please see #1300 for further changes. |
Jonathan Gregory [email protected] writes:
You can now use helm-org-headings-min/max-depth, HTH.
Me too, it is now configurable and the default is no path.
Indeed. Thanks. |
See commits regarding emacs-helm/helm#1294
window-width
is used to determine the point for truncation but the function doesn't use the window width of the helm-window but that of the window in which helm was called.The text was updated successfully, but these errors were encountered: