3

I have enabled query replace save history as below. When I am in query-replace mode, I see previous search-replace patterns of the current session in the form "ABC -> XYZ". But the search-replace patterns from previous emacs sessions dont show up as "LMN -> PQR" instead they show up as LMN for search pattern and then I need to again search for PQR as replace pattern. Is there a way to improve this?

;;Save Search history                                                                                                                                                 
(setq savehist-additional-variables                                                                                                                                   
      '(search-ring regexp-search-ring compile-history)                                                                                                               
      savehist-file "~/.emacs.d/savehist")                                                                                                                            
(savehist-mode t) 
1

The history of query-replace replacement pairs can be saved by adding query-replace-defaults (and also optionally query-replace-history) to savehist-additional-variables.

| improve this answer | |
  • Thanks a lot @link0ff, it works.. – emacsbeginner May 15 at 7:11

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.