DRB@MATH.AMS.COM (Drew Burton) (02/08/90)
Some people here (edt users) want search mapped to a key and re-search for that string mapped to another key. I see the function re-search, but I don't know how to make it keep the search string like the 2nd ctrl-S does. Would someone show me how to do this? We're running GNU.18.51 on a Ultrix machine. Thanks Drew Burton American Math Society drb@math.ams.com -------
rodney@sun.ipl.rpi.edu (Rodney Peck II) (02/08/90)
>>>>> On 7 Feb 90 19:57:17 GMT, DRB@MATH.AMS.COM (Drew Burton) said:
Drew> Some people here (edt users) want search mapped to a key
Drew> and re-search for that string mapped to another key. I see the function
Drew> re-search, but I don't know how to make it keep the search string like
Drew> the 2nd ctrl-S does. Would someone show me how to do this?
I think there might be some confusion here as to what "re-search"
means. In emacs, it's short for "regular expression search". In your
context, re-search doesn't make sense. Why would you want to regexp
search for a string you just typed? Ordinary search will work fine
for that case.
What you want is a function that makes a "re-search" as in "search
again" for the same word.
The command "re-search" has nothing to do with that sort of thing.
It lets you do things like find words at the beginning of the line
like "^means" or something like that.
--
Rodney
allbery@NCoast.ORG (02/08/90)
In your message of Wed, 07 Feb 90 14:57:17 EST, you write: +--------------- | Some people here (edt users) want search mapped to a key | and re-search for that string mapped to another key. I see the function | re-search, but I don't know how to make it keep the search string like | the 2nd ctrl-S does. Would someone show me how to do this? | We're running GNU.18.51 on a Ultrix machine. | Thanks | Drew Burton | American Math Society | drb@math.ams.com | ------- +--------------- Emacs "re-search" does not mean "repeat search"; it means "search using regular expression". To repeat a search, simply call the search function again and press RET for the search string. It is possible that you can formalize that as a function (untested): (defun repe{vt-sw3earch-forward () "Repeat search" (interactive) (search-forward "")) No promises.... ++Brandon
composer@bucsf.bu.edu (Jeff Kellem) (02/08/90)
In article <RODNEY.90Feb7164233@sun.ipl.rpi.edu> rodney@sun.ipl.rpi.edu (Rodney Peck II) writes: | >>>>> On 7 Feb 90 19:57:17 GMT, DRB@MATH.AMS.COM (Drew Burton) said: | | Drew> Some people here (edt users) want search mapped to a key | Drew> and re-search for that string mapped to another key. I see the | Drew> function re-search, but I don't know how to make it keep the search | Drew> string like the 2nd ctrl-S does. Would someone show me how to do | Drew> this? ...some text deleted... | What you want is a function that makes a "re-search" as in "search | again" for the same word. Actually, if all that is wanted is to search for the last incremental regexp search pattern used, then you already have what you want. Just as `C-s C-s' (or `C-r C-r') will recall the last string searched for, `M-C-s C-s' (or `M-C-r C-r') will recall the last regexp pattern searched for. This all assumes the default bindings of `C-s' to isearch-forward, and `M-C-s' to isearch-forward-regexp. Enjoy... -jeff p.s. All the above info is located in the GNU Emacs manual.. :) Jeff Kellem INTERNET: composer@cs.bu.edu (or composer@bu.edu) UUCP: ...!harvard!bu-cs!composer
allbery@NCoast.ORG (02/08/90)
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