3

Any existing package that can do incremental search inside a function definition instead of the whole buffer?

Now the best I can do is to turn on semantic-mode along with semantic-stickyfunc-mode and carefully search within its scope.

  • 1
    Can you explain what you want more clearly? Do what to do the search from an elisp function, or do want to search interactively within the text of a function definition in some file? In the latter case, you could use narrowing to limit the search. – Andrew Swann Mar 13 '17 at 7:39
  • 7
    C-x n d (or M-x narrow-to-defun) then search? – xuchunyang Mar 13 '17 at 9:17
3

As @xuchunyang said in a comment to your question, you can first narrow the buffer to the function definition.

Or you can use library Isearch+, which lets you search just the active region, without narrowing.

Non-nil option isearchp-restrict-to-region-flag does this. You can use C-x n (command isearchp-toggle-region-restriction) during search to toggle this option value.

Also, deactivation of the active region when you search is controlled by option isearchp-deactivate-region-flag.

(NOTE: For search to be limited to the active region in Info, you must also use library Info+.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.