0

For example: I want the regexp ^\*.* to appear as the search pattern after typing M-x isearch-forward-regexp and <return>.

Big Shield
  • 612
  • 5
  • 15

1 Answers1

0

I found the solution:

(defun foo ()
  (cond
   ((string= (minibuffer-prompt) "Regexp search: ")
    (insert "^\\*.*"))))
(add-hook 'minibuffer-setup-hook 'foo)
  1. Press C-M-s and <return>, then the regexp ^\*.* will appear as the search pattern.
  2. Complement the full regexp (such as ^\*.*emacs) and <return>.
  3. Press C-M-s and C-s to search incrementally.

References:

Big Shield
  • 612
  • 5
  • 15