comparison lisp/isearch.el @ 82039:ee17cf620665

(isearch-edit-string): Save old point and isearch-other-end to old-point and old-other-end before reading the search string from minibuffer. After exiting minibuffer set point to old-other-end if point and the search direction is the same as before reading the search string. (isearch-del-char): Don't set isearch-yank-flag to t. Put point to isearch-other-end. Instead of isearch-search-and-update call three functions isearch-search, isearch-push-state and isearch-update.
author Juri Linkov <juri@jurta.org>
date Sun, 22 Jul 2007 22:33:08 +0000
parents d1ba4f191df6
children d22a586b6032
comparison
equal deleted inserted replaced
82038:7ee8cfeeb2b8 82039:ee17cf620665
990 ;; Temporarily restore `minibuffer-message-timeout'. 990 ;; Temporarily restore `minibuffer-message-timeout'.
991 (minibuffer-message-timeout 991 (minibuffer-message-timeout
992 isearch-original-minibuffer-message-timeout) 992 isearch-original-minibuffer-message-timeout)
993 (isearch-original-minibuffer-message-timeout 993 (isearch-original-minibuffer-message-timeout
994 isearch-original-minibuffer-message-timeout) 994 isearch-original-minibuffer-message-timeout)
995 ) 995 old-point old-other-end)
996 996
997 ;; Actually terminate isearching until editing is done. 997 ;; Actually terminate isearching until editing is done.
998 ;; This is so that the user can do anything without failure, 998 ;; This is so that the user can do anything without failure,
999 ;; like switch buffers and start another isearch, and return. 999 ;; like switch buffers and start another isearch, and return.
1000 (condition-case err 1000 (condition-case err
1001 (isearch-done t t) 1001 (isearch-done t t)
1002 (exit nil)) ; was recursive editing 1002 (exit nil)) ; was recursive editing
1003
1004 ;; Save old point and isearch-other-end before reading from minibuffer
1005 ;; that can change their values.
1006 (setq old-point (point) old-other-end isearch-other-end)
1003 1007
1004 (isearch-message) ;; for read-char 1008 (isearch-message) ;; for read-char
1005 (unwind-protect 1009 (unwind-protect
1006 (let* (;; Why does following read-char echo? 1010 (let* (;; Why does following read-char echo?
1007 ;;(echo-keystrokes 0) ;; not needed with above message 1011 ;;(echo-keystrokes 0) ;; not needed with above message
1034 (if isearch-regexp 'regexp-search-ring 'search-ring) 1038 (if isearch-regexp 'regexp-search-ring 'search-ring)
1035 nil t) 1039 nil t)
1036 isearch-new-message 1040 isearch-new-message
1037 (mapconcat 'isearch-text-char-description 1041 (mapconcat 'isearch-text-char-description
1038 isearch-new-string ""))) 1042 isearch-new-string "")))
1043
1044 ;; Set point at the start (end) of old match if forward (backward),
1045 ;; so after exiting minibuffer isearch resumes at the start (end)
1046 ;; of this match and can find it again.
1047 (if (and old-other-end (eq old-point (point))
1048 (eq isearch-forward isearch-new-forward))
1049 (goto-char old-other-end))
1050
1039 ;; Always resume isearching by restarting it. 1051 ;; Always resume isearching by restarting it.
1040 (isearch-mode isearch-forward 1052 (isearch-mode isearch-forward
1041 isearch-regexp 1053 isearch-regexp
1042 isearch-op-fun 1054 isearch-op-fun
1043 nil 1055 nil
1258 (interactive "p") 1270 (interactive "p")
1259 (if (= 0 (length isearch-string)) 1271 (if (= 0 (length isearch-string))
1260 (ding) 1272 (ding)
1261 (setq isearch-string (substring isearch-string 0 (- (or arg 1))) 1273 (setq isearch-string (substring isearch-string 0 (- (or arg 1)))
1262 isearch-message (mapconcat 'isearch-text-char-description 1274 isearch-message (mapconcat 'isearch-text-char-description
1263 isearch-string "") 1275 isearch-string "")))
1264 ;; Don't move cursor in reverse search. 1276 ;; Use the isearch-other-end as new starting point to be able
1265 isearch-yank-flag t)) 1277 ;; to find the remaining part of the search string again.
1266 (isearch-search-and-update)) 1278 (if isearch-other-end (goto-char isearch-other-end))
1279 (isearch-search)
1280 (isearch-push-state)
1281 (isearch-update))
1267 1282
1268 (defun isearch-yank-string (string) 1283 (defun isearch-yank-string (string)
1269 "Pull STRING into search string." 1284 "Pull STRING into search string."
1270 ;; Downcase the string if not supposed to case-fold yanked strings. 1285 ;; Downcase the string if not supposed to case-fold yanked strings.
1271 (if (and isearch-case-fold-search 1286 (if (and isearch-case-fold-search