Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
76 lines (59 sloc) 2.44 KB
;;; starter-kit-lisp.el --- Some helpful Lisp code
;; Part of the Emacs Starter Kit
(define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol)
(define-key lisp-mode-shared-map (kbd "C-c l") "lambda")
(define-key lisp-mode-shared-map (kbd "RET") 'reindent-then-newline-and-indent)
(define-key lisp-mode-shared-map (kbd "C-\\") 'lisp-complete-symbol)
(define-key lisp-mode-shared-map (kbd "C-c v") 'eval-buffer)
(defface esk-paren-face
'((((class color) (background dark))
(:foreground "grey50"))
(((class color) (background light))
(:foreground "grey55")))
"Face used to dim parentheses."
:group 'starter-kit-faces)
;;; Emacs Lisp
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(add-hook 'emacs-lisp-mode-hook 'esk-remove-elc-on-save)
(defun esk-remove-elc-on-save ()
"If you're saving an elisp file, likely the .elc is no longer valid."
(make-local-variable 'after-save-hook)
(add-hook 'after-save-hook
(lambda ()
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c"))))))
(define-key emacs-lisp-mode-map (kbd "M-.") 'find-function-at-point)
;;; Clojure
(eval-after-load 'find-file-in-project
'(add-to-list 'ffip-patterns "*.clj"))
(defun clojure-project ()
(message "Deprecated in favour of M-x swank-clojure-project. Install swank-clojure from ELPA."))
;;; Enhance Lisp Modes
(eval-after-load 'paredit
;; need a binding that works in the terminal
'(define-key paredit-mode-map (kbd "M-)") 'paredit-forward-slurp-sexp))
(dolist (x '(scheme emacs-lisp lisp clojure))
(when window-system
(intern (concat (symbol-name x) "-mode"))
'(("(\\|)" . 'esk-paren-face))))
(intern (concat (symbol-name x) "-mode-hook")) 'turn-on-paredit)
(intern (concat (symbol-name x) "-mode-hook")) 'run-coding-hook))
(eval-after-load 'clojure-mode
'clojure-mode `(("(\\(fn\\>\\)"
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "ƒ")
(eval-after-load 'slime
'(define-key slime-mode-map (kbd "C-c p")
(eval-after-load 'slime-repl
'(define-key slime-repl-mode-map (kbd "C-c p")
(provide 'starter-kit-lisp)
;; starter-kit-lisp.el ends here