Path: utzoo!utgpu!watserv1!watmath!uunet!bu.edu!bu-cs!snorkelwacker!think!samsung!cs.utexas.edu!tut.cis.ohio-state.edu!NCoast.ORG!allbery From: allbery@NCoast.ORG Newsgroups: gnu.emacs Subject: search the 2nd time Message-ID: <9002081454.AA08323@NCoast.ORG> Date: 8 Feb 90 14:54:43 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 38 In my message of Wed, 07 Feb 90 18:57:50 EST, I got line-noised into saying: +--------------- | (defun repe{\017vt-sw3earch-forward () | "Repeat search" | (interactive) | (search-forward "")) +--------------- Oh, line noise is wonderful.... That was supposed to be "repeat-search-forward", not that silly scramble up there. And in any case, it turns out that search-forward doesn't repeat on a null string anyway. That was rather useful in Jove.... It's still doable; you you just need some more involved functions. Oh, say, (defvar my-remembered-search-string "" "The last non-null string searched for with my-search-forward.") ;;this could go either way; comment the next line out for global recall. (make-variable-buffer-local 'my-remembered-search-string) (defun my-search-forward (s) "Search forward, remembering the search string for possible repetition." (interactive "sSearch for: ") (if (string= s "") (my-repeat-search-forward) (setq my-remembered-search-string s) (search-forward s))) (defun my-repeat-search-forward "Repeat the last my-search-forward." (interactive) (and (string= my-remembered-search-string "") (error "No remembered search string")) (search-forward my-remembered-search-string)) ++Brandon