Skip to content

Commit

Permalink
Make helm-force-update non-interactive.
Browse files Browse the repository at this point in the history
* helm.el (helm-map): Use helm-refresh instead of helm-force-update.
(helm-force-update): Improve docstring, no more interactive.
(helm-refresh): New, interactive.
  • Loading branch information
thierryvolpiatto committed Aug 24, 2015
1 parent 7a5aded commit d4b923b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions helm.el
Expand Up @@ -223,7 +223,7 @@ so don't use strings, vectors or whatever to define them."
(define-key map (kbd "C-c C-k") 'helm-kill-selection-and-quit)
(define-key map (kbd "C-c C-i") 'helm-copy-to-buffer)
(define-key map (kbd "C-c C-f") 'helm-follow-mode)
(define-key map (kbd "C-c C-u") 'helm-force-update)
(define-key map (kbd "C-c C-u") 'helm-refresh)
(define-key map (kbd "M-p") 'previous-history-element)
(define-key map (kbd "M-n") 'next-history-element)
(define-key map (kbd "C-!") 'helm-toggle-suspend-update)
Expand Down Expand Up @@ -3360,12 +3360,16 @@ is done on whole `helm-buffer' and not on current source."

(defun helm-force-update (&optional preselect)
"Force recalculation and update of candidates.
The difference with `helm-update' is this function is reevaling
the `init' and `update' attributes functions when present
before updating candidates according to pattern i.e calling `helm-update'.
before running `helm-update', also `helm-candidate-cache',
if some (async candidates are not cached)
is not reinitialized so that candidates are not recomputed
unless pattern have changed.
Selection is preserved to current candidate or moved to PRESELECT
if specified."
(interactive)
(let ((source (helm-get-current-source))
(selection (helm-get-selection nil t))
;; `helm-goto-source' need to have all sources displayed
Expand All @@ -3378,6 +3382,12 @@ if specified."
(helm-update (or preselect selection) source)
(with-helm-window (recenter))))

(defun helm-refresh ()
"Force recalculation and update of candidates."
(interactive)
(with-helm-alive-p
(helm-force-update)))

(defun helm-force-update--reinit (source)
"Reinit SOURCE by calling his update and/or init functions."
(helm-aif (helm-funcall-with-source
Expand Down

0 comments on commit d4b923b

Please sign in to comment.