diff options
| author | Juri Linkov | 2004-10-05 04:22:41 +0000 |
|---|---|---|
| committer | Juri Linkov | 2004-10-05 04:22:41 +0000 |
| commit | 071fdd66922f288844c3aa52edfdbd375179d866 (patch) | |
| tree | 18b9e183ac52944b15942e3558862c728c1a30c0 | |
| parent | 80a47b51e7bac79893de13eb5704371eddccee13 (diff) | |
| download | emacs-071fdd66922f288844c3aa52edfdbd375179d866.tar.gz emacs-071fdd66922f288844c3aa52edfdbd375179d866.zip | |
(isearch-done): Set mark after running hook.
Suggested by Drew Adams <drew.adams@oracle.com>.
| -rw-r--r-- | lisp/isearch.el | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 117d1bfdc13..96a3e0e0ac2 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -680,16 +680,7 @@ is treated as a regexp. See \\[isearch-forward] for more info." | |||
| 680 | (if isearch-small-window | 680 | (if isearch-small-window |
| 681 | (goto-char found-point) | 681 | (goto-char found-point) |
| 682 | ;; Exiting the save-window-excursion clobbers window-start; restore it. | 682 | ;; Exiting the save-window-excursion clobbers window-start; restore it. |
| 683 | (set-window-start (selected-window) found-start t)) | 683 | (set-window-start (selected-window) found-start t))) |
| 684 | |||
| 685 | ;; If there was movement, mark the starting position. | ||
| 686 | ;; Maybe should test difference between and set mark iff > threshold. | ||
| 687 | (if (/= (point) isearch-opoint) | ||
| 688 | (or (and transient-mark-mode mark-active) | ||
| 689 | (progn | ||
| 690 | (push-mark isearch-opoint t) | ||
| 691 | (or executing-kbd-macro (> (minibuffer-depth) 0) | ||
| 692 | (message "Mark saved where search started")))))) | ||
| 693 | 684 | ||
| 694 | (setq isearch-mode nil) | 685 | (setq isearch-mode nil) |
| 695 | (if isearch-input-method-local-p | 686 | (if isearch-input-method-local-p |
| @@ -714,6 +705,16 @@ is treated as a regexp. See \\[isearch-forward] for more info." | |||
| 714 | (isearch-update-ring isearch-string isearch-regexp)) | 705 | (isearch-update-ring isearch-string isearch-regexp)) |
| 715 | 706 | ||
| 716 | (run-hooks 'isearch-mode-end-hook) | 707 | (run-hooks 'isearch-mode-end-hook) |
| 708 | |||
| 709 | ;; If there was movement, mark the starting position. | ||
| 710 | ;; Maybe should test difference between and set mark iff > threshold. | ||
| 711 | (if (/= (point) isearch-opoint) | ||
| 712 | (or (and transient-mark-mode mark-active) | ||
| 713 | (progn | ||
| 714 | (push-mark isearch-opoint t) | ||
| 715 | (or executing-kbd-macro (> (minibuffer-depth) 0) | ||
| 716 | (message "Mark saved where search started"))))) | ||
| 717 | |||
| 717 | (and (not edit) isearch-recursive-edit (exit-recursive-edit))) | 718 | (and (not edit) isearch-recursive-edit (exit-recursive-edit))) |
| 718 | 719 | ||
| 719 | (defun isearch-update-ring (string &optional regexp) | 720 | (defun isearch-update-ring (string &optional regexp) |