Subject: 24.3.50; `read-from-minibuffer' to allow transforming input before adding to HIST

From: Drew Adams <[email-masked]>
Date: Sat, 3 Aug 2013 09:53:40 -0700 (PDT)

(`read-from-minibuffer' is still coded in C...)

Enhancement request: Provide a global variable whose value would be nil
or a function to transform the input chosen for `read-from-minibuffer',
before adding it to the history variable.

A use case: a command that uses `completing-read' to choose among
absolute file names and uses `file-name-history' as the HIST argument.

This means (intentionally) that the candidates are not abbreviated with
`abbreviate-file-name', so a candidate might look like this:
"/usr/foo/toto/bar.el" instead of, say, this: "~/toto/bar.el".

But `read-file-name' puts abbreviated file names, such as
"~/toto/bar.el" on `file-name-history' (as it should).  Obviously,
simple string comparisons (e.g., to avoid the cost of file access) on
file names will not work: "/usr/foo/toto/bar.el" is not `equal' to
"~/toto/bar.el", for instance.

I would like to be able to let-bind a global variable around a call to
`completing-read' to, say, function `abbreviate-file-name'.  The
completion candidates would still be absolute, unabbreviated file names,
but when added to `file-name-history' they would be abbreviated.

Other input transformations might also be useful before adding to a
minibuffer history, besides the use case mentioned above.

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-07-21 on ODIEONE
Bzr revision: 113485 [email-masked]
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 CFLAGS=-O0 -g3 LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'