diff options
| author | Richard M. Stallman | 1996-12-20 05:58:41 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-12-20 05:58:41 +0000 |
| commit | e900ced401d7fd6b000a07dd716f107cd5e44d8c (patch) | |
| tree | b0d6d8da10f89fbf393706b68421adf1a53da8e3 | |
| parent | 9e2b495b7085a76d3d6ea521312d080aa6479965 (diff) | |
| download | emacs-e900ced401d7fd6b000a07dd716f107cd5e44d8c.tar.gz emacs-e900ced401d7fd6b000a07dd716f107cd5e44d8c.zip | |
(isearch-edit-string): When we try the search
at the end, do that outside of the let which binds all the
search state.
| -rw-r--r-- | lisp/isearch.el | 203 |
1 files changed, 103 insertions, 100 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index ebd72dbfc48..28fe63335d0 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -636,108 +636,111 @@ If first char entered is \\[isearch-yank-word], then do word search instead." | |||
| 636 | ;; Editing doesn't back up the search point. Should it? | 636 | ;; Editing doesn't back up the search point. Should it? |
| 637 | (interactive) | 637 | (interactive) |
| 638 | (condition-case err | 638 | (condition-case err |
| 639 | (let ((isearch-nonincremental isearch-nonincremental) | 639 | (progn |
| 640 | 640 | (let ((isearch-nonincremental isearch-nonincremental) | |
| 641 | ;; Locally bind all isearch global variables to protect them | 641 | |
| 642 | ;; from recursive isearching. | 642 | ;; Locally bind all isearch global variables to protect them |
| 643 | ;; isearch-string -message and -forward are not bound | 643 | ;; from recursive isearching. |
| 644 | ;; so they may be changed. Instead, save the values. | 644 | ;; isearch-string -message and -forward are not bound |
| 645 | (isearch-new-string isearch-string) | 645 | ;; so they may be changed. Instead, save the values. |
| 646 | (isearch-new-message isearch-message) | 646 | (isearch-new-string isearch-string) |
| 647 | (isearch-new-forward isearch-forward) | 647 | (isearch-new-message isearch-message) |
| 648 | (isearch-new-word isearch-word) | 648 | (isearch-new-forward isearch-forward) |
| 649 | 649 | (isearch-new-word isearch-word) | |
| 650 | (isearch-regexp isearch-regexp) | 650 | |
| 651 | (isearch-op-fun isearch-op-fun) | 651 | (isearch-regexp isearch-regexp) |
| 652 | (isearch-cmds isearch-cmds) | 652 | (isearch-op-fun isearch-op-fun) |
| 653 | (isearch-success isearch-success) | 653 | (isearch-cmds isearch-cmds) |
| 654 | (isearch-wrapped isearch-wrapped) | 654 | (isearch-success isearch-success) |
| 655 | (isearch-barrier isearch-barrier) | 655 | (isearch-wrapped isearch-wrapped) |
| 656 | (isearch-adjusted isearch-adjusted) | 656 | (isearch-barrier isearch-barrier) |
| 657 | (isearch-yank-flag isearch-yank-flag) | 657 | (isearch-adjusted isearch-adjusted) |
| 658 | (isearch-invalid-regexp isearch-invalid-regexp) | 658 | (isearch-yank-flag isearch-yank-flag) |
| 659 | (isearch-within-brackets isearch-within-brackets) | 659 | (isearch-invalid-regexp isearch-invalid-regexp) |
| 660 | ;;; Don't bind this. We want isearch-search, below, to set it. | 660 | (isearch-within-brackets isearch-within-brackets) |
| 661 | ;;; And the old value won't matter after that. | 661 | ;;; Don't bind this. We want isearch-search, below, to set it. |
| 662 | ;;; (isearch-other-end isearch-other-end) | 662 | ;;; And the old value won't matter after that. |
| 663 | ;;; Perhaps some of these other variables should be bound for a | 663 | ;;; (isearch-other-end isearch-other-end) |
| 664 | ;;; shorter period, ending before the next isearch-search. | 664 | ;;; Perhaps some of these other variables should be bound for a |
| 665 | ;;; But there doesn't seem to be a real bug, so let's not risk it now. | 665 | ;;; shorter period, ending before the next isearch-search. |
| 666 | (isearch-opoint isearch-opoint) | 666 | ;;; But there doesn't seem to be a real bug, so let's not risk it now. |
| 667 | (isearch-slow-terminal-mode isearch-slow-terminal-mode) | 667 | (isearch-opoint isearch-opoint) |
| 668 | (isearch-small-window isearch-small-window) | 668 | (isearch-slow-terminal-mode isearch-slow-terminal-mode) |
| 669 | (isearch-recursive-edit isearch-recursive-edit) | 669 | (isearch-small-window isearch-small-window) |
| 670 | ;; Save current configuration so we can restore it here. | 670 | (isearch-recursive-edit isearch-recursive-edit) |
| 671 | (isearch-window-configuration (current-window-configuration)) | 671 | ;; Save current configuration so we can restore it here. |
| 672 | ) | 672 | (isearch-window-configuration (current-window-configuration)) |
| 673 | 673 | ) | |
| 674 | ;; Actually terminate isearching until editing is done. | 674 | |
| 675 | ;; This is so that the user can do anything without failure, | 675 | ;; Actually terminate isearching until editing is done. |
| 676 | ;; like switch buffers and start another isearch, and return. | 676 | ;; This is so that the user can do anything without failure, |
| 677 | (condition-case err | 677 | ;; like switch buffers and start another isearch, and return. |
| 678 | (isearch-done t t) | 678 | (condition-case err |
| 679 | (exit nil)) ; was recursive editing | 679 | (isearch-done t t) |
| 680 | 680 | (exit nil)) ; was recursive editing | |
| 681 | (isearch-message) ;; for read-char | 681 | |
| 682 | (unwind-protect | 682 | (isearch-message) ;; for read-char |
| 683 | (let* (;; Why does following read-char echo? | 683 | (unwind-protect |
| 684 | ;;(echo-keystrokes 0) ;; not needed with above message | 684 | (let* (;; Why does following read-char echo? |
| 685 | (e (let ((cursor-in-echo-area t)) | 685 | ;;(echo-keystrokes 0) ;; not needed with above message |
| 686 | (read-event))) | 686 | (e (let ((cursor-in-echo-area t)) |
| 687 | ;; Binding minibuffer-history-symbol to nil is a work-around | 687 | (read-event))) |
| 688 | ;; for some incompatibility with gmhist. | 688 | ;; Binding minibuffer-history-symbol to nil is a work-around |
| 689 | (minibuffer-history-symbol) | 689 | ;; for some incompatibility with gmhist. |
| 690 | (message-log-max nil)) | 690 | (minibuffer-history-symbol) |
| 691 | ;; If the first character the user types when we prompt them | 691 | (message-log-max nil)) |
| 692 | ;; for a string is the yank-word character, then go into | 692 | ;; If the first character the user types when we prompt them |
| 693 | ;; word-search mode. Otherwise unread that character and | 693 | ;; for a string is the yank-word character, then go into |
| 694 | ;; read a key the normal way. | 694 | ;; word-search mode. Otherwise unread that character and |
| 695 | ;; Word search does not apply (yet) to regexp searches, | 695 | ;; read a key the normal way. |
| 696 | ;; no check is made here. | 696 | ;; Word search does not apply (yet) to regexp searches, |
| 697 | (message (isearch-message-prefix nil nil t)) | 697 | ;; no check is made here. |
| 698 | (if (eq 'isearch-yank-word | 698 | (message (isearch-message-prefix nil nil t)) |
| 699 | (lookup-key isearch-mode-map (vector e))) | 699 | (if (eq 'isearch-yank-word |
| 700 | (setq isearch-word t;; so message-prefix is right | 700 | (lookup-key isearch-mode-map (vector e))) |
| 701 | isearch-new-word t) | 701 | (setq isearch-word t;; so message-prefix is right |
| 702 | (cancel-kbd-macro-events) | 702 | isearch-new-word t) |
| 703 | (isearch-unread e)) | 703 | (cancel-kbd-macro-events) |
| 704 | (setq cursor-in-echo-area nil) | 704 | (isearch-unread e)) |
| 705 | (setq isearch-new-string | 705 | (setq cursor-in-echo-area nil) |
| 706 | (let (junk-ring) | 706 | (setq isearch-new-string |
| 707 | (read-from-minibuffer | 707 | (let (junk-ring) |
| 708 | (isearch-message-prefix nil nil isearch-nonincremental) | 708 | (read-from-minibuffer |
| 709 | isearch-string | 709 | (isearch-message-prefix nil nil isearch-nonincremental) |
| 710 | minibuffer-local-isearch-map nil | 710 | isearch-string |
| 711 | 'junk-ring)) | 711 | minibuffer-local-isearch-map nil |
| 712 | isearch-new-message | 712 | 'junk-ring)) |
| 713 | (mapconcat 'isearch-text-char-description | 713 | isearch-new-message |
| 714 | isearch-new-string ""))) | 714 | (mapconcat 'isearch-text-char-description |
| 715 | ;; Always resume isearching by restarting it. | 715 | isearch-new-string ""))) |
| 716 | (isearch-mode isearch-forward | 716 | ;; Always resume isearching by restarting it. |
| 717 | isearch-regexp | 717 | (isearch-mode isearch-forward |
| 718 | isearch-op-fun | 718 | isearch-regexp |
| 719 | nil | 719 | isearch-op-fun |
| 720 | isearch-word) | 720 | nil |
| 721 | 721 | isearch-word) | |
| 722 | ;; Copy new local values to isearch globals | 722 | |
| 723 | (setq isearch-string isearch-new-string | 723 | ;; Copy new local values to isearch globals |
| 724 | isearch-message isearch-new-message | 724 | (setq isearch-string isearch-new-string |
| 725 | isearch-forward isearch-new-forward | 725 | isearch-message isearch-new-message |
| 726 | isearch-word isearch-new-word)) | 726 | isearch-forward isearch-new-forward |
| 727 | 727 | isearch-word isearch-new-word)) | |
| 728 | ;; Empty isearch-string means use default. | 728 | |
| 729 | (if (= 0 (length isearch-string)) | 729 | ;; Empty isearch-string means use default. |
| 730 | (setq isearch-string (or (car (if isearch-regexp | 730 | (if (= 0 (length isearch-string)) |
| 731 | regexp-search-ring | 731 | (setq isearch-string (or (car (if isearch-regexp |
| 732 | search-ring)) | 732 | regexp-search-ring |
| 733 | "")) | 733 | search-ring)) |
| 734 | ;; This used to set the last search string, | 734 | "")) |
| 735 | ;; but I think it is not right to do that here. | 735 | ;; This used to set the last search string, |
| 736 | ;; Only the string actually used should be saved. | 736 | ;; but I think it is not right to do that here. |
| 737 | ) | 737 | ;; Only the string actually used should be saved. |
| 738 | )) | ||
| 739 | |||
| 740 | ;; Push the state as of before this C-s. | ||
| 741 | (isearch-push-state) | ||
| 738 | 742 | ||
| 739 | ;; Reinvoke the pending search. | 743 | ;; Reinvoke the pending search. |
| 740 | (isearch-push-state) | ||
| 741 | (isearch-search) | 744 | (isearch-search) |
| 742 | (isearch-update) | 745 | (isearch-update) |
| 743 | (if isearch-nonincremental | 746 | (if isearch-nonincremental |