Skip to content

Commit

Permalink
prettier functions in Clojure -- with an eye towards point-free progr…
Browse files Browse the repository at this point in the history
…amming
  • Loading branch information
eschulte committed Nov 16, 2010
1 parent 364bcf2 commit 7e1aa92
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions starter-kit-lisp.org
Expand Up @@ -18,19 +18,19 @@ Support for editing list dialects including [[* Emacs Lisp][Emacs Lisp]], [[* Sc
#+end_src

** Paredit
[[http://www.emacswiki.org/emacs/ParEdit][Paredit]] might seem weird at first, but it really makes writing lisp a
much more comfortable experience. This is especially useful in
combination with the sexp movement functions (=C-M-f= forward, =C-M-b=
back, =C-M-u= up, =C-M-d= down)
[[http://www.emacswiki.org/emacs/ParEdit][Paredit]] might seem weird at first, but it really makes writing lisp a
much more comfortable experience. This is especially useful in
combination with the sexp movement functions (=C-M-f= forward, =C-M-b=
back, =C-M-u= up, =C-M-d= down)

#+begin_src emacs-lisp
(defun turn-on-paredit ()
(paredit-mode +1))
#+end_src

: ;; (eval-after-load 'paredit
: ;; ;; Not sure why paredit behaves this way with comments; it's annoying
: ;; '(define-key paredit-mode-map (kbd ";") 'self-insert-command))
: ;; (eval-after-load 'paredit
: ;; ;; Not sure why paredit behaves this way with comments; it's annoying
: ;; '(define-key paredit-mode-map (kbd ";") 'self-insert-command))

** Non-obtrusive parenthesis faces
#+begin_src emacs-lisp
Expand Down Expand Up @@ -153,14 +153,24 @@ Kills existing SLIME session, if any."
(slime)))
#+end_src

pretty \lambda's in clojure
Prettier function names in clojure -- Thanks to Paul Hobbs for the
idea to extend this feature beyond simply the =fn= function.
#+begin_src emacs-lisp
;; symbols for some overlong function names
(eval-after-load 'clojure-mode
'(font-lock-add-keywords
'clojure-mode `(("(\\(fn\\>\\)"
(0 (progn (compose-region (match-beginning 1)
(match-end 1) "ƒ")
nil))))))
'clojure-mode
(mapcar
(lambda (pair)
`(,(car pair)
(0 (progn (compose-region
(match-beginning 0) (match-end 0)
,(cadr pair))
nil))))
`(("\\<fn\\>" ,(make-char 'greek-iso8859-7 107))
("\\<comp\\>" ?∘)
("\\<partial\\>" ?þ)
("\\<complement\\>" ?¬)))))
#+end_src

** Scheme
Expand Down

0 comments on commit 7e1aa92

Please sign in to comment.