[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c14ceac 245/348: Add support for counsel-find-library
From: |
Oleh Krehel |
Subject: |
[elpa] master c14ceac 245/348: Add support for counsel-find-library |
Date: |
Sat, 8 Apr 2017 11:04:06 -0400 (EDT) |
branch: master
commit c14ceac5fb64b013f3f91c0798baf3166e68555f
Author: Michael Olson <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add support for counsel-find-library
* This is a helpful and unsurprising alternative to using C-. with
counsel-load-library
* Extract counsel-library-candidates which is used by both
counsel-load-library and
counsel-find-library
* Use counsel-find-library in place of counsel-load-library in the docs, in
order to better match
the feel of the surrounding keybindings, which are all locate-based
rather than mutate-based.
Fixes #794
Fixes #801
---
README.md | 2 +-
counsel.el | 28 +++++++++++++++++++++++-----
doc/ivy.org | 2 +-
doc/ivy.texi | 2 +-
4 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 0581421..f672ede 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ Ivy and Swiper wiki is here: [the
wiki](https://github.com/abo-abo/swiper/wiki).
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
-(global-set-key (kbd "<f1> l") 'counsel-load-library)
+(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
diff --git a/counsel.el b/counsel.el
index 2d7bdc3..15703cc 100644
--- a/counsel.el
+++ b/counsel.el
@@ -702,10 +702,8 @@ Optional INITIAL-INPUT is the initial input in the
minibuffer."
:caller 'counsel-M-x)))
;;** `counsel-load-library'
-;;;###autoload
-(defun counsel-load-library ()
- "Load a selected the Emacs Lisp library.
-The libraries are offered from `load-path'."
+(defun counsel-library-candidates ()
+ "Return a list of completion candidates for `counsel-load-library'."
(interactive)
(let ((dirs load-path)
(suffix (concat (regexp-opt '(".el" ".el.gz") t) "\\'"))
@@ -744,12 +742,31 @@ The libraries are offered from `load-path'."
'full-name (expand-file-name file dir))
dir) cands)))))))
(maphash (lambda (_k v) (push (car v) res)) cands)
- (ivy-read "Load library: " (nreverse res)
+ (nreverse res)))
+
+;;;###autoload
+(defun counsel-load-library ()
+ "Load a selected the Emacs Lisp library.
+The libraries are offered from `load-path'."
+ (interactive)
+ (let ((cands (counsel-library-candidates)))
+ (ivy-read "Load library: " cands
:action (lambda (x)
(load-library
(get-text-property 0 'full-name x)))
:keymap counsel-describe-map)))
+;;** `counsel-find-library'
+;;;###autoload
+(defun counsel-find-library ()
+ "Visit a selected the Emacs Lisp library.
+The libraries are offered from `load-path'."
+ (interactive)
+ (let ((cands (counsel-library-candidates)))
+ (ivy-read "Find library: " cands
+ :action #'counsel--find-symbol
+ :keymap counsel-describe-map)))
+
;;** `counsel-load-theme'
(declare-function powerline-reset "ext:powerline")
@@ -2641,6 +2658,7 @@ And insert it into the minibuffer. Useful during
(describe-function . counsel-describe-function)
(describe-variable . counsel-describe-variable)
(find-file . counsel-find-file)
+ (find-library . counsel-find-library)
(imenu . counsel-imenu)
(load-library . counsel-load-library)
(load-theme . counsel-load-theme)
diff --git a/doc/ivy.org b/doc/ivy.org
index 86099da..71cf03d 100644
--- a/doc/ivy.org
+++ b/doc/ivy.org
@@ -248,7 +248,7 @@ The recommended key bindings are:
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
- (global-set-key (kbd "<f1> l") 'counsel-load-library)
+ (global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
#+end_src
diff --git a/doc/ivy.texi b/doc/ivy.texi
index 445627b..956fdcc 100644
--- a/doc/ivy.texi
+++ b/doc/ivy.texi
@@ -343,7 +343,7 @@ The recommended key bindings are:
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
- (global-set-key (kbd "<f1> l") 'counsel-load-library)
+ (global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
@end lisp
- [elpa] master f6bd64b 164/348: ivy.el (ivy--flx-featurep): New defvar, (continued)
- [elpa] master f6bd64b 164/348: ivy.el (ivy--flx-featurep): New defvar, Oleh Krehel, 2017/04/08
- [elpa] master fc5c8fc 159/348: Fix ivy-occur-press for swiper, Oleh Krehel, 2017/04/08
- [elpa] master e98883f 162/348: Improve fuzzy swiper highlight, Oleh Krehel, 2017/04/08
- [elpa] master 9b28927 187/348: counsel.el (counsel-hydra-heads): Fixup, Oleh Krehel, 2017/04/08
- [elpa] master 00219da 181/348: Fix for older Emacs, Oleh Krehel, 2017/04/08
- [elpa] master 8f87f74 178/348: counsel.el (counsel-git-grep): Update for Windows, Oleh Krehel, 2017/04/08
- [elpa] master 79105a5 208/348: counsel.el (counsel-info-lookup-symbol): Add preselect, Oleh Krehel, 2017/04/08
- [elpa] master 222a5e6 217/348: ivy.el (ivy--virtual-buffers): Move to silence compiler, Oleh Krehel, 2017/04/08
- [elpa] master 35b5d29 230/348: New example to show how to associate values, Oleh Krehel, 2017/04/08
- [elpa] master e9c274a 236/348: Allow to customize ivy-display-function per caller, Oleh Krehel, 2017/04/08
- [elpa] master c14ceac 245/348: Add support for counsel-find-library,
Oleh Krehel <=
- [elpa] master ca84f24 269/348: Add highlighter function configuration to ivy, Oleh Krehel, 2017/04/08
- [elpa] master 5701444 314/348: ivy.el (ivy-occur-revert-buffer): Restore ivy-occur-last, Oleh Krehel, 2017/04/08
- [elpa] master 13def15 318/348: ivy.el (ivy-case-fold-search): Add additional value 'always, Oleh Krehel, 2017/04/08
- [elpa] master 54c5447 319/348: counsel.el (counsel-grep-function): Add shell-quote-argument, Oleh Krehel, 2017/04/08
- [elpa] master bf8dc5f 326/348: Make swiper-avy work with more regexp builders, Oleh Krehel, 2017/04/08
- [elpa] master 03f90af 324/348: ivy.el (ivy-rotate-sort): Guard against nil sort, Oleh Krehel, 2017/04/08
- [elpa] master ac944ea 325/348: ivy.el: Remove with-ivy-window, Oleh Krehel, 2017/04/08
- [elpa] master 18da759 320/348: ivy.el: Remove ivy--current, Oleh Krehel, 2017/04/08
- [elpa] master 20744aa 337/348: doc/Changelog.org: Prepare for 0.9.0, Oleh Krehel, 2017/04/08
- [elpa] master 13a3f2d 342/348: doc/Changelog.org: Sort stuff, Oleh Krehel, 2017/04/08