From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: Raw string literals in Emacs lisp. Date: Tue, 29 Jul 2014 09:40:50 +0200 Message-ID: References: <87k36w8ykg.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1406619675 20124 80.91.229.3 (29 Jul 2014 07:41:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jul 2014 07:41:15 +0000 (UTC) Cc: emacs-devel@gnu.org To: William Xu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 29 09:41:09 2014 Return-path: Envelope-to: ged-emacs-devel@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 1XC21x-00014e-PL for ged-emacs-devel@m.gmane.org; Tue, 29 Jul 2014 09:41:05 +0200 Original-Received: from localhost ([::1]:44034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC21x-00008k-BJ for ged-emacs-devel@m.gmane.org; Tue, 29 Jul 2014 03:41:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC21q-0008W8-2R for emacs-devel@gnu.org; Tue, 29 Jul 2014 03:41:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC21k-000434-8q for emacs-devel@gnu.org; Tue, 29 Jul 2014 03:40:57 -0400 Original-Received: from cantor2.suse.de ([195.135.220.15]:46832 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC21k-000427-3I for emacs-devel@gnu.org; Tue, 29 Jul 2014 03:40:52 -0400 Original-Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 55D09ACB4; Tue, 29 Jul 2014 07:40:51 +0000 (UTC) X-Yow: Yow! Are we laid back yet? In-Reply-To: <87k36w8ykg.fsf@gmail.com> (William Xu's message of "Tue, 29 Jul 2014 14:32:31 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:173235 Archived-At: William Xu writes: > Here is one of my recent use case: "quote bashslash in a shell command". This is not about shell command syntax, but about Lisp syntax. > http://permalink.gmane.org/gmane.emacs.help/98550 > > The shell command is: > echo foo.bar | sed -e 's/\..*//' > > which will produce "foo" on bash. > > If i try to pass it to shell-command-to-string: > (shell-command-to-string "echo foo.bar | sed -e 's/\..*//'") > => "\n" > > Then i find i need to quote the backslash in emacs once more: > (shell-command-to-string "echo foo.bar | sed -e 's/\\..*//'") > => "foo\n" > > Is there a function or other way that can handle this kind of backslash > quoting automatically? Since this is part of the Lisp syntax, so there is no way to solve that programmatically. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."