zsh-workers
 help / color / mirror / code / Atom feed
* have '&' automatically disown?
@ 2010-02-05 17:01 Greg Klanderman
  2010-02-05 17:33 ` Peter Stephenson
  0 siblings, 1 reply; 38+ messages in thread
From: Greg Klanderman @ 2010-02-05 17:01 UTC (permalink / raw)
  To: Zsh list


Just wondering here.. I almost never use job control, and so almost
always use '&!' for background commands.  I was thinking it would
be nice to not have to type all those '!'s.. but I don't see a setting
to have '&' alone default to the disown behavior.  Is there some way
to do that which I've missed?

thanks,
Greg


^ permalink raw reply	[flat|nested] 38+ messages in thread
[parent not found: <gak@klanderman.net>]
* PATCH: make PROMPT_SP end-of-line marker configurable
@ 2009-05-17  4:55 Greg Klanderman
  2009-05-17 17:27 ` Peter Stephenson
  0 siblings, 1 reply; 38+ messages in thread
From: Greg Klanderman @ 2009-05-17  4:55 UTC (permalink / raw)
  To: Zsh list

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 176 bytes --]


Hi,

This adds a parameter, EOLMARK, which allows configuring the
end-of-line marker used by the PROMPT_SP option.

I also cleaned up the doc for PS1 slightly.

thanks,
Greg


[-- Attachment #2: zsh-EOLMARK.patch --]
[-- Type: text/plain, Size: 3955 bytes --]

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.221
diff -u -r1.221 utils.c
--- Src/utils.c	6 Apr 2009 09:06:36 -0000	1.221
+++ Src/utils.c	17 May 2009 04:31:42 -0000
@@ -1216,12 +1216,16 @@
 	 * Unfortunately it interacts badly with ZLE displaying message
 	 * when ^D has been pressed. So just disable PROMPT_SP logic in
 	 * this case */
+	char *eolmark = getsparam("EOLMARK");
 	char *str;
-	int percents = opts[PROMPTPERCENT];
+	int percents = opts[PROMPTPERCENT], w = 0;
+	if (!eolmark || !*eolmark)
+	    eolmark = "%B%S%#%s%b";
 	opts[PROMPTPERCENT] = 1;
-	str = promptexpand("%B%S%#%s%b", 0, NULL, NULL, NULL);
+	str = promptexpand(eolmark, 1, NULL, NULL, NULL);
+	countprompt(str, &w, 0, -1);
 	opts[PROMPTPERCENT] = percents;
-	fprintf(shout, "%s%*s\r", str, (int)columns - 1 - !hasxn, "");
+	fprintf(shout, "%s%*s\r", str, (int)columns - w - !hasxn, "");
 	free(str);
     }
 
Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.81
diff -u -r1.81 options.yo
--- Doc/Zsh/options.yo	6 Apr 2009 09:06:36 -0000	1.81
+++ Doc/Zsh/options.yo	17 May 2009 04:31:42 -0000
@@ -1307,16 +1307,18 @@
 item(tt(PROMPT_SP) <D>)(
 Attempt to preserve a partial line (i.e. a line that did not end with a
 newline) that would otherwise be covered up by the command prompt due to
-the PROMPT_CR option.  This works by outputting some cursor-control
+the tt(PROMPT_CR) option.  This works by outputting some cursor-control
 characters, including a series of spaces, that should make the terminal
 wrap to the next line when a partial line is present (note that this is
 only successful if your terminal has automatic margins, which is typical).
 
-When a partial line is preserved, you will see an inverse+bold character at
-the end of the partial line:  a "%" for a normal user or a "#" for root.
+When a partial line is preserved, by default you will see an inverse+bold
+character at the end of the partial line:  a "%" for a normal user or
+a "#" for root.  If set, the shell parameter tt(EOLMARK) can be used to
+customize how the end of partial lines are shown.
 
-NOTE: if the PROMPT_CR option is not set, enabling this option will have no
-effect.  This option is on by default.
+NOTE: if the tt(PROMPT_CR) option is not set, enabling this option will
+have no effect.  This option is on by default.
 )
 pindex(PROMPT_PERCENT)
 pindex(NO_PROMPT_PERCENT)
Index: Doc/Zsh/params.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/params.yo,v
retrieving revision 1.54
diff -u -r1.54 params.yo
--- Doc/Zsh/params.yo	24 Apr 2009 09:00:37 -0000	1.54
+++ Doc/Zsh/params.yo	17 May 2009 04:31:42 -0000
@@ -823,6 +823,14 @@
 arithmetic expansion before being interpreted as a pathname.  Note that
 tt(ENV) is em(not) used unless zsh is emulating bf(sh) or bf(ksh).
 )
