Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Making helm-org-rifle behaviour closer to helm-swoop? #42
I've been using helm-swoop for a while to search through my plaintext notes.
There are few things I would miss from helm-swoop (I was testing on
Thanks for the feedback.
That should be covered by
That basically is contrary to the design of org-rifle. Results are intended to be presented similar to a Web search engine, with the heading being like a Web page title and showing matching context strings below. The jump-to commands jump to entry headings, not to matching terms within an entry.
Doing it the way you explained would be an interesting feature. If you're interested in working on that feature, I'd be willing to consider patches. The code isn't particularly elegant, and it would require some refactoring here and there to support both modes. I've learned a lot since I made org-rifle, so if I were doing it over again (see below), I'd probably do it in a more flexible, functional way.
Given the rather inelegant and inflexible state of the code, it would require changes and refactoring in several places. It would probably be pretty messy. I don't think I'd want to do that, because the purpose of the package is searching Org files, and that would add complexity that doesn't serve that purpose.
However, I don't think you need to modify this package to achieve that, because you should be able to do something like that by combining Helm sources in a single
For example, using my helm-swish package (faster but less featureful than helm-swoop), I came up with this, which seems to work:
(defun kc/org-rifle-swish (files) "Search FILES with `helm-org-rifle' and `helm-swish'." (interactive) (let ((sources (--map (pcase it ((rx ".org" eos) (helm-org-rifle-get-source-for-file it)) (_ (let ((buffer (or (find-buffer-visiting it) (find-file-noselect it)))) (helm-make-source (buffer-name buffer) 'helm-source-swish :action (helm-make-actions "Go to line" #'helm-swish-goto-line) :get-line #'helm-swish-get-line)))) files))) (helm :sources sources)))
Used like this, it searches these two files, one of which is an Org file:
(kc/org-rifle-swish '("~/org/main.org" "~/src/emacs/org-ql/org-ql.el"))
By the way, as I said, I've learned a lot since I made org-rifle, and in the process I've made