-
Notifications
You must be signed in to change notification settings - Fork 113
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-org-ql option to remove filename from query results #62
Comments
That would be fairly easy. The filename prefix is done here: https://github.com/alphapapa/org-ql/blob/master/helm-org-ql.el#L229 So you could easily redefine that function, or replace it with advice, in your config. After having added so many configuration options in So, generally, I'd like to do such customization in more flexible ways in this package. I'm not sure yet what those ways would be. Obviously, a user-defined function is one way, but requiring users to write Lisp code to do something like this is also not desirable. A format-spec formatter might be an option as well. Anyway, for your own needs, adjusting that function should do it. |
Here's the code to do that if anyone else wants this: (defun mh//helm-org-ql--heading (window-width)
"Return string for Helm for heading at point.
WINDOW-WIDTH should be the width of the Helm window."
(font-lock-ensure (point-at-bol) (point-at-eol))
(let* ((width window-width)
(path (-> (org-get-outline-path)
(org-format-outline-path width nil "�")
(org-split-string "�")))
(heading (org-get-heading t))
(path (if helm-org-ql-reverse-paths
(concat heading "\\" (s-join "\\" (nreverse path)))
(concat (s-join "/" path) "/" heading))))
(cons path (point-marker))))
(advice-add 'helm-org-ql--heading :override #'mh//helm-org-ql--heading) This does make me a little nervous, since I need to keep track of changes to the |
Don't worry, the only thing that matters is that the function returns a cons with the display string in the CAR and the marker in the CDR. That's not going to be changing anytime soon--probably never. |
Would it be feasible to add an option to suppress the filename from query results? I imagine the current behavior is best for most use cases. However, I do almost all of my queries in a single file and so, for me, the filename simply takes up horizontal real estate.
In case it's unclear what I'm asking, take the following example.
file:
current query:
proposed query:
The text was updated successfully, but these errors were encountered: