From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Doug Lewan Newsgroups: gmane.emacs.help Subject: RE: Newlines in file names Date: Tue, 11 Dec 2012 14:02:05 +0000 Message-ID: <155DEC68569B714B86C2C7075F5EDA9828DF1C50@DAKIYA1.pegasus.local> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1355234468 28845 80.91.229.3 (11 Dec 2012 14:01:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Dec 2012 14:01:08 +0000 (UTC) To: Whitfield Diffie , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 11 15:01:22 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TiQOe-00074y-SD for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Dec 2012 15:01:20 +0100 Original-Received: from localhost ([::1]:39927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiQOS-0004qY-8B for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Dec 2012 09:01:08 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiQOH-0004ob-I3 for help-gnu-emacs@gnu.org; Tue, 11 Dec 2012 09:01:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TiQO6-0008Kg-SU for help-gnu-emacs@gnu.org; Tue, 11 Dec 2012 09:00:57 -0500 Original-Received: from webmail.shubertorg.com ([207.246.209.200]:57603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiQO6-0008K3-7i for help-gnu-emacs@gnu.org; Tue, 11 Dec 2012 09:00:46 -0500 Original-Received: from dakiya1.pegasus.local ([172.16.208.201]) by DAKIYA1.pegasus.local ([172.16.208.201]) with mapi id 14.01.0339.001; Tue, 11 Dec 2012 09:02:05 -0500 Thread-Topic: Newlines in file names Thread-Index: AQHN1xFjnh2L49XCjEarDTtfiZc0gJgToVvQ In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.0.21.202] X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 207.246.209.200 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88132 Archived-At: What version of emacs are you using? I don't have such problems in version 24, but I do remember dired using a r= egular expression that wouldn't match such uncommon names in earlier versio= ns. ,Douglas Douglas Lewan Shubert Ticketing (201) 489-8600 ext 224 When I do good, I feel good. When I do bad, I feel bad and that's my religi= on. - Abraham Lincoln > -----Original Message----- > From: help-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org > [mailto:help-gnu-emacs-bounces+dougl=3Dshubertticketing.com@gnu.org] On > Behalf Of Whitfield Diffie > Sent: Monday, 2012 December 10 14:48 > To: help-gnu-emacs@gnu.org > Subject: Newlines in file names >=20 > Question: How do you translate a filename containing a newline to one > containing > a \n without getting a \\n. >=20 > Problem: Create a directory ``test''. >=20 > In the directory create a file with (call-process "touch" nil > nil nil "Icon\n"). > This file's name has five characters of which the last is a > newline. (Such files > appear in some downloads.) >=20 > This directory now appears as >=20 > /Users/diffie/test: > total used in directory 0 available 327738716 > drwxr-xr-x 3 diffie staff 102 Dec 10 11:04 . > drwxr-xr-x 25 diffie staff 850 Dec 10 11:03 .. > -rw-r--r-- 1 diffie staff 0 Dec 9 10:01 Icon >=20 > Place the cursor on the line with the Icon file and type >=20 > : (file-exists-p (dired get filename)) >=20 > The response is ``nil''. >=20 > Make the buffer writable with and edit the > name by hand to ``Icon\n''. Type >=20 > : (file-exists-p (dired-get-filename)) >=20 > The response is now ``t''. >=20 > Type g to revert the buffer and the name returns to being > ``Icon''. >=20 > Place the cursor on the line with the Icon file again and type >=20 > M+x >=20 > The entire file line disappears leaving only . and .. in the > directory. >=20 > Type g to revert the buffer and the line reappears but the > file > has not become executable. >=20 > Edit the filename as before and repeat the attempt to make it > executable. >=20 > Now the file line becomes >=20 > -rwxr-xr-x 1 diffie staff 0 Dec 9 10:01 Icon >=20 > The file has become executable but its name has returned to > being > ``Icon'', lacks the newline character. >=20 > Objective: Repair dired so that filenames containing newlines are > displayed > with \n in place of newline characters (and \r in place of > carriage > returns). >=20 > I have tried setting print-escape-newlines to t and recoding > filename with buffer-file-coding-system, file-name-coding- > system, > and default-file-name-coding-system, without success. >=20 >=20 > Whit