Article View: gnu.emacs.vm.bug
Article #713Re: Can't launch attachments with "spaces" in file name
From: Kevin Rodgers
Date: Mon, 09 Feb 2004 17:50
Date: Mon, 09 Feb 2004 17:50
67 lines
3857 bytes
3857 bytes
Jeffrey J. Kosowsky wrote:
> Kevin Rodgers <ihs_4664@yahoo.com> writes:
>>Indeed. What is system-type on your platform?
>
> windows-nt (which I believe is what you get on NT, Win2K, WinXP, etc)
> Now according to the code for shell-quote-argument, in that case all
> that happens is that \" is added to the beginning and end of the
> string. This seems to be "wrong" according to the help screen on 'cmd'
> under winxp.
>
> Is this a "bug" in subr.el that should be reported to the general
> emacs group or am I missing something here?
Yes, I think you should report it as a bug.
>>lisp/subr.el defines shell-quote-argument, and its result depends on
>>that variable. But none of the alternatives use the quoting
>>convention you describe.
>>
>>If cmd is the shell you use for M-! and M-|, you can probably just redefine
>>it:
>>
>> (defun cmd-quote-argument (argument)
>> "Quote ARGUMENT for a `cmd` command."
>> (let ((result "")
>> (start 0)
>> end)
>> (while (string-match "[][ &(){}^=;!'+,`~]" argument start)
>> (setq end (match-beginning 0)
>> result (concat result
>>
(substring argument start end)
>>
"\"" (substring argument end (1+ end)) "\"")
>> start (1+ end)))
>> (concat result (substring argument start))))
>>
>>(defalias 'shell-quote-argument 'cmd-quote-argument)
>
> I did something just like the above (but also needed to add the
> <space> as you pointed out (and it works!!!)
Uh, there is a space in the regexp: left square bracket, right square bracket,
left square bracket, space, ampersand, ...
> I ended up adding the following:
>
> (defun shell-quote-argument-winxp (argument)
> "Quote an argument for passing as argument to an inferior shell.
> Special fixed version for WinXP (JJK)"
> (let
> ((result "") (start 0) end)
> (while (string-match "[][&(){}^=;!'+,`~ ]" argument start)
> (setq end (match-beginning 0)
> result (concat result (substring argument start end)
> "\"" (substring argument end (1+ end)) "\"")
> start (1+ end)))
> (concat result (substring argument start))))
>
> (if (eq system-type 'windows-nt)
> (defalias 'shell-quote-argument 'shell-quote-argument-winxp))
>
Glad it's working for you.
--
Kevin Rodgers
Technical Details
Message-ID:
<4027C880.70600@yahoo.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mailReferences:
<m2fzekj10g.fsf@consult.pretender> <400320B7.5060408@yahoo.com> <m2k73n2nrb.fsf@consult.pretender> <400D5599.10709@yahoo.com> <m2isj6m7a4.fsf@consult.pretender> <861xpth8a1.fsf@robf.deREMOVETHIS> <m2smi88qsy.fsf@consult.pretender> <86hdyoc6n9.fsf@robf.deREMOVETHIS> <m2y8rscb3z.fsf@consult.pretender> <4017E7FE.8040704@yahoo.com> <m21xpjvd3q.fsf@consult.pretender> <401FCD17.6010700@yahoo.com> <m2llnjn6bs.fsf@consult.pretender> <40241D13.8060908@yahoo.com> <m2ptcqw6lw.fsf@consult.pretender>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6829,6e83a1235cadfbbe X-Google-Attributes: gidf6829,public X-Google-ArrivalTime: 2004-02-09 09:51:01 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mail From: Kevin Rodgers <ihs_4664@yahoo.com> Newsgroups: gnu.emacs.vm.bug Subject: Re: Can't launch attachments with "spaces" in file name Date: Mon, 09 Feb 2004 10:50:56 -0700 Lines: 68 Message-ID: <4027C880.70600@yahoo.com> References: <m2fzekj10g.fsf@consult.pretender> <400320B7.5060408@yahoo.com> <m2k73n2nrb.fsf@consult.pretender> <400D5599.10709@yahoo.com> <m2isj6m7a4.fsf@consult.pretender> <861xpth8a1.fsf@robf.deREMOVETHIS> <m2smi88qsy.fsf@consult.pretender> <86hdyoc6n9.fsf@robf.deREMOVETHIS> <m2y8rscb3z.fsf@consult.pretender> <4017E7FE.8040704@yahoo.com> <m21xpjvd3q.fsf@consult.pretender> <401FCD17.6010700@yahoo.com> <m2llnjn6bs.fsf@consult.pretender> <40241D13.8060908@yahoo.com> <m2ptcqw6lw.fsf@consult.pretender> NNTP-Posting-Host: 170.207.51.80 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1076349060 37812391 D 170.207.51.80 ([82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us