Comments (2)
Hi,
Thanks for the feedback.
jumping to occurence in the buffer as you move through helm list (e.g. see gif). Is it possible in rifle? Perhaps I missed some setting to turn it on, but didn't manage to find.
That should be covered by helm-follow-mode
, which is a built-in feature of Helm that generally requires no special support by Helm sources. Try pressing C-c C-f
after candidates are displayed.
if you've got, say, two occurences of the search term on different lines under the same heading, swoop would show it twice on separate lines (as grep would), and I would be able to navigate with C-j/C-k between them. In contrast, org-rifle would only show you single line separated by the ellipsis. I've got something closer to what I want with (setq helm-org-rifle-ellipsis-string "\n"), but it still navigates between headings only. Would it be hard to implement, or it goes against the idea of what org-rifle is meant to do somehow?
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.
somewhat minor, but I also use swoop to search in non-org mode files (e.g. older notes from my pre-orgmode era, huge org-mode files which I open in fundamental mode, some random text files, etc). How hard do you think it would be to support fallback to swoop-like (grep-like) behaviour for non-org mode buffers?
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 helm
invocation. For example, in your command, take the list of files, map helm-org-rifle-get-source-for-file
for each Org file, and helm-c-source-multi-swoop
for non-Org files (see e.g. helm-multi-swoop--exec
).
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 org-ql
, which has a helm-org-ql
command. Its design is cleaner and more flexible, and it's much faster as well. By default, it doesn't show match context at all, but I'm experimenting with that in a branch. It would be much easier to implement your context-lines idea with org-ql
, because it would basically be a matter of adjusting the action function called at each match.
Eventually, org-rifle
will probably either be obsoleted by org-ql
or be rewritten to use org-ql
as a backend, so if you're interested in building some custom tools, I'd recommend basing them on org-ql
.
from org-rifle.
Thanks for a very comprehensive answer!
Follow mode works, I'll also take a look at multi source helm suggestion, that makes a lot of sense.
from org-rifle.
Related Issues (20)
- Changing value of helm-org-rifle-fontify-headings to nil causes helm-org-rifle-org-directory to stop working HOT 3
- org-narrow-to-subtree: prevents showing other parts of file, still shows from other files
- command-line client HOT 1
- Search gives up on small strings HOT 6
- Prioritising heading matches HOT 2
- Wrong number of arguments error with helm-org-rifle--refile HOT 1
- Req: Indication of status (progress, no results, which files have been searched?) HOT 1
- Req: Results in current file displayed first HOT 1
- helm-collect-matches error HOT 1
- Is there a way to do a exact match? HOT 1
- Disabling helm-org-rifle-fontify-headings breaks helm-org-rifle-agenda-files HOT 6
- helm-org-rifle-directories: how to add many directories? HOT 1
- Limit candidates to those with certain properties HOT 1
- Fix warning "Helm source <file>: after-init-hook Should be defined as a symbol HOT 1
- Docstring length warnings HOT 1
- Returned search results not always respecting sort order HOT 1
- Warning (emacs): ... after-init-hook Should be defined as a symbol HOT 5
- Opting out of v1.5.0 TODO keyword special handling HOT 4
- Not possible to move as always between the helm-org-rifle-agenda-files results HOT 1
- Hidden parent headings when using helm-org-rifle-current-buffer on collapsed hierarchies HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from org-rifle.