comparison lisp/replace.el @ 82072:7894e62e5b10

(perform-replace): Use isearch-no-upper-case-p.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 23 Jul 2007 21:32:32 +0000
parents 6ad309ee5f4e
children b98604865ea0 492971a3f31f
comparison
equal deleted inserted replaced
82071:dd207a898aee 82072:7894e62e5b10
1406 This function returns nil if and only if there were no matches to 1406 This function returns nil if and only if there were no matches to
1407 make, or the user didn't cancel the call." 1407 make, or the user didn't cancel the call."
1408 (or map (setq map query-replace-map)) 1408 (or map (setq map query-replace-map))
1409 (and query-flag minibuffer-auto-raise 1409 (and query-flag minibuffer-auto-raise
1410 (raise-frame (window-frame (minibuffer-window)))) 1410 (raise-frame (window-frame (minibuffer-window))))
1411 (let ((nocasify (not (and case-fold-search case-replace 1411 (let* ((case-fold-search
1412 (string-equal from-string 1412 (and case-fold-search
1413 (downcase from-string))))) 1413 (isearch-no-upper-case-p from-string regexp-flag)))
1414 (case-fold-search (and case-fold-search 1414 (nocasify (not (and case-replace case-fold-search)))
1415 (string-equal from-string 1415 (literal (or (not regexp-flag) (eq regexp-flag 'literal)))
1416 (downcase from-string)))) 1416 (search-function (if regexp-flag 're-search-forward 'search-forward))
1417 (literal (or (not regexp-flag) (eq regexp-flag 'literal))) 1417 (search-string from-string)
1418 (search-function (if regexp-flag 're-search-forward 'search-forward)) 1418 (real-match-data nil) ; The match data for the current match.
1419 (search-string from-string) 1419 (next-replacement nil)
1420 (real-match-data nil) ; the match data for the current match 1420 ;; This is non-nil if we know there is nothing for the user
1421 (next-replacement nil) 1421 ;; to edit in the replacement.
1422 ;; This is non-nil if we know there is nothing for the user 1422 (noedit nil)
1423 ;; to edit in the replacement. 1423 (keep-going t)
1424 (noedit nil) 1424 (stack nil)
1425 (keep-going t) 1425 (replace-count 0)
1426 (stack nil) 1426 (nonempty-match nil)
1427 (replace-count 0) 1427
1428 (nonempty-match nil) 1428 ;; If non-nil, it is marker saying where in the buffer to stop.
1429 1429 (limit nil)
1430 ;; If non-nil, it is marker saying where in the buffer to stop. 1430
1431 (limit nil) 1431 ;; Data for the next match. If a cons, it has the same format as
1432 1432 ;; (match-data); otherwise it is t if a match is possible at point.
1433 ;; Data for the next match. If a cons, it has the same format as 1433 (match-again t)
1434 ;; (match-data); otherwise it is t if a match is possible at point. 1434
1435 (match-again t) 1435 (message
1436 1436 (if query-flag
1437 (message 1437 (apply 'propertize
1438 (if query-flag 1438 (substitute-command-keys
1439 (apply 'propertize 1439 "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help) ")
1440 (substitute-command-keys 1440 minibuffer-prompt-properties))))
1441 "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help) ")
1442 minibuffer-prompt-properties))))
1443 1441
1444 ;; If region is active, in Transient Mark mode, operate on region. 1442 ;; If region is active, in Transient Mark mode, operate on region.
1445 (when start 1443 (when start
1446 (setq limit (copy-marker (max start end))) 1444 (setq limit (copy-marker (max start end)))
1447 (goto-char (min start end)) 1445 (goto-char (min start end))