diff options
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/wid-edit.el | 74 |
2 files changed, 42 insertions, 35 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b1d934e7110..c2a6ee92416 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2001-01-22 Gerd Moellmann <gerd@gnu.org> | 1 | 2001-01-22 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * wid-edit.el (widget-button-click): Avoid a save-excursion | ||
| 4 | around running a global binding. | ||
| 5 | |||
| 3 | * isearch.el (isearch-lazy-highlight-initial-delay): Set default | 6 | * isearch.el (isearch-lazy-highlight-initial-delay): Set default |
| 4 | to 0.25. | 7 | to 0.25. |
| 5 | 8 | ||
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index fe58e1acf39..91476df3278 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el | |||
| @@ -851,47 +851,51 @@ Recommended as a parent keymap for modes using widgets.") | |||
| 851 | "Invoke the button that the mouse is pointing at." | 851 | "Invoke the button that the mouse is pointing at." |
| 852 | (interactive "@e") | 852 | (interactive "@e") |
| 853 | (if (widget-event-point event) | 853 | (if (widget-event-point event) |
| 854 | (save-excursion | 854 | (progn |
| 855 | (mouse-set-point event) | 855 | (mouse-set-point event) |
| 856 | (let* ((pos (widget-event-point event)) | 856 | (let* ((pos (widget-event-point event)) |
| 857 | (button (get-char-property pos 'button))) | 857 | (button (get-char-property pos 'button))) |
| 858 | (if button | 858 | (if button |
| 859 | (let* ((overlay (widget-get button :button-overlay)) | 859 | (save-excursion |
| 860 | (face (overlay-get overlay 'face)) | 860 | (let* ((overlay (widget-get button :button-overlay)) |
| 861 | (mouse-face (overlay-get overlay 'mouse-face))) | 861 | (face (overlay-get overlay 'face)) |
| 862 | (unwind-protect | 862 | (mouse-face (overlay-get overlay 'mouse-face))) |
| 863 | (let ((track-mouse t)) | 863 | (unwind-protect |
| 864 | (save-excursion | 864 | (let ((track-mouse t)) |
| 865 | (when face ; avoid changing around image | 865 | (save-excursion |
| 866 | (overlay-put overlay | 866 | (when face ; avoid changing around image |
| 867 | 'face widget-button-pressed-face) | 867 | (overlay-put overlay |
| 868 | (overlay-put overlay | 868 | 'face widget-button-pressed-face) |
| 869 | 'mouse-face widget-button-pressed-face)) | 869 | (overlay-put overlay |
| 870 | (unless (widget-apply button :mouse-down-action event) | 870 | 'mouse-face widget-button-pressed-face)) |
| 871 | (while (not (widget-button-release-event-p event)) | 871 | (unless (widget-apply button :mouse-down-action event) |
| 872 | (setq event (read-event) | 872 | (while (not (widget-button-release-event-p event)) |
| 873 | pos (widget-event-point event)) | 873 | (setq event (read-event) |
| 874 | (if (and pos | 874 | pos (widget-event-point event)) |
| 875 | (eq (get-char-property pos 'button) | 875 | (if (and pos |
| 876 | button)) | 876 | (eq (get-char-property pos 'button) |
| 877 | (when face | 877 | button)) |
| 878 | (overlay-put overlay | 878 | (when face |
| 879 | 'face | 879 | (overlay-put overlay |
| 880 | widget-button-pressed-face) | 880 | 'face |
| 881 | (overlay-put overlay | 881 | widget-button-pressed-face) |
| 882 | 'mouse-face | 882 | (overlay-put overlay |
| 883 | widget-button-pressed-face)) | 883 | 'mouse-face |
| 884 | (overlay-put overlay 'face face) | 884 | widget-button-pressed-face)) |
| 885 | (overlay-put overlay 'mouse-face mouse-face)))) | 885 | (overlay-put overlay 'face face) |
| 886 | (when (and pos | 886 | (overlay-put overlay 'mouse-face mouse-face)))) |
| 887 | (eq (get-char-property pos 'button) button)) | 887 | (when (and pos |
| 888 | (widget-apply-action button event)))) | 888 | (eq (get-char-property pos 'button) button)) |
| 889 | (overlay-put overlay 'face face) | 889 | (widget-apply-action button event)))) |
| 890 | (overlay-put overlay 'mouse-face mouse-face))) | 890 | (overlay-put overlay 'face face) |
| 891 | (overlay-put overlay 'mouse-face mouse-face)))) | ||
| 892 | |||
| 893 | ;; Not on a button. Find the global command to run, and | ||
| 894 | ;; check whether it is bound to an up event. Avoid a | ||
| 895 | ;; `save-excursion' here, since a global command may | ||
| 896 | ;; to change point, e.g. like `mouse-drag-drag' does. | ||
| 891 | (let ((up t) | 897 | (let ((up t) |
| 892 | command) | 898 | command) |
| 893 | ;; Find the global command to run, and check whether it | ||
| 894 | ;; is bound to an up event. | ||
| 895 | (if (memq (event-basic-type event) '(mouse-1 down-mouse-1)) | 899 | (if (memq (event-basic-type event) '(mouse-1 down-mouse-1)) |
| 896 | (cond ((setq command ;down event | 900 | (cond ((setq command ;down event |
| 897 | (lookup-key widget-global-map [down-mouse-1])) | 901 | (lookup-key widget-global-map [down-mouse-1])) |