diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2018-06-05 20:46:20 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2018-06-05 20:46:20 +0200 |
commit | 8fcb6a508b1802b9dbe88c8fa94bc4527e32f125 (patch) | |
tree | fcbcf3777154f35989e58971119dff6fb35f2ef7 /helm.el | |
parent | cd0f52aebdfcfd88b038aaf9f5d3f75b036df116 (diff) |
Check existence of helm-buffer (#2056)
This fixes an old error rarely reproductible:
error: "No buffer named *helm*"
* helm.el (helm-funcall-foreach): Do it.
Diffstat (limited to 'helm.el')
-rw-r--r-- | helm.el | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -2027,11 +2027,15 @@ Return the result of last function call." (defun helm-funcall-foreach (sym &optional sources) "Call the associated function(s) to SYM for each source if any." (let ((sources (or (helm-get-sources sources) - ;; `helm-sources' are local to helm-buffer. - (with-helm-buffer helm-sources)))) - (cl-dolist (source sources) - (helm-aif (assoc-default sym source) - (helm-funcall-with-source source it))))) + ;; Fix error no buffer named *helm... by checking + ;; if helm-buffer exists. + (and (buffer-live-p (get-buffer (helm-buffer-get))) + ;; `helm-sources' are local to helm-buffer. + (with-helm-buffer helm-sources))))) + (when sources + (cl-dolist (source sources) + (helm-aif (assoc-default sym source) + (helm-funcall-with-source source it)))))) (defun helm-normalize-sources (sources) "If SOURCES is only one source, make a list of one element." |