helm-occur with follow-mode as a replacement for isearch

42 views
Skip to first unread message

Sameer Sahasrabuddhe

unread,
Aug 31, 2016, 2:17:55 PM8/31/16
to emacs-helm

Here's a little hook that I wrote. The intention is that when follow-mode is enabled, the persistent action should also be invoked every time the list of candidates changes, i.e., when it is created for the first time, and again whenever the user enters additional patterns.

For example, this makes helm-occur behave a bit more like isearch, and my goal is to replace isearch with helm-occur. The only remaining thing is that the candidate selected by default should be the first one that follows point.

(defun helm-follow-mode-enabled-for-current-source ()
  (let ((src (helm-get-current-source)))
    (and (or (eq (assoc-default 'follow src) 1)
         (and helm-follow-mode-persistent
          (member (assoc-default 'name src)
              helm-source-names-using-follow)))
     (null (eq (assoc-default 'follow src) 'never)))))

(defun my-persistent-action-on-update ()
    (when (helm-follow-mode-enabled-for-current-source)
      (helm-execute-persistent-action))))

(add-hook 'helm-after-update-hook 'my-persistent-action-on-update)

Sameer.

Thierry Volpiatto

unread,
Aug 31, 2016, 2:51:57 PM8/31/16
to emacs...@googlegroups.com

Sameer Sahasrabuddhe <same...@gmail.com> writes:

> Here's a little hook that I wrote. The intention is that when
> follow-mode is enabled, the persistent action should also be invoked
> every time the list of candidates changes, i.e., when it is created
> for the first time, and again whenever the user enters additional
> patterns.

I guess you use a old version of helm, last helm is doing what you want.

--
Thierry
Reply all
Reply to author
Forward
0 new messages