spacemacs/layers/+lang/clojure/funcs.el
2016-01-11 21:42:17 -05:00

31 lines
1.1 KiB
EmacsLisp

;;; funcs.el --- Clojure Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2016 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) "Ƥ"))))
("(\\(comp\\)[\[[: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) "")))))))