From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: William Xu Newsgroups: gmane.emacs.devel Subject: Re: Raw string literals in Emacs lisp. Date: Tue, 29 Jul 2014 14:32:31 +0800 Organization: the Church of Emacs Message-ID: <87k36w8ykg.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1406615722 7102 80.91.229.3 (29 Jul 2014 06:35:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jul 2014 06:35:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 29 08:35:17 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 1XC10G-00025D-L6 for ged-emacs-devel@m.gmane.org; Tue, 29 Jul 2014 08:35:16 +0200 Original-Received: from localhost ([::1]:43893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC10G-0005JW-8s for ged-emacs-devel@m.gmane.org; Tue, 29 Jul 2014 02:35:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC108-0005GG-Vw for emacs-devel@gnu.org; Tue, 29 Jul 2014 02:35:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC103-0002y7-Q8 for emacs-devel@gnu.org; Tue, 29 Jul 2014 02:35:08 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:35005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC103-0002uo-JN for emacs-devel@gnu.org; Tue, 29 Jul 2014 02:35:03 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XC101-0001yQ-0z for emacs-devel@gnu.org; Tue, 29 Jul 2014 08:35:01 +0200 Original-Received: from amprx01x.nokia.com ([192.100.130.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Jul 2014 08:35:01 +0200 Original-Received: from william.xwl by amprx01x.nokia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Jul 2014 08:35:01 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 32 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: amprx01x.nokia.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.91 (gnu/linux) Cancel-Lock: sha1:AbepWrZ9BlDKRTPqUBpVUXMooc8= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:173234 Archived-At: Matthew Plant writes: > I think that raw string literals would be a really nice thing to add to Emacs > lisp. The most immediate benefit is that writing regexps would be much easier. > And since most of the work that goes into major modes is writing regexp, writing > major modes would become a lot faster. Would love to have this! Here is one of my recent use case: "quote bashslash in a shell command". 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? -- William http://xwl.appspot.com