Skip to content

Instantly share code, notes, and snippets.

@stew
Created August 4, 2013 00:35
Show Gist options
  • Save stew/6148551 to your computer and use it in GitHub Desktop.
Save stew/6148551 to your computer and use it in GitHub Desktop.
Fancy unicode arrows for emacs scala-mode. Done this way because I don't think it can work as an abbrev.
(defun right-arrow ()
(interactive)
(cond ((looking-back "=")
(backward-delete-char 1) (insert "⇒"))
((looking-back "-")
(backward-delete-char 1) (insert "→"))
(t (insert ">"))))
(defun left-arrow ()
(interactive)
(if (looking-back "<")
(progn (backward-delete-char 1)
(insert "←"))
(insert "-")))
(add-hook 'scala-mode-hook '(lambda () (interactive)
(local-set-key (kbd "-") 'left-arrow)
(local-set-key (kbd ">") 'right-arrow)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment