comparison lisp/isearch.el @ 89943:4c90ffeb71c5

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-218 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-220 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-221 Restore deleted tagline in etc/TUTORIAL.ru * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-222 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-228 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-229 Remove TeX output files from the archive * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248 src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-258 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264 Update from CVS: lispref/display.texi: emacs -> Emacs. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275 Update from CVS: man/makefile.w32-in: Revert last change * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-295 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-296 Allow restarting an existing debugger session that's exited * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-297 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-327 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-328 Update from CVS: src/.gdbinit (xsymbol): Fix last change. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-329 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-344 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-345 Tweak source regexps so that building in place won't cause problems * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-346 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-352 Update from CVS: lisp/flymake.el: New file. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-362 Support " [...]" style defaults in minibuffer-electric-default-mode * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-363 (read-number): Use canonical format for default in prompt. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-364 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-367 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-368 Improve display-supports-face-attributes-p on non-ttys * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369 Rewrite face-differs-from-default-p * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370 Move `display-supports-face-attributes-p' entirely into C code * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-371 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372 Simplify face-differs-from-default-p; don't consider :stipple. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-373 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374 (tty_supports_face_attributes_p): Ensure attributes differ from default * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-375 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377 (Fdisplay_supports_face_attributes_p): Work around bootstrapping problem * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381 Face merging cleanups * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-382 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-384 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385 src/xfaces.c (push_named_merge_point): Return 0 if a cycle is detected * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-386 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-396 Tweak arch tagging to make build/install-in-place less annoying * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-397 Work around vc-arch problems when building eshell * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-398 Tweak permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-399 Tweak directory permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-401 More build-in-place tweaking of arch tagging * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-403 Yet more build-in-place tweaking of arch tagging * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-404 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410 Make sure image types are initialized for lookup too * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416 Update from CVS
author Miles Bader <miles@gnu.org>
date Mon, 28 Jun 2004 07:56:49 +0000
parents 68c22ea6027c b3821f47a6d4
children 6f6e9fe4658b
comparison
equal deleted inserted replaced
89942:9cb747ae49af 89943:4c90ffeb71c5
442 With a prefix argument, do an incremental regular expression search instead. 442 With a prefix argument, do an incremental regular expression search instead.
443 \\<isearch-mode-map> 443 \\<isearch-mode-map>
444 As you type characters, they add to the search string and are found. 444 As you type characters, they add to the search string and are found.
445 The following non-printing keys are bound in `isearch-mode-map'. 445 The following non-printing keys are bound in `isearch-mode-map'.
446 446
447 Type \\[isearch-delete-char] to cancel characters from end of search string. 447 Type \\[isearch-delete-char] to cancel last input item from end of search string.
448 Type \\[isearch-del-char] to cancel last character from end of search string.
448 Type \\[isearch-exit] to exit, leaving point at location found. 449 Type \\[isearch-exit] to exit, leaving point at location found.
449 Type LFD (C-j) to match end of line. 450 Type LFD (C-j) to match end of line.
450 Type \\[isearch-repeat-forward] to search again forward,\ 451 Type \\[isearch-repeat-forward] to search again forward,\
451 \\[isearch-repeat-backward] to search again backward. 452 \\[isearch-repeat-backward] to search again backward.
452 Type \\[isearch-yank-word-or-char] to yank word from buffer onto end of search\ 453 Type \\[isearch-yank-char] to yank character from buffer onto end of search\
454 string and search for it.
455 Type \\[isearch-yank-word] to yank word from buffer onto end of search\
453 string and search for it. 456 string and search for it.
454 Type \\[isearch-yank-line] to yank rest of line onto end of search string\ 457 Type \\[isearch-yank-line] to yank rest of line onto end of search string\
455 and search for it. 458 and search for it.
456 Type \\[isearch-yank-kill] to yank last killed text onto end of search string\ 459 Type \\[isearch-yank-kill] to yank last killed text onto end of search string\
457 and search for it. 460 and search for it.
480 To use a different input method for searching, type 483 To use a different input method for searching, type
481 \\[isearch-toggle-specified-input-method], and specify an input method 484 \\[isearch-toggle-specified-input-method], and specify an input method
482 you want to use. 485 you want to use.
483 486
484 The above keys, bound in `isearch-mode-map', are often controlled by 487 The above keys, bound in `isearch-mode-map', are often controlled by
485 options; do M-x apropos on search-.* to find them. 488 options; do \\[apropos] on search-.* to find them.
486 Other control and meta characters terminate the search 489 Other control and meta characters terminate the search
487 and are then executed normally (depending on `search-exit-option'). 490 and are then executed normally (depending on `search-exit-option').
488 Likewise for function keys and mouse button events. 491 Likewise for function keys and mouse button events.
489 492
490 If this function is called non-interactively, it does not return to 493 If this function is called non-interactively, it does not return to
783 \\[isearch-reverse-exit-minibuffer] to resume isearching backward. 786 \\[isearch-reverse-exit-minibuffer] to resume isearching backward.
784 \\[isearch-ring-advance-edit] to replace the search string with the next item in the search ring. 787 \\[isearch-ring-advance-edit] to replace the search string with the next item in the search ring.
785 \\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring. 788 \\[isearch-ring-retreat-edit] to replace the search string with the previous item in the search ring.
786 \\[isearch-complete-edit] to complete the search string using the search ring. 789 \\[isearch-complete-edit] to complete the search string using the search ring.
787 \\<isearch-mode-map> 790 \\<isearch-mode-map>
788 If first char entered is \\[isearch-yank-word-or-char], then do word search instead." 791 If first char entered is \\[isearch-yank-word], then do word search instead."
789 792
790 ;; This code is very hairy for several reasons, explained in the code. 793 ;; This code is very hairy for several reasons, explained in the code.
791 ;; Mainly, isearch-mode must be terminated while editing and then restarted. 794 ;; Mainly, isearch-mode must be terminated while editing and then restarted.
792 ;; If there were a way to catch any change of buffer from the minibuffer, 795 ;; If there were a way to catch any change of buffer from the minibuffer,
793 ;; this could be simplified greatly. 796 ;; this could be simplified greatly.
990 993
991 (setq isearch-barrier (point)) ; For subsequent \| if regexp. 994 (setq isearch-barrier (point)) ; For subsequent \| if regexp.
992 995
993 (if (equal isearch-string "") 996 (if (equal isearch-string "")
994 (setq isearch-success t) 997 (setq isearch-success t)
995 (if (and isearch-success (equal (match-end 0) (match-beginning 0)) 998 (if (and isearch-success
999 (equal (point) isearch-other-end)
996 (not isearch-just-started)) 1000 (not isearch-just-started))
997 ;; If repeating a search that found 1001 ;; If repeating a search that found
998 ;; an empty string, ensure we advance. 1002 ;; an empty string, ensure we advance.
999 (if (if isearch-forward (eobp) (bobp)) 1003 (if (if isearch-forward (eobp) (bobp))
1000 ;; If there's nowhere to advance to, fail (and wrap next time). 1004 ;; If there's nowhere to advance to, fail (and wrap next time).
1047 (if (null (cdr isearch-cmds)) 1051 (if (null (cdr isearch-cmds))
1048 (ding) 1052 (ding)
1049 (isearch-pop-state)) 1053 (isearch-pop-state))
1050 (isearch-update)) 1054 (isearch-update))
1051 1055
1056 (defun isearch-del-char ()
1057 "Discard last character and move point back.
1058 If there is no previous character, just beep."
1059 (interactive)
1060 (if (equal isearch-string "")
1061 (ding)
1062 (setq isearch-string (substring isearch-string 0 -1)
1063 isearch-message (mapconcat 'isearch-text-char-description
1064 isearch-string "")))
1065 (isearch-search-and-update))
1052 1066
1053 (defun isearch-yank-string (string) 1067 (defun isearch-yank-string (string)
1054 "Pull STRING into search string." 1068 "Pull STRING into search string."
1055 ;; Downcase the string if not supposed to case-fold yanked strings. 1069 ;; Downcase the string if not supposed to case-fold yanked strings.
1056 (if (and isearch-case-fold-search 1070 (if (and isearch-case-fold-search
1108 (and (not isearch-forward) isearch-other-end 1122 (and (not isearch-forward) isearch-other-end
1109 (goto-char isearch-other-end)) 1123 (goto-char isearch-other-end))
1110 (buffer-substring-no-properties (point) (funcall jumpform))))) 1124 (buffer-substring-no-properties (point) (funcall jumpform)))))
1111 1125
1112 (defun isearch-yank-char () 1126 (defun isearch-yank-char ()
1113 "Pull next letter from buffer into search string." 1127 "Pull next character from buffer into search string."
1114 (interactive) 1128 (interactive)
1115 (isearch-yank-internal (lambda () (forward-char 1) (point)))) 1129 (isearch-yank-internal (lambda () (forward-char 1) (point))))
1116 1130
1117 (defun isearch-yank-word-or-char () 1131 (defun isearch-yank-word-or-char ()
1118 "Pull next character or word from buffer into search string." 1132 "Pull next character or word from buffer into search string."
1136 1150
1137 1151
1138 (defun isearch-search-and-update () 1152 (defun isearch-search-and-update ()
1139 ;; Do the search and update the display. 1153 ;; Do the search and update the display.
1140 (when (or isearch-success 1154 (when (or isearch-success
1141 ;; unsuccessful regexp search may become 1155 ;; Unsuccessful regexp search may become successful by
1142 ;; successful by addition of characters which 1156 ;; addition of characters which make isearch-string valid
1143 ;; make isearch-string valid
1144 isearch-regexp 1157 isearch-regexp
1145 ;; If the string was found but was completely invisible, 1158 ;; If the string was found but was completely invisible,
1146 ;; it might now be partly visible, so try again. 1159 ;; it might now be partly visible, so try again.
1147 (prog1 isearch-hidden (setq isearch-hidden nil))) 1160 (prog1 isearch-hidden (setq isearch-hidden nil)))
1148 ;; In reverse search, adding stuff at 1161 ;; In reverse search, adding stuff at
1465 (setq isearch-point (point)) 1478 (setq isearch-point (point))
1466 (setq prefix-arg arg) 1479 (setq prefix-arg arg)
1467 (command-execute scroll-command) 1480 (command-execute scroll-command)
1468 (let ((ab-bel (isearch-string-out-of-window isearch-point))) 1481 (let ((ab-bel (isearch-string-out-of-window isearch-point)))
1469 (if ab-bel 1482 (if ab-bel
1470 (isearch-back-into-window (eq ab-bel 'above) isearch-point))) 1483 (isearch-back-into-window (eq ab-bel 'above) isearch-point)
1484 (or (eq (point) isearch-point)
1485 (goto-char isearch-point))))
1471 (isearch-update)) 1486 (isearch-update))
1472 (search-exit-option 1487 (search-exit-option
1473 (let (window) 1488 (let (window)
1474 (isearch-unread-key-sequence keylist) 1489 (isearch-unread-key-sequence keylist)
1475 (setq main-event (car unread-command-events)) 1490 (setq main-event (car unread-command-events))
1744 (defun isearch-message (&optional c-q-hack ellipsis) 1759 (defun isearch-message (&optional c-q-hack ellipsis)
1745 ;; Generate and print the message string. 1760 ;; Generate and print the message string.
1746 (let ((cursor-in-echo-area ellipsis) 1761 (let ((cursor-in-echo-area ellipsis)
1747 (m (concat 1762 (m (concat
1748 (isearch-message-prefix c-q-hack ellipsis isearch-nonincremental) 1763 (isearch-message-prefix c-q-hack ellipsis isearch-nonincremental)
1749 isearch-message 1764 (if (and (not isearch-success)
1765 (string-match " +$" isearch-message))
1766 (concat
1767 (substring isearch-message 0 (match-beginning 0))
1768 (propertize (substring isearch-message (match-beginning 0))
1769 'face 'trailing-whitespace))
1770 isearch-message)
1750 (isearch-message-suffix c-q-hack ellipsis) 1771 (isearch-message-suffix c-q-hack ellipsis)
1751 ))) 1772 )))
1752 (if c-q-hack 1773 (if c-q-hack
1753 m 1774 m
1754 (let ((message-log-max nil)) 1775 (let ((message-log-max nil))
1791 ""))) 1812 "")))
1792 1813
1793 1814
1794 ;; Searching 1815 ;; Searching
1795 1816
1796 (defvar isearch-search-fun-function nil "Override `isearch-function-fun'.") 1817 (defvar isearch-search-fun-function nil
1818 "Override `isearch-search-fun'.
1819 This function should return the search function for isearch to use.
1820 It will call this function with three arguments
1821 as if it were `search-forward'.")
1797 1822
1798 (defun isearch-search-fun () 1823 (defun isearch-search-fun ()
1799 "Return the function to use for the search. 1824 "Return the function to use for the search.
1800 Can be changed via `isearch-search-fun-function' for special needs." 1825 Can be changed via `isearch-search-fun-function' for special needs."
1801 (if isearch-search-fun-function 1826 (if isearch-search-fun-function