clojure-emacs / clj-refactor.el

A CIDER extension that provides powerful commands for refactoring Clojure code.
GNU General Public License v3.0
771 stars 111 forks source link

Question: how to install `clj-refactor` via `use-package` declaration instead of imperative `package-install`? #534

Closed pdelfino closed 1 year ago

pdelfino commented 1 year ago

Hi,

I know the documented way of installing this package is:

(require 'clj-refactor)

(defun my-clojure-mode-hook ()
    (clj-refactor-mode 1)
    (yas-minor-mode 1) ; for adding require/use/import statements
    ;; This choice of keybinding leaves cider-macroexpand-1 unbound
    (cljr-add-keybindings-with-prefix "C-c C-m"))

(add-hook 'clojure-mode-hook #'my-clojure-mode-hook)

I would like to install it with use-package. I tried:

;; Install cider to start a REPL directly in Clojure
(use-package clj-refactor
  :ensure t)

(require 'clj-refactor)

(defun my-clojure-mode-hook ()
    (clj-refactor-mode 1)
    (yas-minor-mode 1) ; for adding require/use/import statements
    ;; This choice of keybinding leaves cider-macroexpand-1 unbound
    (cljr-add-keybindings-with-prefix "C-c C-m"))

(add-hook 'clojure-mode-hook #'my-clojure-mode-hook)

But, it did not work out. I am using this on macOS Monterey 12.5

pdelfino commented 1 year ago

Actually, the code below worked out.

;; Install cider to start a REPL directly in Clojure
(use-package clj-refactor
  :ensure t)  

There is a problem in my init file. Thus, I am closing the issue

vemv commented 1 year ago

Cheers, hope you have a good experience with clj-refactor!