Re: master 49f3888c5dc: Add new options to 'query-replace-show-preview' (bug#81583)
Rahul Martim Juliato <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
Juri Linkov <[email protected]> writes: >>> * lisp/replace.el (query-replace-show-preview): Accept 'both' >>> and a function of two arguments as values. Doc fix. >> >> With these user options with multiple possibilities, where there isn't a >> backwards compatibility issue to consider (as there isn't here), it's >> nice to make it so that `t' turns on all the features and the other >> values turn them on partially. Then there is a natural ordering >> nil->something->other->t. >> >> So could we perhaps make `t' mean `both' and use another symbol for when >> only the result is displayed? > > Another variant is to support either nil or a value with > a function also for the case when only the result is displayed > with e.g. 'replace-preview-only-replacement' instead of t. That would cover this nicely: let the option take a function, and ship the two styles we have as functions, dropping the 'both' symbol. The setup would then be: (setq query-replace-show-preview nil) ; no preview (setq query-replace-show-preview #'replace-preview-only-replacement); bar (setq query-replace-show-preview #'replace-preview-both) ; foo→bar (setq query-replace-show-preview #'my-own-preview) ; anything In Customize it stays a menu with the same names, plus "Other function" for the last case, so nothing gets harder to find. And copying one of the two functions into your init file is the easy way to write the fourth line. The one thing left is whether t stays around as an alias, and for which of the two. What do you both prefer? I can send the patch to bug#81583 once we settle that. -- Rahul Martim Juliato