diff options
author | Bozhidar Batsov <bozhidar@tradeo.com> | 2014-09-02 14:34:02 +0300 |
---|---|---|
committer | Bozhidar Batsov <bozhidar@tradeo.com> | 2014-09-02 14:34:02 +0300 |
commit | 08a41d280d6c443520d186b56d3e2a8e6faa6bc3 (patch) | |
tree | e8a59f2d3e09748e6d0db8d372e74e9542e205cc /cider-classpath.el | |
parent | c1018ad0a5b0e0fda6fcd3ce1f3eb1994eb1d8fa (diff) |
Add command cider-open-classpath-entry
Diffstat (limited to 'cider-classpath.el')
-rw-r--r-- | cider-classpath.el | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/cider-classpath.el b/cider-classpath.el index 1cf430e9..183ddba5 100644 --- a/cider-classpath.el +++ b/cider-classpath.el @@ -72,28 +72,36 @@ (let* ((bol (line-beginning-position)) (eol (line-end-position)) (line (buffer-substring-no-properties bol eol))) - (if (file-directory-p line) - (dired line) - (find-file-other-window line)))) + (find-file-other-window line))) (defun cider-classpath-handle-mouse (event) "Handle mouse click EVENT." (interactive "e") (cider-classpath-operate-on-point)) +(defun cider--classpath-entries () + "Return a list of classpath entries." + (plist-get + (nrepl-send-sync-request (list "op" "classpath" + "session" (nrepl-current-session))) + :value)) + ;;;###autoload (defun cider-classpath () "List all classpath entries." (interactive) (with-current-buffer (cider-popup-buffer cider-classpath-buffer t) - (let ((names (plist-get - (nrepl-send-sync-request (list "op" "classpath" - "session" (nrepl-current-session))) - :value))) - (cider-classpath-list (current-buffer) - (mapcar (lambda (name) - (cider-classpath-properties name)) - names))))) + (cider-classpath-list (current-buffer) + (mapcar (lambda (name) + (cider-classpath-properties name)) + (cider--classpath-entries))))) + +;;;###autoload +(defun cider-open-classpath-entry () + "Open a classpath entry." + (interactive) + (-when-let (entry (completing-read "Classpath entries: " (cider--classpath-entries))) + (find-file-other-window entry))) (defvar cider-classpath-mouse-map (make-sparse-keymap)) (define-key cider-classpath-mouse-map [mouse-1] 'cider-classpath-handle-mouse) |