* liece-emacs.el (create-image): Don't advise.
authorueno <ueno>
Mon, 17 Jul 2000 04:36:15 +0000 (04:36 +0000)
committerueno <ueno>
Mon, 17 Jul 2000 04:36:15 +0000 (04:36 +0000)
(liece-widget-keymap): Remove checking about 'button3.
(liece-emacs-widget-button-click): Save point in window explicitly.

lisp/ChangeLog
lisp/liece-emacs.el

index 29edd48..7ca601b 100644 (file)
@@ -1,5 +1,9 @@
 2000-07-17   Daiki Ueno  <ueno@unixuser.org>
 
+       * 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  <bg66@luck.gr.jp>
index 7104bcc..7a1e9c7 100644 (file)
@@ -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)
 
 (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)
 ;;; 
 (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