1 |
;;; isearch.el --- incremental search minor mode |
;;; isearch.el --- incremental search minor mode |
2 |
|
|
3 |
;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1999, 2000, 2001 |
;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1999, 2000, 01, 2003 |
4 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> |
;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> |
738 |
(if (or (null regexp-search-ring) |
(if (or (null regexp-search-ring) |
739 |
(not (string= string (car regexp-search-ring)))) |
(not (string= string (car regexp-search-ring)))) |
740 |
(progn |
(progn |
741 |
(setq regexp-search-ring |
(push string regexp-search-ring) |
|
(cons string regexp-search-ring)) |
|
742 |
(if (> (length regexp-search-ring) regexp-search-ring-max) |
(if (> (length regexp-search-ring) regexp-search-ring-max) |
743 |
(setcdr (nthcdr (1- search-ring-max) regexp-search-ring) |
(setcdr (nthcdr (1- search-ring-max) regexp-search-ring) |
744 |
nil)))) |
nil)))) |
745 |
(if (or (null search-ring) |
(if (or (null search-ring) |
746 |
(not (string= string (car search-ring)))) |
(not (string= string (car search-ring)))) |
747 |
(progn |
(progn |
748 |
(setq search-ring (cons string search-ring)) |
(push string search-ring) |
749 |
(if (> (length search-ring) search-ring-max) |
(if (> (length search-ring) search-ring-max) |
750 |
(setcdr (nthcdr (1- search-ring-max) search-ring) nil)))))) |
(setcdr (nthcdr (1- search-ring-max) search-ring) nil)))))) |
751 |
|
|
1492 |
;; Helper for isearch-complete and isearch-complete-edit |
;; Helper for isearch-complete and isearch-complete-edit |
1493 |
;; Return t if completion OK, nil if no completion exists. |
;; Return t if completion OK, nil if no completion exists. |
1494 |
(let* ((ring (if isearch-regexp regexp-search-ring search-ring)) |
(let* ((ring (if isearch-regexp regexp-search-ring search-ring)) |
|
(alist (mapcar (function (lambda (string) (list string))) ring)) |
|
1495 |
(completion-ignore-case case-fold-search) |
(completion-ignore-case case-fold-search) |
1496 |
(completion (try-completion isearch-string alist))) |
(completion (try-completion isearch-string ring))) |
1497 |
(cond |
(cond |
1498 |
((eq completion t) |
((eq completion t) |
1499 |
;; isearch-string stays the same |
;; isearch-string stays the same |
1505 |
(if completion-auto-help |
(if completion-auto-help |
1506 |
(with-output-to-temp-buffer "*Isearch completions*" |
(with-output-to-temp-buffer "*Isearch completions*" |
1507 |
(display-completion-list |
(display-completion-list |
1508 |
(all-completions isearch-string alist)))) |
(all-completions isearch-string ring)))) |
1509 |
t) |
t) |
1510 |
(and completion |
(and completion |
1511 |
(setq isearch-string completion)))) |
(setq isearch-string completion)))) |
1527 |
(defun isearch-complete-edit () |
(defun isearch-complete-edit () |
1528 |
"Same as `isearch-complete' except in the minibuffer." |
"Same as `isearch-complete' except in the minibuffer." |
1529 |
(interactive) |
(interactive) |
1530 |
(setq isearch-string (buffer-string)) |
(setq isearch-string (field-string)) |
1531 |
(if (isearch-complete1) |
(if (isearch-complete1) |
1532 |
(progn |
(progn |
1533 |
(delete-field) |
(delete-field) |