Skip to content

Instantly share code, notes, and snippets.

@pelagisk
Created April 5, 2012 15:11
Show Gist options
  • Save pelagisk/2311852 to your computer and use it in GitHub Desktop.
Save pelagisk/2311852 to your computer and use it in GitHub Desktop.
Vim-cute-python adaptation for emacs?
(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