Subject: bug#53417: reftex-change-label behavior

From: Joseph Helfer <[email-masked]>
Date: Fri, 21 Jan 2022 10:03:41 -0800

Hello,

I apologize if I am not following the usual protocols for bug reports.

This is somewhere between a bug report and a feature request.

The function `reftex-change-label' defined in
`lisp/textmodes/reftex-global.el' asks for the label you want to
change (`from') and what you want to change it to (`to'). The default
value for `from' is the label under point, which is good. I think the
initial input for `to' should be this as well (or rather, whatever was
entered for `from'), since usually, one just wants to make a small
change.

This is a trivial edit. I have attached an appropriate patch for the file
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/textmodes/reftex-global.el?h=emacs-28.0.91

It could be better to add a customizable variable to control this
behavior, but I am not familiar enough with the reftex code to provide
a patch for that now. However, I think the new proposed behavior is
better, and I doubt that any existing code depends on the old
behavior.

Best,
Joj
--- reftex-global.el	2022-01-21 09:49:22.089091968 -0800
+++ reftex-global-patched.el	2022-01-21 09:51:20.594179163 -0800
@@ -183,7 +183,7 @@
     (if (string= from "") (setq from default))
     (unless to
       (setq to (read-string (format "Replace label %s with: "
-                                    from))))
+                                    from) from)))
     (reftex-query-replace-document
      (concat "{" (regexp-quote from) "}")
      (format "{%s}" to))))