zsh-workers
 help / color / mirror / code / Atom feed
* vared parse error when ` in prompt string
@ 2016-02-12  9:51 Sebastian Gniazdowski
  2016-02-12 15:52 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Gniazdowski @ 2016-02-12  9:51 UTC (permalink / raw)
  To: Zsh hackers list

Hello,
% vared -cp "Github user name or just \`_local': " user
zsh: parse error

Tested on 5.0.8 and 5.2

Best regards,
Sebastian Gniazdowski


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vared parse error when ` in prompt string
  2016-02-12  9:51 vared parse error when ` in prompt string Sebastian Gniazdowski
@ 2016-02-12 15:52 ` Bart Schaefer
  2016-02-12 16:03   ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2016-02-12 15:52 UTC (permalink / raw)
  To: Sebastian Gniazdowski, Zsh hackers list

On Feb 12, 10:51am, Sebastian Gniazdowski wrote:
}
} % vared -cp "Github user name or just \`_local': " user
} zsh: parse error

torch% vared -cp "Github user name or just \`_local': " user
Github user name or just `_local': foo
torch% setopt PROMPT_SUBST
torch% vared -cp "Github user name or just \`_local': " user
zsh: parse error
Github user name or just `_local': foo


-- 
Barton E. Schaefer


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vared parse error when ` in prompt string
  2016-02-12 15:52 ` Bart Schaefer
@ 2016-02-12 16:03   ` Peter Stephenson
  2016-02-12 16:19     ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2016-02-12 16:03 UTC (permalink / raw)
  To: Bart Schaefer, Zsh hackers list

On Fri, 12 Feb 2016 07:52:17 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Feb 12, 10:51am, Sebastian Gniazdowski wrote:
> }
> } % vared -cp "Github user name or just \`_local': " user
> } zsh: parse error
> 
> torch% vared -cp "Github user name or just \`_local': " user
> Github user name or just `_local': foo
> torch% setopt PROMPT_SUBST
> torch% vared -cp "Github user name or just \`_local': " user
> zsh: parse error
> Github user name or just `_local': foo

I think the real point, now Bart has pointed out what the problem is, is
that you need to triple backslash the "`", or more simply use a single
quote around the lot together with a single backslash.  With
promptsubst, you need vared to see the backslash before the "`".  Or

vared_prompt='The string I want the user to see'
vared -cp ${(q)vared_prompt} user

(Refer back to http://xkcd.com/1638/ again if you've forgotten.)

pws


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vared parse error when ` in prompt string
  2016-02-12 16:03   ` Peter Stephenson
@ 2016-02-12 16:19     ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2016-02-12 16:19 UTC (permalink / raw)
  To: Peter Stephenson, Zsh hackers list

On Fri, 12 Feb 2016 16:03:33 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:
> vared_prompt='The string I want the user to see'
> vared -cp ${(q)vared_prompt} user

Eyugh.  Nope.

% foo='This prompt "contains" `surprises'\''?'
% vared -cp ${(q)foo} stuff
This\ prompt\ \"contains\"\ `surprises\'\?

To automate probably better off with

vared_prompt() {
   emulate -L zsh
   unsetopt promptsubst
   vared -p $1 $2
}
vared_prompt 'The literal prompt' the_variable

pws


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-12 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-12  9:51 vared parse error when ` in prompt string Sebastian Gniazdowski
2016-02-12 15:52 ` Bart Schaefer
2016-02-12 16:03   ` Peter Stephenson
2016-02-12 16:19     ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).