琴浦さんモード

そんなにvimvimしちゃダメよ(コシコシコシ) - じゃ、ま、いっか


Vim版が既にありましたが、Emacs版も書いてみました。

;;; kotoura-san-mode.el --- koshi koshi koshi

;; Copyright (C) 2013 by Syohei YOSHIDA

;; Author: Syohei YOSHIDA <syohex@gmail.com>
;; URL:
;; Version: 0.01

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;;; Code:

(eval-when-compile
  (require 'cl))

(defgroup kotoura-san nil
  "Showing koshi-koshi on mode-line."
  :prefix "kotoura-san"
  :group 'frames)
 
(defface kotoura-san:face
  nil
  "Face for modeline"
  :group 'kotoura-san)
 
(defvar kotoura-san:koshi-koshi-pattern
  '(
    "(>ワ<≡)コシコシコシ"
    "(≡>ワ<)コシコシコシ"
    ))
 
(defvar kotoura-san:koshi-koshi-index 0)
 
(defun kotoura-san:update ()
  (let ((str (propertize (nth kotoura-san:koshi-koshi-index kotoura-san:koshi-koshi-pattern)
                         'face 'kotoura-san:face)))
    (setq global-mode-string str)
    (setq kotoura-san:koshi-koshi-index
          (mod (incf kotoura-san:koshi-koshi-index)
               (length kotoura-san:koshi-koshi-pattern)))))
 
;;;###autoload
(define-minor-mode kotoura-san-mode
  ""
  :global t :group 'kotoura-san
  (if kotoura-san-mode
      (add-hook 'post-command-hook 'kotoura-san:update)
    (progn
      (setq global-mode-string "")
      (remove-hook 'post-command-hook 'kotoura-san:update))))

(provide 'kotoura-san-mode)

;;; kotoura-san-mode.el ends here

イメージ

M-x kotoura-san-modeを実行すると有効になります。
あとはコマンド実行のたびに mode-lineでコシコシします。