Is there a way to provide a region to isearch?
I want to overload isearch so that:
C-s -> 1. isearch as usual if no region is selected, OR 2. isearch with region as to-be-used-for-search string
example: i 'select' the words "no exit", then C-s should search the buffer for "no exit". In a way this can be done with C-s C-w C-w when the cursor is at the beginning of "no". I wonder if there is a way to reverse this, so first select (some how) and then use the selection for searching
You may find the commands
narrow-to-region
andwiden
useful, do C-hfnarrow-to-region
RET and C-hfwiden
RET to know moreUPDATE
Here is some quick and dirty code to do what you want, I have not handled some cases for simplicity but this should give an idea
UPDATE 2
Try the following function, this should do what you want