emacs

Consider also joining #cider, #lsp and #inf-clojure, where most of the tool-specific discussions are happening.
Illia Danko 2021-02-20T13:02:56.002Z

Good day dear Clojurians. I have the hard time straggling of passing elisp keymap to a custom function. I expect that after major mode has loaded (in my case it’s clojure-mode) my new keybindings become available, but they don’t:

;;; Settings.
(straight-use-package 'paredit)

(defun my/shared-lisp-mode-hook ()
  (require 'paredit)
  (my/vim-paredit-init clojure-mode-map))

;;; Clojure.
(straight-use-package 'cider)

;; This doesn't work.
(defun my/vim-paredit-init (map)
  (evil-define-key 'normal map (kbd "<localleader>r") #'paredit-raise-sexp))

;; This works, but not what I want.
;; (defun my/vim-paredit-init (map)
;;   (evil-define-key 'normal clojure-mode-map (kbd "<localleader>r") #'paredit-raise-sexp))


(defun my/clojure-mode-hook ()
  (my/shared-lisp-mode-hook))
  
(add-hook 'clojure-mode-hook #'my/clojure-mode-hook)
I know I miss something conceptual and trivial, but couldn’t come up to any, but duplicating paredit key bindings for all major modes: elisp, clojure, which I want to avoid...

AC 2021-02-20T19:03:21.003Z

I can’t easily test it here, but I would guess you need to call my/vim-paredit-init with a quoted arg --

(my/vim-paredit-init 'clojure-mode-map)

Illia Danko 2021-02-20T20:10:23.003200Z

I’ve tried, doesn’t work