From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Whitfield Diffie Newsgroups: gmane.emacs.help Subject: Newlines in file names Date: Mon, 10 Dec 2012 11:47:54 -0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1355169712 18163 80.91.229.3 (10 Dec 2012 20:01:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Dec 2012 20:01:52 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 10 21:02:06 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 1Ti9YB-00017Z-4K for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Dec 2012 21:02:03 +0100 Original-Received: from localhost ([::1]:34135 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ti9Xy-0004zN-Kw for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Dec 2012 15:01:50 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ti9KZ-0002VO-M5 for help-gnu-emacs@gnu.org; Mon, 10 Dec 2012 14:48:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ti9KV-0001Uq-OO for help-gnu-emacs@gnu.org; Mon, 10 Dec 2012 14:47:59 -0500 Original-Received: from mail-qa0-f48.google.com ([209.85.216.48]:47419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ti9KV-0001Ul-KY for help-gnu-emacs@gnu.org; Mon, 10 Dec 2012 14:47:55 -0500 Original-Received: by mail-qa0-f48.google.com with SMTP id l8so2345695qaq.0 for ; Mon, 10 Dec 2012 11:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=Oig3wwRHf39OinWKS5LRBr3rvPkXbrrL3SErTpCTw8w=; b=cMUZ3wG/h88eTItcPZzWDa626CxCC6U/L4N8Xn/WDjQBBPEe403UoXYLpCKQAQ+XSQ 8mitu811ucshS/fi9nMCUKl7FCgdTgTvfZavw8MO61DnU7MZPg/XStoUy7RzLJz3Ijgj oCZloEmv7CrCjCDg1F/UFpFJNkA6RTlXJVDZXhjTqAKl4h6vdf+l3MMetyX6zZwoGsaP fH7fciyHIlJKmVXeRAFPub6cQaaJVf2lLFITU6Kl+fT9RaDPcNgOf9aqcHTqm5MLvxSQ oht4xgPknz/f4JkKZLM/wPdGNGnh8xFBGAPR4IlSzJwFdHtDlD8HB6FpuDsHXwLSQGj6 xJAA== Original-Received: by 10.49.48.113 with SMTP id k17mr33918504qen.51.1355168874571; Mon, 10 Dec 2012 11:47:54 -0800 (PST) Original-Received: by 10.49.36.229 with HTTP; Mon, 10 Dec 2012 11:47:54 -0800 (PST) X-Google-Sender-Auth: kvVnxs73tChD8vvRQJSORMIhOW8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.216.48 X-Mailman-Approved-At: Mon, 10 Dec 2012 15:01:46 -0500 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:88117 Archived-At: Question: How do you translate a filename containing a newline to one containing a \n without getting a \\n. Problem: Create a directory ``test''. 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.) This directory now appears as /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 Place the cursor on the line with the Icon file and type : (file-exists-p (dired get filename)) The response is ``nil''. Make the buffer writable with and edit the name by hand to ``Icon\n''. Type : (file-exists-p (dired-get-filename)) The response is now ``t''. Type g to revert the buffer and the name returns to being ``Icon''. Place the cursor on the line with the Icon file again and type M+x The entire file line disappears leaving only . and .. in the directory. Type g to revert the buffer and the line reappears but the file has not become executable. Edit the filename as before and repeat the attempt to make it executable. Now the file line becomes -rwxr-xr-x 1 diffie staff 0 Dec 9 10:01 Icon The file has become executable but its name has returned to being ``Icon'', lacks the newline character. Objective: Repair dired so that filenames containing newlines are displayed with \n in place of newline characters (and \r in place of carriage returns). 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. Whit