doomemacs/modules/defuns/defuns-lisp.el

66 lines
1.8 KiB
EmacsLisp
Raw Normal View History

2015-11-24 03:44:17 -05:00
;;; defuns-lisp.el
2015-06-15 09:06:10 +02:00
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom/elisp-find-function-at-pt ()
2015-06-15 09:06:10 +02:00
(interactive)
(let ((func (function-called-at-point)))
(if func (find-function func))))
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom/elisp-find-function-at-pt-other-window ()
2015-06-15 09:06:10 +02:00
(interactive)
(let ((func (function-called-at-point)))
(if func (find-function-other-window func))))
2016-05-20 22:37:30 -04:00
(defun doom--ert-pre ()
2016-03-03 01:34:41 -05:00
(save-buffer)
(eval-buffer))
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom/ert-run-test ()
2016-03-03 01:34:41 -05:00
(interactive)
(let (case-fold-search)
2016-05-20 22:37:30 -04:00
(doom--ert-pre)
2016-03-03 01:34:41 -05:00
(aif (thing-at-point 'defun t)
(if (string-match "(ert-deftest \\([^ ]+\\)" it)
(ert-run-tests-interactively (substring it (match-beginning 1) (match-end 1)))
(user-error "Invalid test at point"))
(user-error "No test found at point"))))
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom/ert-rerun-test ()
2016-03-03 01:34:41 -05:00
(interactive)
(let (case-fold-search)
2016-05-20 22:37:30 -04:00
(doom--ert-pre)
2016-03-03 01:34:41 -05:00
(aif (car-safe ert--selector-history)
(ert-run-tests-interactively it)
(message "No test found in history, looking for test at point")
2016-05-20 22:37:30 -04:00
(doom/ert-run-test))))
2016-03-03 01:34:41 -05:00
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom/ert-run-all-tests ()
2016-03-03 01:34:41 -05:00
(interactive)
(ert-delete-all-tests)
2016-05-20 22:37:30 -04:00
(doom--ert-pre)
2016-03-03 01:34:41 -05:00
(ert-run-tests-interactively t))
2016-03-29 23:13:31 -04:00
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom/elisp-auto-compile ()
2016-04-08 15:40:19 -04:00
(when (let ((file-name (buffer-file-name)))
(and (f-exists? (f-expand (concat (f-base file-name) ".elc") (f-dirname file-name)))
(--any? (f-child-of? file-name it)
2016-05-20 22:37:30 -04:00
(append (list doom-core-dir doom-modules-dir
doom-core-dir doom-modules-dir
doom-private-dir)))))
(doom:compile-el)))
2016-03-29 23:13:31 -04:00
;;;###autoload
2016-05-20 22:37:30 -04:00
(defun doom/elisp-inf-ielm ()
2016-03-29 23:13:31 -04:00
(ielm)
(let ((buf (current-buffer)))
(bury-buffer)
(pop-to-buffer buf)))
2015-11-24 03:44:17 -05:00
(provide 'defuns-lisp)
;;; defuns-lisp.el ends here