From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Aur=C3=A9lien_Aptel?= Newsgroups: gmane.emacs.help Subject: Re: quote bashslash in a shell command Date: Mon, 7 Jul 2014 13:34:00 +0200 Message-ID: References: <87mwcmqwx2.fsf@kuiper.lan.informatimago.com> <87vbr9znsl.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1404732864 7736 80.91.229.3 (7 Jul 2014 11:34:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Jul 2014 11:34:24 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: William Xu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 07 13:34:18 2014 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 1X47Ba-0001Pd-4z for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Jul 2014 13:34:18 +0200 Original-Received: from localhost ([::1]:49430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X47BZ-0003Mg-PJ for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Jul 2014 07:34:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X47BL-0003MV-DM for help-gnu-emacs@gnu.org; Mon, 07 Jul 2014 07:34:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X47BK-0008Lh-5X for help-gnu-emacs@gnu.org; Mon, 07 Jul 2014 07:34:03 -0400 Original-Received: from mail-la0-x233.google.com ([2a00:1450:4010:c03::233]:56424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X47BJ-0008LT-T5 for help-gnu-emacs@gnu.org; Mon, 07 Jul 2014 07:34:02 -0400 Original-Received: by mail-la0-f51.google.com with SMTP id mc6so2782487lab.10 for ; Mon, 07 Jul 2014 04:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Qpc+veD54L6qAmX/2yDjYW031RkAJgbvzPHTykU6grk=; b=ZA/P/38qkvINU71+VO0mG/1mVd1EHgcwONtICO6G7LMeIg4dLn2MMTE7H4KDluzhN2 59z+re708wlHFarBFLw7yxN7iOYAW4kqHSARWMASOMtEcMoIH/S1umyAaSEEsjdkVKLT MDN5Tb1dNSBw+Q+GjmHHnAjCil+GskxwuGU1sKRuod/9J7Z1idz9IH0rfRRtjcPaqfOw ZLv5QAmhuaPUNY4tifdC2NTYbkZxBj/5ErQyjLIjL8FCpRL79+wm6HmZ8MYlJ9vP5yz9 iYEspGQlNbZmV+cc9c3+h0h4nqjcHhZnwfdgvZOnram1KtnY3PvKAv9mR7rN0OIbCo+z cV3w== X-Received: by 10.113.3.69 with SMTP id bu5mr21091370lbd.29.1404732840865; Mon, 07 Jul 2014 04:34:00 -0700 (PDT) Original-Received: by 10.114.77.202 with HTTP; Mon, 7 Jul 2014 04:34:00 -0700 (PDT) In-Reply-To: <87vbr9znsl.fsf@gmail.com> X-Google-Sender-Auth: J--6BWuzkQqTQ_SPFWNFmkHjVm0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::233 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:98558 Archived-At: On Mon, Jul 7, 2014 at 8:27 AM, William Xu wrote: > What i'd like to have is that i try a shell command on bash, then i can > simpy copy and paste in elisp. I don't think it's possible. It's a good use case for raw strings (which I've tried to get in vanilla emacs [1]) or more generally reader macros (see Pascal's post). But what you can do is copy and paste your shell code, select it, and call this function: (defun my-raw-string (start end) (interactive "r") (let ((r (prin1-to-string (buffer-substring-no-properties start end)))) (delete-region start end) (insert r))) which will turn this: a b \ c to this: "a b \\ c" 1: http://definitelyaplug.b0.cx/post/raw-strings/