branch: master commit a0f1e25c632a219a8054932cdde860fc61c4e57b Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
ivy.el (ivy-completion-in-region): Fix log 0 issue --- ivy.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ivy.el b/ivy.el index b83c7b4..c70fa65 100644 --- a/ivy.el +++ b/ivy.el @@ -1382,19 +1382,19 @@ The previous string is between `ivy-completion-beg' and `ivy-completion-end'." (defun ivy-completion-in-region (start end collection &optional predicate) "An Ivy function suitable for `completion-in-region-function'." (let* ((str (buffer-substring-no-properties start end)) - (comps (all-completions str collection predicate)) - (w (1+ (floor (log (length comps) 10)))) - (ivy-count-format (format "%%-%dd " w))) + (comps (all-completions str collection predicate))) (if (null comps) (message "No matches") - (setq ivy-completion-beg start) - (setq ivy-completion-end end) - (and - (ivy-read (format "(%s): " str) comps - :predicate predicate - :action #'ivy-completion-in-region-action - :require-match t) - t)))) + (let* ((w (1+ (floor (log (length comps) 10)))) + (ivy-count-format (format "%%-%dd " w))) + (setq ivy-completion-beg start) + (setq ivy-completion-end end) + (and + (ivy-read (format "(%s): " str) comps + :predicate predicate + :action #'ivy-completion-in-region-action + :require-match t) + t))))) ;;;###autoload (define-minor-mode ivy-mode