all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#67438: 29.1; WDired uses `substitute-in-file-name', so `$$' is changed to `$' - undocumented?
@ 2023-11-24 23:35 Drew Adams
  2023-11-25  8:11 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2023-11-24 23:35 UTC (permalink / raw)
  To: 67438

emacs -Q

C-x d aaa   ; Go to a directory with a file named `aaa'

C-x C-q

Append $$$$ to the file name, to give `aaa$$$$'

C-x C-q

The resulting file was named `aaa$$', not `aaa$$$$'.

It seems that every occurrence of `$$' in a file name is treated as just
`$'.  (The position of the `$$' in the new file name seems to be
irrelevant.)

I see this in older Emacs releases as well.  I found nothing in the doc
that would indicate that this is supposed to happen (and preferably
why).  And the only occurrence of char `$' in wdired.el seems benign.

Ah, I found it - it comes from `substitute-in-file-name':

  (substitute-in-file-name "aa$$$$") ; -> "aa$$"

But is that appropriate behavior in this context?  If it is, then maybe
the doc should tell you what to do if you want literal `$' chars.  (I
tried escaping with `\$`, but that ended up being changed to `/' and
changing the file to an empty directory!)

OK, the doc of `substitute-in-file-name' says to use `$$' to get a
single `$'.  So that's clear enough.  But what's not clear from the
WDired doc is that that function is used (instead of `expand-file-name')
by WDired.

The WDired doc is pretty scant, overall.  This, at least, should be
mentioned I think.  And any other gotchas - special (non-literal)
treatment of the text used in file names.  That would include use of
`\' as a directory separator on MS Windows, I suppose.


In GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-08-02 built on
 AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19045
System Description: Microsoft Windows 10 Pro (v10.0.2009.19045.3570)

Configured using:
 'configure --with-modules --without-dbus --with-native-compilation=aot
 --without-compress-install --with-tree-sitter CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

(NATIVE_COMP present but libgccjit not available)

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-25  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-24 23:35 bug#67438: 29.1; WDired uses `substitute-in-file-name', so `$$' is changed to `$' - undocumented? Drew Adams
2023-11-25  8:11 ` Eli Zaretskii
2023-11-25  8:44   ` Andreas Schwab

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.