xyzzyの使い方が分からぬやし 励ましあえ その11at SOFTWARE
xyzzyの使い方が分からぬやし 励ましあえ その11 - 暇つぶし2ch241:名無しさん@お腹いっぱい。
08/01/22 01:13:18 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))))


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch