Skip to content

Commit

Permalink
Enable follow-mode in wikipedia suggest (#467)
Browse files Browse the repository at this point in the history
* helm.el (helm-follow-input-idle-delay): New var, when bound following happen after this delay.
* helm-net.el (helm-wikipedia-suggest): Use it.
(helm-source-wikipedia-suggest): Enable follow.
  • Loading branch information
thierryvolpiatto committed Mar 30, 2014
1 parent 67a46ad commit 70fbdc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion helm-net.el
Expand Up @@ -439,6 +439,7 @@ Return an alist with elements like (data . number_results)."
candidate)))))
(persistent-action . helm-wikipedia-persistent-action)
(volatile)
(follow . 1)
(requires-pattern . 3)))


Expand Down Expand Up @@ -570,7 +571,9 @@ Return an alist with elements like (data . number_results)."
(defun helm-wikipedia-suggest ()
"Preconfigured `helm' for Wikipedia lookup with Wikipedia suggest."
(interactive)
(helm-other-buffer 'helm-source-wikipedia-suggest "*helm wikipedia*"))
(helm :sources 'helm-source-wikipedia-suggest
:buffer "*helm wikipedia*"
:follow-input-idle-delay 2))


(provide 'helm-net)
Expand Down
6 changes: 4 additions & 2 deletions helm.el
Expand Up @@ -4442,13 +4442,15 @@ This will enable `helm-follow-mode' automatically in `helm-source-buffers-list'.
(when (and helm-follow-mode-persistent sym)
(set (car `(,sym)) src)))))

(defvar helm-follow-input-idle-delay nil)
(defun helm-follow-execute-persistent-action-maybe ()
"Execute persistent action in mode `helm-follow-mode'.
This happen after `helm-input-idle-delay' secs."
(and (not (get-buffer-window helm-action-buffer 'visible))
(eq (assoc-default 'follow (helm-get-current-source)) 1)
(sit-for (and helm-input-idle-delay
(max helm-input-idle-delay 0.01)))
(sit-for (or helm-follow-input-idle-delay
(and helm-input-idle-delay
(max helm-input-idle-delay 0.01))))
(helm-window)
(helm-get-selection)
(save-excursion
Expand Down

0 comments on commit 70fbdc6

Please sign in to comment.