"modeless helm", to enable commands like next/previous-error

17 views
Skip to first unread message

Sameer Sahasrabuddhe

unread,
Sep 18, 2016, 5:32:06 AM9/18/16
to emacs-helm
Hi all,

I have created a new package called "helm-modeless", which allows the user to interact with the last helm-buffer without resuming a helm session:

https://github.com/sameerds/helm-modeless

The most common use-case is that if you invoke next-error "M-g n" or previous-error "M-g p" after a successful helm-grep session, then it will take you to the next candidate immediately with no further interaction. It also updates the state of the "*helm grep*" buffer so that if you resume that session, then the selected candidate will be wherever you last reached with your next/previous commands.

This is mostly a proof-of-concept to show that such an interaction is possible. It only works with grep for now, but I want to make it work for occur too. I am also looking for more ways in which an external package can interact with a helm-buffer, but I am limited by my lack of imagination. If there are use-cases beyond grep and occur, then I definitely want to hear about them.

The whole thing works by making use of after-init-hook in the source to bind next-error-function to a custom function. And that's it ... then when you exit a helm-grep session, the helm-buffer is available for next/previous-error interaction.

Issues:
1. I had to copy some internal helm functions to make them work without an active helm-session. They are not perfect yet, and happen to be good enough for a simple use with the "*helm grep*" buffer. Perhaps there is a way to refactor these inside helm source itself.

2. Just like follow-mode, setting source properties is a bit awkward. It will be easier if the after-init-hook is exposed as a defvar in the source, so that anyone can bind to it. I will submit a pull request to make that happen later.

Sameer.

Sameer Sahasrabuddhe

unread,
Aug 12, 2017, 6:22:58 AM8/12/17
to emacs-helm
Hi all,

Resurrecting this topic after almost a year! Retained the entire original email for reference ... finally got a chance to iron out all the wrinkles, so that it works pretty well now!

helm-modeless is a small package that makes it easy to use "M-g n" (next-error) and "M-g p" (previous-error) with helm-grep and helm-occur, just like the non-helm versions. Essentially, after a successful helm-grep session, you can move between candidates using the above bindings without having to resume helm. These new functions track the state in the helm buffer correctly so that a subsequent resume will start from your new position.

https://github.com/sameerds/helm-modeless

Please do provide feedback!

Sameer.

rsw...@gmail.com

unread,
Sep 21, 2017, 11:36:49 AM9/21/17
to emacs-helm
Good idea.  I think there is a broader idea here.  Right now, a helm session is alive only when the minibuffer is active and Thierry considers the state of helm buffers outside of this to be dead and unusable.  But an expanded helm framework could allow for interaction with helm completion items and their associated actions when the minibuffer is not active, providing more of a direct manipulation paradigm.  In such a model, the concept of session would be bound to the buffer with an associated keymap.  All the actions are already tied to text properties in the buffer.  The concept would be applying actions to candidates that have already been filtered and that now you want to work on.  None of the timer-based functionality of helm need be available in this mode, so implementing it could be a lot simpler.  Maybe it is just a matter of producing a subset API from helm and associated mode that applies actions to helm candidates whether or not the minibuffer is active.

Do other people see use cases for applying actions to helm candidates when the minibuffer is not active?  Let's have a discussion of the pros and cons and see whether or not there are good ideas to be had.

Bob
Reply all
Reply to author
Forward
0 new messages