- 241 名前:名無しさん@お腹いっぱい。 mailto:sage [2008/01/22(火) 01:13:18 ID:EE4jzfJx0]
- >>240
こんな感じ? (defvar *insert-parenthesis-list* nil) (setq *insert-parenthesis-list* `(("foo(&F)" "<a>" "</a>") ("bar(&B)" "¥ruby{" "}{ }") )) (defun insert-parenthesis-1 (from to head tail) (goto-char from) (insert head) (goto-char (+ to (length head))) (insert tail)) (defun insert-parenthesis () (interactive) (and (pre-selection-p) (consp *insert-parenthesis-list*) (let ((from (selection-mark)) (to (selection-point)) (menu (create-popup-menu))) (when (> from to) (rotatef from to)) (dolist (x *insert-parenthesis-list*) (let* ((head (second x)) (tail (third x)) (menu-item (concat head " : " tail "\t" (first x)))) (add-menu-item menu nil menu-item #'(lambda () (interactive) (insert-parenthesis-1 from to head tail))))) (track-popup-menu menu))))
|

|