From 323f90b182ecc16625c01765216cee9a8e861f39 Mon Sep 17 00:00:00 2001 From: ueno Date: Sat, 5 Feb 2005 01:01:50 +0000 Subject: [PATCH] * riece-button.el (riece-identity-button-click): New function. (riece-make-identity-button-map): Bind riece-identity-button-click. --- lisp/ChangeLog | 2 ++ lisp/riece-button.el | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 588ee31..3696e72 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * riece-button.el (riece-identity-button-popup-menu): Changed interactivbe spect "@e" -> "e". + (riece-identity-button-click): New function. + (riece-make-identity-button-map): Bind riece-identity-button-click. 2005-02-04 Daiki Ueno diff --git a/lisp/riece-button.el b/lisp/riece-button.el index 1975024..ff8c0e5 100644 --- a/lisp/riece-button.el +++ b/lisp/riece-button.el @@ -83,6 +83,27 @@ This function is used as a callback for a channel button." (message "%s" (substitute-command-keys "Type \\[riece-command-join] to join the channel"))))) +(defun riece-identity-button-click (event) + "Call widget-button-click and select the last selected window." + (interactive "e") ;widget-button-click has + ;interactive spec "@e" + (let ((buffer (current-buffer)) + (point (point)) + window) + (unwind-protect + (save-excursion + (set-buffer (riece-event-buffer event)) + (goto-char (riece-event-point event)) + (widget-button-click event)) + ;; riece-button-switch-to-identity changes window-configuration + ;; so we must select the last selected window by _buffer_. + (if (setq window (get-buffer-window buffer)) + (progn + (select-window window) + (set-window-point window point)) + (if riece-debug + (message "buffer %s not visible" (buffer-name buffer))))))) + (defun riece-identity-button-popup-menu (event) "Popup the menu for identity buttons." (interactive "e") @@ -179,6 +200,7 @@ This function is used as a callback for a channel button." (defun riece-make-identity-button-map () (let ((map (make-sparse-keymap))) (set-keymap-parent map (current-local-map)) + (define-key map [down-mouse-2] 'riece-identity-button-click) (define-key map [down-mouse-3] 'riece-identity-button-popup-menu) map)) -- 1.7.10.4