昨日、地元の大ドッチボール大会に参加したのだが、ドッチボールぐらいで全身筋肉痛になるのは、ちょっとなさけないかも。
(defvar migemo-dabbrev-pattern nil)
(defvar migemo-dabbrev-start-point nil)
(defvar migemo-dabbrev-search-point nil)
(defvar migemo-dabbrev-pre-patterns nil)
(defvar migemo-dabbrev-ol nil)
(defvar migemo-dabbrev-ol-face 'highlight)
(defun migemo-dabbrev-expand-done ()
(remove-hook 'pre-command-hook 'migemo-dabbrev-expand-done)
(when migemo-dabbrev-ol
(delete-overlay migemo-dabbrev-ol)))
(defun migemo-dabbrev-expand ()
(interactive)
(let ((end-pos (point))
matched-start matched-string)
(if (eq last-command this-command)
(goto-char migemo-dabbrev-search-point)
(goto-char (- end-pos 1))
(if (re-search-backward "[^a-z-]" (line-beginning-position) t)
(forward-char 1)
(beginning-of-line))
(setq migemo-dabbrev-start-point (point))
(setq migemo-dabbrev-search-point (point))
(setq migemo-dabbrev-pattern
(buffer-substring-no-properties (point) end-pos))
(setq migemo-dabbrev-pre-patterns nil))
(if (catch 'found
(while (if (> migemo-dabbrev-search-point migemo-dabbrev-start-point)
(and (migemo-forward migemo-dabbrev-pattern (point-max) t)
(setq migemo-dabbrev-search-point (match-end 0)))
(if (migemo-backward migemo-dabbrev-pattern (point-min) t)
(setq migemo-dabbrev-search-point (match-beginning 0))
(goto-char migemo-dabbrev-start-point)
(forward-word 1)
(message (format "Trun back for `%s'" migemo-dabbrev-pattern))
(and (migemo-forward migemo-dabbrev-pattern (point-max) t)
(setq migemo-dabbrev-search-point (match-end 0)))))
(setq matched-start (match-beginning 0))
(unless (re-search-forward ".\\>" (line-end-position) t)
(end-of-line))
(setq matched-string (buffer-substring-no-properties matched-start (point)))
(unless (member matched-string migemo-dabbrev-pre-patterns)
(let ((matched-end (point))
(str (copy-sequence matched-string))
lstart lend)
(if (and (pos-visible-in-window-p matched-start)
(pos-visible-in-window-p matched-end))
(progn
(if migemo-dabbrev-ol
(move-overlay migemo-dabbrev-ol matched-start (point))
(setq migemo-dabbrev-ol (make-overlay matched-start (point))))
(overlay-put migemo-dabbrev-ol 'evaporate t)
(overlay-put migemo-dabbrev-ol 'face migemo-dabbrev-ol-face))
(save-excursion
(save-restriction
(when migemo-dabbrev-ol
(delete-overlay migemo-dabbrev-ol))
(goto-char matched-start)
(setq lstart (progn (beginning-of-line) (point)))
(setq lend (progn (end-of-line) (point)))
(if (and (> emacs-major-version 20) (not (featurep 'xemacs)))
(put-text-property 0 (length str)
'face migemo-dabbrev-ol-face str)
(setq str (concat "【" str "】")))
(message "(%d): %s%s%s"
(count-lines (point-min) matched-start)
(buffer-substring-no-properties lstart matched-start)
str
(buffer-substring-no-properties matched-end lend))))))
(throw 'found t))
(goto-char migemo-dabbrev-search-point)))
(progn
(setq migemo-dabbrev-pre-patterns
(cons matched-string migemo-dabbrev-pre-patterns))
(delete-region migemo-dabbrev-start-point end-pos)
(forward-char 1)
(goto-char migemo-dabbrev-start-point)
(insert matched-string))
(goto-char end-pos)
(message (format "No dynamic expansion for `%s' found"
migemo-dabbrev-pattern)))
(add-hook 'pre-command-hook 'migemo-dabbrev-expand-done)))
何ヵ月か前に Ruby レシピブック 268の技 を購入してあって、ほんのちょっとだけ読んだのだが、昨日本棚を漁っていたら、奥の方からまったくページを開いた形跡のない Ruby レシピブック 268の技 が出てきた。
うーーん、いつどこで買ったのか全然覚えていない。。。。
というわけで、ご希望の方には綺麗な方を差し上げますので連絡下さい。
△ maru [呑みすけの郵便屋さん宛にもお返事があったりします。 Ruby ってどうです? 実は未だにほとんど触ったことがなかっ..]