aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-10-24 04:05:22 +0000
committerRichard M. Stallman1993-10-24 04:05:22 +0000
commit30d47262d12a35bb381f1ca66cbf0428183270fc (patch)
tree709d3b52c326979771667be7402d5246e97a52b2
parent4133ab490815babb0d9639b1036326659e3f2e5c (diff)
downloademacs-30d47262d12a35bb381f1ca66cbf0428183270fc.tar.gz
emacs-30d47262d12a35bb381f1ca66cbf0428183270fc.zip
(isearch-yank): Handle `kill' as chunk type.
(isearch-yank-kill): New command, on M-y and mouse-2.
-rw-r--r--lisp/isearch.el39
1 files changed, 26 insertions, 13 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 0e39cdcb845..4330848b6bd 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu> 5;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
6 6
7;; |$Date: 1993/10/09 20:00:23 $|$Revision: 1.50 $ 7;; |$Date: 1993/10/09 20:03:33 $|$Revision: 1.51 $
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
@@ -233,6 +233,9 @@ Default value, nil, means edit the string instead.")
233 233
234 (define-key map "\C-w" 'isearch-yank-word) 234 (define-key map "\C-w" 'isearch-yank-word)
235 (define-key map "\C-y" 'isearch-yank-line) 235 (define-key map "\C-y" 'isearch-yank-line)
236 (define-key map [mouse-2] 'isearch-yank-kill)
237 ;; This overrides the default binding for t.
238 (define-key map [down-mouse-2] 'nil)
236 239
237 ;; Bind the ASCII-equivalent "function keys" explicitly 240 ;; Bind the ASCII-equivalent "function keys" explicitly
238 ;; if we bind their equivalents, 241 ;; if we bind their equivalents,
@@ -266,6 +269,7 @@ Default value, nil, means edit the string instead.")
266 269
267 (define-key map "\M-n" 'isearch-ring-advance) 270 (define-key map "\M-n" 'isearch-ring-advance)
268 (define-key map "\M-p" 'isearch-ring-retreat) 271 (define-key map "\M-p" 'isearch-ring-retreat)
272 (define-key map "\M-y" 'isearch-yank-kill)
269 273
270 (define-key map "\M-\t" 'isearch-complete) 274 (define-key map "\M-\t" 'isearch-complete)
271 275
@@ -854,18 +858,23 @@ If no previous match was done, just beep."
854 858
855(defun isearch-yank (chunk) 859(defun isearch-yank (chunk)
856 ;; Helper for isearch-yank-word and isearch-yank-line 860 ;; Helper for isearch-yank-word and isearch-yank-line
857 (let ((string (save-excursion 861 ;; CHUNK should be word, line or kill.
858 (and (not isearch-forward) isearch-other-end 862 (let ((string (cond
859 (goto-char isearch-other-end)) 863 ((eq chunk 'kill)
860 (buffer-substring 864 (current-kill 0))
861 (point) 865 (t
862 (save-excursion 866 (save-excursion
863 (cond 867 (and (not isearch-forward) isearch-other-end
864 ((eq chunk 'word) 868 (goto-char isearch-other-end))
865 (forward-word 1)) 869 (buffer-substring
866 ((eq chunk 'line) 870 (point)
867 (end-of-line))) 871 (save-excursion
868 (point)))))) 872 (cond
873 ((eq chunk 'word)
874 (forward-word 1))
875 ((eq chunk 'line)
876 (end-of-line)))
877 (point))))))))
869 ;; Downcase the string if not supposed to case-fold yanked strings. 878 ;; Downcase the string if not supposed to case-fold yanked strings.
870 (if (and isearch-case-fold-search 879 (if (and isearch-case-fold-search
871 (eq 'not-yanks search-upper-case)) 880 (eq 'not-yanks search-upper-case))
@@ -880,6 +889,10 @@ If no previous match was done, just beep."
880 isearch-yank-flag t)) 889 isearch-yank-flag t))
881 (isearch-search-and-update)) 890 (isearch-search-and-update))
882 891
892(defun isearch-yank-kill ()
893 "Pull string from kill ring into search string."
894 (interactive)
895 (isearch-yank 'kill))
883 896
884(defun isearch-yank-word () 897(defun isearch-yank-word ()
885 "Pull next word from buffer into search string." 898 "Pull next word from buffer into search string."