Skip to content

Commit

Permalink
New flag to prevent error in candidates fns.
Browse files Browse the repository at this point in the history
* helm.el (helm--ignore-errors): New.
(helm-internal): Reset it.
(helm-get-candidates):                            Use it.
* helm-files.el (helm-find-files-get-candidates): Use it.
  • Loading branch information
Thierry Volpiatto committed Jun 14, 2016
1 parent 7c4089c commit 678ccb4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions helm-files.el
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,9 @@ purpose."
invalid-basedir
non-essential
(tramp-verbose helm-tramp-verbose)) ; No tramp message when 0.
;; Tramp check if path is valid without waiting a valid
;; connection and may send a file-error.
(setq helm--ignore-errors (file-remote-p path))
(set-text-properties 0 (length path) nil path)
;; Issue #118 allow creation of newdir+newfile.
(unless (or
Expand Down
8 changes: 7 additions & 1 deletion helm.el
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,10 @@ because they are automatically added.
You should not modify this yourself unless you know what you are doing.")
;; Same as `ffap-url-regexp' but keep it here to ensure `ffap-url-regexp' is not nil.
(defvar helm--url-regexp "\\(news\\(post\\)?:\\|mailto:\\|file:\\|\\(ftp\\|https?\\|telnet\\|gopher\\|www\\|wais\\)://\\)")
(defvar helm--ignore-errors nil
"Flag to prevent helm popping up errors in candidates functions.
Should be set in candidates functions if needed, will be restored
at end of session.")

;; Utility: logging
(defun helm-log (format-string &rest args)
Expand Down Expand Up @@ -1941,6 +1945,7 @@ ANY-KEYMAP ANY-DEFAULT ANY-HISTORY See `helm'."
;; Reset helm-pattern so that lambda's using it
;; before running helm will not start with its old value.
(setq helm-pattern "")
(setq helm--ignore-errors nil)
(and old--cua (cua-mode 1))
(helm-log-save-maybe))))

Expand Down Expand Up @@ -2752,7 +2757,8 @@ Helm plug-ins are realized by this function."
;; Candidates will be filtered later in process filter.
candidates)
;; An error occured in candidates function.
(cfn-error (funcall notify-error cfn-error))
(cfn-error (unless helm--ignore-errors
(funcall notify-error cfn-error)))
;; Candidates function returns no candidates.
((or (null candidates)
;; Can happen when the output of a process
Expand Down

0 comments on commit 678ccb4

Please sign in to comment.