summaryrefslogtreecommitdiff
path: root/lisp/wid-edit.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2006-10-03 05:04:21 +0000
committerMiles Bader <miles@gnu.org>2006-10-03 05:04:21 +0000
commitf3bbbd11451643c49997116d639612ae434dcaa0 (patch)
tree6ce54c0dbf43746478357847960e9621fe3a5719 /lisp/wid-edit.el
parent84356ba74da100da043fea790d1253b2d92e9110 (diff)
parent670992917f2ee196a667797e4c3806d89c0f6d61 (diff)
downloademacs-f3bbbd11451643c49997116d639612ae434dcaa0.tar.gz
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 447-459) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 141-144) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-115
Diffstat (limited to 'lisp/wid-edit.el')
-rw-r--r--lisp/wid-edit.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index ba7a9b4a0a1..bef49d71a00 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -912,6 +912,10 @@ Recommended as a parent keymap for modes using widgets.")
;; backward-compatibility alias
(put 'widget-button-pressed-face 'face-alias 'widget-button-pressed)
+(defvar widget-button-click-moves-point nil
+ "If non-nil, `widget-button-click' moves point to a button after invoking it.
+If nil, point returns to its original position after invoking a button.")
+
(defun widget-button-click (event)
"Invoke the button that the mouse is pointing at."
(interactive "e")
@@ -922,7 +926,8 @@ Recommended as a parent keymap for modes using widgets.")
(start (event-start event))
(button (get-char-property
pos 'button (and (windowp (posn-window start))
- (window-buffer (posn-window start))))))
+ (window-buffer (posn-window start)))))
+ newpoint)
(when (or (null button)
(catch 'button-press-cancelled
;; Mouse click on a widget button. Do the following
@@ -974,12 +979,15 @@ Recommended as a parent keymap for modes using widgets.")
;; When mouse is released over the button, run
;; its action function.
- (when (and pos
- (eq (get-char-property pos 'button) button))
- (widget-apply-action button event)))
+ (when (and pos (eq (get-char-property pos 'button) button))
+ (goto-char pos)
+ (widget-apply-action button event)
+ (if widget-button-click-moves-point
+ (setq newpoint (point)))))
(overlay-put overlay 'face face)
(overlay-put overlay 'mouse-face mouse-face))))
+ (if newpoint (goto-char newpoint))
;; This loses if the widget action switches windows. -- cyd
;; (unless (pos-visible-in-window-p (widget-event-point event))
;; (mouse-set-point event)