[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/wid-edit.el,v
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/wid-edit.el,v |
Date: |
Sat, 30 Sep 2006 15:45:36 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Chong Yidong <cyd> 06/09/30 15:45:35
Index: wid-edit.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/wid-edit.el,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -b -r1.167 -r1.168
--- wid-edit.el 18 Sep 2006 15:39:50 -0000 1.167
+++ wid-edit.el 30 Sep 2006 15:45:35 -0000 1.168
@@ -912,6 +912,10 @@
;; 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 @@
(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 @@
;; 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)