Newbie question: I'm trying to record a keyboard macro with a simple regexp inside (search-backward-regexp ^[0-9]). This works well when recording the macro, but as soon as I try to execute it, the search fails because emacs puts the brackets twice (message Search failed: "^[[0-9]]"). How do I do this right?

  • 1
    It could be a problem with something like electric-pair-mode. Can you try using Emacs with no init file (emacs -q) to reproduce the issue? – user12563 Sep 18 '19 at 12:40
  • What @DoMiNeLa10 said: try to repro using emacs -Q. And please show the relevant part of your actual code. The sexp you show can't be the one in the code - the arg to search-backward-regexp must be a string, for example. – Drew Sep 18 '19 at 16:02
  • A possible workaround would be to use C-q [ to enter the [ – phils Sep 19 '19 at 5:08
  • Also, did you record the macro in the same buffer you executed it in? – phils Sep 19 '19 at 5:14

Your Answer

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

Browse other questions tagged or ask your own question.