├── README.md └── cljr-helm.el /README.md: -------------------------------------------------------------------------------- 1 | # clj-refactor-helm 2 | 3 | A Helm wrapper for the cljr features. 4 | 5 | Remembering key bindings for cljr is hard, especially the less 6 | frequently used ones - this should help with that. 7 | 8 | ## Usage 9 | 10 | This package is available in melpa as `cljr-helm`. So doing `M-x 11 | install-package RET cljr-helm` should get you what you need. 12 | 13 | Then add `(require 'cljr-helm)` to your init file, bind `cljr-helm` to 14 | a key (I'd suggest `C-c C-r`) in Clojure mode, and you're ready to go. 15 | -------------------------------------------------------------------------------- /cljr-helm.el: -------------------------------------------------------------------------------- 1 | ;;; cljr-helm.el --- Wraps clojure refactor commands with helm -*- coding: utf-8-unix -*- 2 | 3 | ;; Copyright (C) 2015 Phil Jackson 4 | 5 | ;; Author : Phil Jackson 6 | ;; URL : https://github.com/philjackson/cljr-helm 7 | ;; Version : 0.9 8 | ;; Keywords : helm, clojure, refactor 9 | ;; Package-Requires: ((clj-refactor "0.13.0") (helm-core "3.6.0") (cl-lib "0.5")) 10 | 11 | ;; This file is part of GNU Emacs. 12 | 13 | ;; GNU Emacs is free software: you can redistribute it and/or modify 14 | ;; it under the terms of the GNU General Public License as published by 15 | ;; the Free Software Foundation, either version 3 of the License, or 16 | ;; (at your option) any later version. 17 | 18 | ;; GNU Emacs is distributed in the hope that it will be useful, 19 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | ;; GNU General Public License for more details. 22 | 23 | ;; You should have received a copy of the GNU General Public License 24 | ;; along with GNU Emacs. If not, see . 25 | 26 | ;;; Commentary: 27 | 28 | ;; A Helm wrapper for the cljr features. 29 | 30 | ;; Remembering key bindings for cljr is hard, especially the less 31 | ;; frequently used ones - this should help with that. 32 | 33 | ;; This package is available in melpa as `cljr-helm`. So doing `M-x 34 | ;; install-package RET cljr-helm` should get you what you need. 35 | 36 | ;; Then add `(require 'cljr-helm)` to your init file, bind `cljr-helm` to 37 | ;; a key (I'd suggest `C-c C-r`) in Clojure mode, and you're ready to go. 38 | 39 | ;;; Code: 40 | 41 | (require 'helm-core) 42 | (require 'clj-refactor) 43 | 44 | (defun cljr-helm-candidates () 45 | (mapcar (lambda (c) 46 | (concat (car c) ": " (cl-second (cdr c)))) 47 | cljr--all-helpers)) 48 | 49 | (defvar helm-source-cljr 50 | '((name . "cljr functions hlel") 51 | (candidates . cljr-helm-candidates) 52 | (persistent-action . ignore) 53 | (action . (("Run" . (lambda (candidate) 54 | (string-match "^\\(.+?\\): " candidate) 55 | (call-interactively 56 | (cadr (assoc (match-string 1 candidate) cljr--all-helpers))))))))) 57 | 58 | ;;;###autoload 59 | (defun cljr-helm () 60 | (interactive) 61 | (helm-other-buffer 'helm-source-cljr "*cljr*")) 62 | 63 | (provide 'cljr-helm) 64 | 65 | ;;; cljr-helm.el ends here 66 | 67 | --------------------------------------------------------------------------------