erc / erc-button.el

Diff from to

File erc-button.el

    (nconc (and erc-button-mouse-face
                (list 'mouse-face erc-button-mouse-face))
           (list 'erc-callback fun)
-          (list 'local-map erc-button-keymap)
+          (list 'keymap erc-button-keymap)
           (list 'rear-nonsticky t)
           (and data (list 'erc-data data))))
-  (widget-convert-button 'link from to :action 'erc-widget-press-button))
+  (widget-convert-button 'link from to :action 'erc-button-press-button
+                         ;; Make XEmacs behave with mouse-clicks, for
+                         ;; some reason, widget stuff overrides the
+                         ;; 'keymap text-property.
+                         :mouse-down-action 'erc-button-click-button))
 (defun erc-button-add-face (from to face)
   "Add FACE to the region between FROM and TO."
             old (erc-list (get-text-property pos 'face))
             end (next-single-property-change pos 'face nil to)))))
-(defun erc-button-click-button (event)
+;; widget-button-click calls with two args, we ignore the first.
+;; Since Emacs runs this directly, rather than with
+;; widget-button-click, we need to fake an extra arg in the
+;; interactive spec.
+(defun erc-button-click-button (ignore event)
   "Call `erc-button-press-button'."
-  (interactive "e")
+  (interactive "P\ne")
     (mouse-set-point event)
-(defun erc-widget-press-button (elems el)
-  (goto-char (widget-get elems :from))
-  (erc-button-press-button))
-(defun erc-button-press-button ()
+;; XEmacs calls this via widget-button-press with a bunch of arguments
+;; which we don't care about.
+(defun erc-button-press-button (&rest ignore)
   "Check text at point for a callback function.
 If the text at point has a `erc-callback' property,
 call it with the value of the `erc-data' text property."