1

Windows 10, Emacs 26.1

Steps:

  1. Start Emacs
  2. Open *scratch* buffer.
  3. C-s text
  4. C-g
  5. C-s visit
  6. C-g

Nice. Now I want to go backward and forward through search history with M-p and M-n respectively. But I get error:

M-p/M-n is underfined". 

If I input command "previous-history-element" I get another error: Wrong type argument: number-or-marker-p, nil

I try this in pure Emacs by: emacs -Q

But I get same errors.

6
  • Why are you typing M-x C-s? I've just checked Emacs 26.1 under windows 7 without any init file, and isearch history seems to just work for me.
    – user12563
    Commented Oct 24, 2018 at 17:53
  • Maybe this will help out a little bit: asciinema.org/a/nzAMu0WCJrV9vPVV4was69qZk
    – user12563
    Commented Oct 24, 2018 at 18:01
  • Because C-s is incremental search forward (isearch-forward) Commented Oct 24, 2018 at 20:06
  • 1
    You don't need to prefix it with M-x.
    – user12563
    Commented Oct 24, 2018 at 20:28
  • I update my post. It's not help. I get same error Commented Oct 25, 2018 at 7:17

1 Answer 1

2

When you cancel the search with C-g the search item isn't added to your search history. Try this instead:

  1. Start Emacs
  2. Open scratch buffer.
  3. C-s text
  4. ENTER
  5. C-s visit
  6. ENTER

Now you can access your search history:

  1. C-s
  2. M-n or M-p
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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