From 3fb800b38d7ee2308e33270cb3ed3f8f65050584 Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 17 Jul 2000 04:36:15 +0000 Subject: [PATCH] * liece-emacs.el (create-image): Don't advise. (liece-widget-keymap): Remove checking about 'button3. (liece-emacs-widget-button-click): Save point in window explicitly. --- lisp/ChangeLog | 4 ++++ lisp/liece-emacs.el | 44 +++++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 29edd48..7ca601b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2000-07-17 Daiki Ueno + * liece-emacs.el (create-image): Don't advise. + (liece-widget-keymap): Remove checking about 'button3. + (liece-emacs-widget-button-click): Save point in window explicitly. + * liece-ctcp.el (liece-command-ctcp-generic): Fix format string. 2000-07-16 Akira Ohashi diff --git a/lisp/liece-emacs.el b/lisp/liece-emacs.el index 7104bcc..7a1e9c7 100644 --- a/lisp/liece-emacs.el +++ b/lisp/liece-emacs.el @@ -51,8 +51,7 @@ (substitute-key-definition 'widget-button-click 'liece-widget-button-click liece-widget-keymap) - (define-key liece-widget-keymap (if (featurep 'xemacs) 'button3 - [mouse-3]) + (define-key liece-widget-keymap [mouse-3] 'liece-widget-button-click)) (defun liece-emacs-widget-convert-button (type from to &rest args) @@ -63,21 +62,26 @@ (defun liece-emacs-widget-button-click (event) (interactive "e") - (with-current-buffer - (let ((window (posn-window (event-start event)))) - (and (windowp window) (window-buffer window))) - (goto-char (widget-event-point event)) - (cond - ((widget-at (point))) - ((> (point) (save-excursion - (widget-forward 0) - (point))) - (widget-backward 0)) - ((< (point) (save-excursion - (widget-backward 0) - (point))) - (widget-forward 0))) - (widget-button-click event))) + (let* ((window (posn-window (event-start event))) + (point (window-point window)) + (buffer (window-buffer window))) + (with-current-buffer buffer + (unwind-protect + (progn + (goto-char (widget-event-point event)) + (cond + ((widget-at (point))) + ((> (point) (save-excursion + (widget-forward 0) + (point))) + (widget-backward 0)) + ((< (point) (save-excursion + (widget-backward 0) + (point))) + (widget-forward 0))) + (call-interactively (function widget-button-click))) + (if (windowp (setq window (get-buffer-window buffer))) + (set-window-point window point)))))) (fset 'liece-widget-convert-button 'liece-emacs-widget-convert-button) @@ -160,12 +164,6 @@ ;;; (defconst liece-mode-line-image nil) -(static-unless (or (not (fboundp 'create-image)) - (memq 'data-p (aref (symbol-function 'create-image) 0))) - (defadvice create-image - (before data-p (file-or-data &optional type data-p &rest props) activate) - (ad-set-args 0 (list (ad-get-arg 0) (ad-get-arg 1) (ad-get-arg 3))))) - (defun liece-emacs-create-mode-line-image () (static-when (fboundp 'image-type-available-p) (let ((file (liece-locate-icon-file -- 1.7.10.4