[xyzzy:01351] buffer-selector
- Subject: [xyzzy:01351] buffer-selector
- From: Seiya Suda <EZU11330@xxxxxxxxxxxxxxxx>
- X-mailer: Denshin 8 Go V321.2b5
亀井さん、こんにちは。須田です。
mouse の右クリックメニューに buffer selector
というポップアップメニューを追加したく思った
のですが、次のとおり、単に後ろの方に追加する
だけで、ポップアップにすることができません。
どうすればいいのでしょう?
--------------------------------------
(defun mouse-right-press ()
(interactive)
(while (get-menu-position *app-popup-menu* 'buffer-menu)
(delete-menu *app-popup-menu* 'buffer-menu))
(delete-menu *app-popup-menu* 'buffer-sep)
(delete-menu *app-popup-menu* 'url)
(delete-menu *app-popup-menu* 'url-sep)
(set-window *last-mouse-window*)
(continue-pre-selection)
(let (menu url menu-item)
(cond ((eql (get-selection-type) 3)
(setq menu *app-rectangle-popup-menu*))
((and (eql (get-selection-type) 2)
(save-excursion
(goto-char (min (selection-point)
(selection-mark)))
(looking-at *url-scheme-regexp*)))
(setq url (buffer-substring (selection-point)
(selection-mark)))
(setq menu *app-popup-menu*))
(t
(setq menu *app-popup-menu*)
(save-excursion
(goto-last-mouse-point)
(skip-chars-backward "-a-zA-Z0-9_/~.#@%?&=;")
(when (or (looking-at *url-scheme-regexp*)
(and (looking-back ":")
(progn
(forward-char -1)
(skip-chars-backward "a-zA-Z0-9_")
(looking-at *url-scheme-regexp*))))
(setq url (buffer-substring (point)
(progn
(goto-char (match-end 0))
(skip-chars-forward "-a-zA-Z0-9_/~.#@%?&=;")
(point))))))
(when url
(add-menu-separator menu 'url-sep)
(add-menu-item menu 'url
(concatenate 'string url " を開く")
#'(lambda ()
(interactive)
(shell-execute url t))))
#| 追加 |#
(add-menu-separator menu 'buffer-sep)
(dolist (b (buffer-list))
(let ((menu-item (buffer-name b)))
(add-menu-item menu 'buffer-menu
menu-item
#'(lambda ()
(interactive)
(pop-to-buffer menu-item)))))
)
)
(track-popup-menu menu)))
--------
須田誠也
EZU11330@xxxxxxxxxxx