emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Raw string literals in Emacs lisp.


From: William Xu
Subject: Re: Raw string literals in Emacs lisp.
Date: Tue, 29 Jul 2014 14:32:31 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.91 (gnu/linux)

Matthew Plant <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]