branch: master commit 340318dc9c9f9ce514e515dc5bddb16b0026a617 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
ivy-count-format must be an empty string instead of nil Using an empty string is easier. No longer needed to check for nil when using `string-match', `concat' etc. * doc/Changelog.org: Update. * ivy.el (ivy-count-format): Update doc and customize type. (ivy--reset-state): Error if `ivy-count-format' nil is encountered. Fixes #257 Re #188 --- doc/Changelog.org | 2 +- ivy.el | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/Changelog.org b/doc/Changelog.org index 0f5ac2c..94f122f 100644 --- a/doc/Changelog.org +++ b/doc/Changelog.org @@ -65,7 +65,7 @@ To have this feature, use something like this: #+end_src See [[https://github.com/abo-abo/swiper/pull/167][#167]]. -You can also set this to nil, if you don't want any count, see [[https://github.com/abo-abo/swiper/pull/188][#188]]. +You can also set this to "", if you don't want any count, see [[https://github.com/abo-abo/swiper/pull/188][#188]]. **** Allow to add additional exit points for any command Example for =ivy-switch-to-buffer=: #+begin_src elisp diff --git a/ivy.el b/ivy.el index 9aaaf72..71d80cd 100644 --- a/ivy.el +++ b/ivy.el @@ -72,11 +72,11 @@ (defcustom ivy-count-format "%-4d " "The style of showing the current candidate count for `ivy-read'. -Set this to nil if you don't want the count. You can also set it -to e.g. \"(%d/%d) \" if you want to see both the candidate index -and the candidate count." +Set this to \"\" if you don't want the count. You can also set +it to e.g. \"(%d/%d) \" if you want to see both the candidate +index and the candidate count." :type '(choice - (const :tag "Count disabled" nil) + (const :tag "Count disabled" "") (const :tag "Count matches" "%-4d ") (const :tag "Count matches and show current match" "(%d/%d) ") string)) @@ -1111,7 +1111,8 @@ This is useful for recursive `ivy-read'." (cond ((string-match "%.*d" prompt) prompt) ((null ivy-count-format) - nil) + (error + "`ivy-count-format' can't be nil. Set it to an empty string instead.")) ((string-match "%d.*%d" ivy-count-format) (let ((w (length (number-to-string (length ivy--all-candidates))))