]> code.delx.au - gnu-emacs-elpa/commitdiff
counsel.el (counsel--generic): Improve
authorOleh Krehel <ohwoeowho@gmail.com>
Sat, 27 Feb 2016 07:03:04 +0000 (08:03 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 27 Feb 2016 07:03:04 +0000 (08:03 +0100)
counsel.el

index c531367fcb08b7f0426783aed9806a6670ab25cc..e6a2bad7980ec0b77ecf95cdabb95853fd6226f3 100644 (file)
@@ -250,11 +250,10 @@ Update the minibuffer with the amount of lines collected every
 (declare-function cider-sync-request:complete "ext:cider-client")
 (defun counsel--generic (completion-fn)
   "Complete thing at point with COMPLETION-FN."
-  (let* ((bnd (bounds-of-thing-at-point 'symbol))
-         (str (if bnd
-                  (buffer-substring-no-properties
-                   (car bnd) (cdr bnd))
-                ""))
+  (let* ((bnd (or (bounds-of-thing-at-point 'symbol)
+                  (cons (point) (point))))
+         (str (buffer-substring-no-properties
+               (car bnd) (cdr bnd)))
          (candidates (funcall completion-fn str))
          (ivy-height 7)
          (res (ivy-read (format "pattern (%s): " str)