spacemacs/contrib/!lang/clojure/funcs.el
2015-05-25 00:50:38 -04:00

29 lines
1 KiB
EmacsLisp

;;; funcs.el --- Clojure Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defun clojure/fancify-symbols (mode)
"Pretty symbols for Clojure's anonymous functions and sets,
like (λ [a] (+ a 5)), ƒ(+ % 5), and ∈{2 4 6}."
(font-lock-add-keywords mode
`(("(\\(fn\\)[\[[:space:]]"
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "λ"))))
("(\\(partial\\)[\[[:space:]]"
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "Ƥ"))))
("\\(#\\)("
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "ƒ"))))
("\\(#\\){"
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "")))))))