B. T. Raven wrote:
Thanks, Kevin. Now that I understand what's going on, it doesn't seem like
it's worth while just to save a few hundred bytes. I had an idea to save
the qrh into a saved association list, something like:
(setq sal (cons (cons (cadr query-replace-history) (car
You could use desktop-save-mode and add query-replace-history to
The idea is to re-load this later and run query replace in batch mode on
other files. I have no idea how to do this in detail but it seems possible
and it would be very useful to me. Maybe instead of setting it to 2, I'll
set it to t, and then then figure out how to manipulate the resulting flat
list of strings after an hours' long session of query-replacing.
You could also set desktop-base-file-name to specify a file just for
this specific purpose, and save just the last elements of
,----[ C-h v desktop-save-hook RET ]
| desktop-save-hook is a variable defined in `desktop.el'.
| Its value is nil
| Normal hook run before the desktop is saved in a desktop file.
| This is useful for truncating history lists, for example.
| You can customize this variable.
(setq desktop-base-file-name ".emacs.batch.desktop"
(when (cdr (cdr query-replace-history))
(setcdr (cdr query-replace-history) nil))))
Since for my needs this list (sal) of dotted pairs would be a few thousand
elements long, it is probably not the best data structure to use. Could
something along this line be done with a hash table?
Do you want all of the history or not? If you only want 2 elements as
you originally said, then don't bother saving and manipulating anything
else. If you do want the whole history, a list of strings may be as
good as anything -- after all, how do you know which search and replace
strings to use?
Finally, note that you can set query-replace-from-history-variable
and query-replace-to-history-variable to different symbols, and save