all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 67438@debbugs.gnu.org
Subject: bug#67438: 29.1; WDired uses `substitute-in-file-name', so `$$' is changed to `$' - undocumented?
Date: Fri, 24 Nov 2023 23:35:54 +0000	[thread overview]
Message-ID: <SJ0PR10MB54882F5E0E2DAD1855BA1FE1F3B8A@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)

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






             reply	other threads:[~2023-11-24 23:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 23:35 Drew Adams [this message]
2023-11-25  8:11 ` bug#67438: 29.1; WDired uses `substitute-in-file-name', so `$$' is changed to `$' - undocumented? Eli Zaretskii
2023-11-25  8:44   ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB54882F5E0E2DAD1855BA1FE1F3B8A@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=67438@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.