Skip to content

Instantly share code, notes, and snippets.

@k1LoW
Created November 16, 2009 02:27
Show Gist options
  • Save k1LoW/235654 to your computer and use it in GitHub Desktop.
Save k1LoW/235654 to your computer and use it in GitHub Desktop.
;;;smartchr.el
;;http://d.hatena.ne.jp/IMAKADO/20080913/1221328814
(eval-when-compile (require 'cl))
(defun smartchr (list-of-string)
(lexical-let ((los list-of-string)
(last-word "")
(count 0))
(lambda ()
(interactive)
(if (eq this-command real-last-command)
(incf count)
(setq count 0))
(when (>= count (length los))
(setq count 0))
(let ((word (nth count los)))
(when (eq this-command real-last-command)
(delete-backward-char (length last-word)))
(setq last-word word)
(insert word)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment