doomemacs/init/init-lisp.el

37 lines
1.1 KiB
EmacsLisp
Raw Normal View History

2015-01-09 21:47:51 -05:00
;; Elisp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2014-12-05 17:28:03 -05:00
(defun remove-elc-on-save ()
"If you're saving an elisp file, likely the .elc is no longer valid."
(make-local-variable 'after-save-hook)
2015-01-09 21:47:51 -05:00
(add-hook! 'after-save-hook
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c")))))
2014-12-05 17:28:03 -05:00
2015-01-09 21:47:51 -05:00
(add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
2014-12-05 17:28:03 -05:00
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
2014-12-07 15:05:25 -05:00
(evil-define-operator my:elisp-eval (beg end)
:move-point nil
(interactive "<r>")
(cond ((and beg end)
(eval-region beg end))
(t (eval-buffer))))
2014-12-05 17:28:03 -05:00
;; Real go-to-definition for elisp
(bind 'motion emacs-lisp-mode-map "gd"
(λ (let ((func (function-called-at-point)))
(if func (find-function func)))))
;; Go-to-definition in other buffer
(bind 'motion emacs-lisp-mode-map "gD"
(λ (let ((func (function-called-at-point)))
(if func (find-function-other-window func)))))
2014-12-07 15:05:25 -05:00
2015-05-03 01:49:17 -04:00
(bind 'motion emacs-lisp-mode-map "gr" 'my:elisp-eval)
2014-12-12 15:35:58 -05:00
2015-01-09 21:47:51 -05:00
;; TODO Add clojure support
;; TODO Add scheme support
2014-12-12 15:35:58 -05:00
2015-01-09 21:47:51 -05:00
(provide 'init-lisp)
2014-12-12 15:35:58 -05:00
;;; init-elisp.el ends here