Created
April 5, 2012 15:11
-
-
Save pelagisk/2311852 to your computer and use it in GitHub Desktop.
Vim-cute-python adaptation for emacs?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun cute-python () | |
(interactive) | |
(remove-overlays) | |
(let ( | |
(strings '( | |
(" != " . " ≢ ") | |
(" in " . " ∈ ") | |
(" or " . " ∨ ") | |
(" and " . " ∧ ") | |
(" is not " . " ¬ ") | |
(" not in " . " ∉ ") | |
(" <= " . " ≤ ") | |
(" >= " . " ≥ ") | |
(" === " . " ≡ ") | |
(" sum " . "∑") | |
("math.sqrt" . "√") | |
("math.pi" . "π") | |
("lambda" . "λ") | |
))) | |
(dolist (string strings) | |
(save-excursion | |
(catch 'break | |
(while (< (point) (point-max)) | |
(let ( | |
(end (ignore-errors (search-forward (car string)))) | |
(start (match-beginning 0))) | |
(if end | |
(progn | |
(let ((ol (make-overlay start end))) | |
(overlay-put ol 'display (cdr string)))) | |
(throw 'break nil))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment