Subject: Re: bug#22479: 25.0.50; isearch and query-replace histories do not remember if we were looking for symbols

From: Juri Linkov <[email-masked]>
Date: Sun, 31 Jan 2016 02:04:58 +0200

> Hi. #11378 doesn't talk about keeping the meta-data in the history
> generically. It mentions remembering the state for the last search, but
> you'd still have the issue in this bug for older searches. So unless
> I missed it (very possible since it was a very long thread), that bug
> doesn't touch on this. We can propose new things, however :)
>
> I don't know how much complexity we want here. Each history item can
> be a richer structure than just the search string. Too much?

Yes, this is a harder problem.  We have to remember meta-data for
every search history element.  There are several possibilities:

1. Changing the current format of ‘search-ring’ and ‘regexp-search-ring’
   is not backward-compatible: for external packages, for desktop.el,
   for savehist.el.

   Also note that distinction between these two variables already
   remembers one particular search parameter: either an ordinary or
   regexp search.  So we don't need to remember the regexp search
   parameter alongside with the value of the search search.
   OTOH, by remembering it with the value, we can obsolete
   ‘regexp-search-ring’.

2. Adding more such variables for other search parameters:
   ‘word-search-ring’, ‘symbol-search-ring’, ‘char-fold-search-ring’.
   A big mess ensues...

3. Using an additional variable with only meta-data requires keeping it
   in sync with the values in ‘search-ring’ and ‘regexp-search-ring’.

4. Adding meta-data by text-properties to the strings in
   ‘search-ring’ and ‘regexp-search-ring’ poses a problem of saving
   the values in the desktop and restoring in another session.

5. More ideas? ;)