Created
November 16, 2009 02:27
-
-
Save k1LoW/235654 to your computer and use it in GitHub Desktop.
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
;;;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