+vindex(EOLMARK)
+item(tt(EOLMARK))(
+When the tt(PROMPT_CR) and tt(PROMPT_SP) options are set, the tt(EOLMARK)
+parameter can be used to customize how the end of partial lines are shown.
+This parameter undergoes prompt expansion, with the tt(PROMPT_PERCENT)
+option set.  If not set or empty, the default behavior is equivalent to
+the value `tt(%B%S%#%s%b)'.
+)
 vindex(FCEDIT)
 item(tt(FCEDIT))(
 The default editor for the tt(fc) builtin.  If tt(FCEDIT) is not set,
@@ -1046,10 +1054,10 @@
 vindex(PS1)
 item(tt(PS1) <S>)(
 The primary prompt string, printed before a command is read.
-the default is `tt(%m%# )'.  It undergoes a special form of expansion
+It undergoes a special form of expansion
 before being displayed; see
 ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
-ifnzman(noderef(Prompt Expansion)).
+ifnzman(noderef(Prompt Expansion)).  The default is `tt(%m%# )'.
 )
 vindex(PS2)
 item(tt(PS2) <S>)(

^ permalink raw reply	[flat|nested] 38+ messages in thread
* treatment of empty strings - why is this not a bug?
@ 2009-01-13  7:32 Greg Klanderman
  2009-01-13 19:24 ` Peter Stephenson
  2009-01-16  4:19 ` Bart Schaefer
  0 siblings, 2 replies; 38+ messages in thread
From: Greg Klanderman @ 2009-01-13  7:32 UTC (permalink / raw)
  To: Zsh list

It's so nice that zsh doesn't do splitting on unquoted parameter
expansions:

[~] greg@lwm| zsh -f
lwm% function count () { echo $# }
lwm% a=( "a b" "c d" )
lwm% echo $#a[@]
2
lwm% count $a[@]
2
lwm% count "$a[@]"
2

however, it does silently drop empty strings:

lwm% a=( "" "" "" )
lwm% echo $#a[@] 
3
lwm% count $a[@]
0
lwm% count "$a[@]"
3

which means you still have to use all those quotes anyway.

I just don't understand why there should be any distinction
between the splitting and dropping of empty strings.

And even using quotes, zsh's treatment of empty strings here
seems very inconsistent:

lwm% x=::: && for v in "${(s-:-)x}" ; do echo "v= =>$v<=" ; done
v= =><=
v= =><=
lwm% x=:a:b: && for v in "${(s-:-)x}" ; do echo "v= =>$v<=" ; done 
v= =><=
v= =>a<=
v= =>b<=
v= =><=

thanks,
Greg


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

end of thread, other threads:[~2010-09-06  1:58 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-05 17:01 have '&' automatically disown? Greg Klanderman
2010-02-05 17:33 ` Peter Stephenson
2010-02-05 17:36   ` Peter Stephenson
2010-02-06  3:26     ` Greg Klanderman
2010-02-07 18:20       ` Peter Stephenson
2010-02-07 21:06         ` Greg Klanderman
2010-02-07 21:34           ` Peter Stephenson
2010-02-07 22:36             ` Bart Schaefer
2010-09-02 14:57               ` Greg Klanderman
2010-09-05 19:11                 ` Bart Schaefer
2010-09-06  1:50                   ` Greg Klanderman
2010-02-07 21:59           ` Mikael Magnusson
     [not found] <gak@klanderman.net>
2009-06-26 20:40 ` bug in ztrftime(): '%e' and '%f' specifiers swapped Greg Klanderman
2009-06-26 21:23   ` Peter Stephenson
2009-06-26 21:57     ` Greg Klanderman
  -- strict thread matches above, loose matches on Subject: below --
2009-05-17  4:55 PATCH: make PROMPT_SP end-of-line marker configurable Greg Klanderman
2009-05-17 17:27 ` Peter Stephenson
2009-05-17 18:04   ` Greg Klanderman
2009-05-17 19:23     ` Peter Stephenson
2009-05-18  1:00       ` Greg Klanderman
2009-05-18 18:27       ` Greg Klanderman
2009-01-13  7:32 treatment of empty strings - why is this not a bug? Greg Klanderman
2009-01-13 19:24 ` Peter Stephenson
2009-01-13 22:08   ` Peter Stephenson
2009-01-15 20:11     ` Greg Klanderman
2009-01-15 20:29       ` Peter Stephenson
2009-01-16 10:02         ` Peter Stephenson
2009-01-15 20:28     ` Greg Klanderman
2009-01-15 20:34       ` Peter Stephenson
2009-01-16  4:19 ` Bart Schaefer
2009-01-16 17:35   ` Greg Klanderman
2009-01-16 17:55     ` Peter Stephenson
2009-01-16 19:40       ` Greg Klanderman
2009-01-16 23:26         ` Richard Hartmann
2009-01-17  3:45         ` Bart Schaefer
2009-01-17  3:35     ` Bart Schaefer
2009-01-17  5:31       ` Greg Klanderman
2009-01-17 17:53         ` 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).