Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: pws-N: more useful sort of beep



I hope some of you are going to like these extra three lines of code as
much as I already do...

I got the idea from emacs' visible-bell, when doing all the beep stuff,
which like many people I never use because it's so annoying.  Now the
parameter ZBEEP (does anyone have a name they prefer) can contain a string
to output instead of beeping.  With many terminals, it's possible to
emulate emacs' visible bell rather grossly simply by flashing inverse video
on and off; the vt100/xterm sequences are given in the new manual entry.  I
find it quick enough not to be annoying, but no doubt the diehards won't be
convinced.

--- Doc/Zsh/params.yo.vb	Thu Jun 17 14:03:03 1999
+++ Doc/Zsh/params.yo	Wed Jun 23 17:38:34 1999
@@ -858,6 +858,19 @@
 A list of non-alphanumeric characters considered part of a word
 by the line editor.
 )
+vindex(ZBEEP)
+item(tt(ZBEEP))(
+If set, this gives a string of characters, which can use all the same codes
+as the tt(bindkey) command as described in
+ifzman(zmanref(zshzle))\
+ifnzman(noderef(Zsh Line Editor))\
+, that will be output to the terminal
+instead of beeping.  This may have a visible instead of an audible effect;
+for example, the string `tt(\e[?5h\e[?5l)' on a vt100 or xterm will have
+the effect of flashing reverse video on and off (if you usually use reverse
+video, you should use the string `tt(\e[?5l\e[?5h)' instead).  This takes
+precedence over the tt(NOBEEP) option.
+)
 vindex(ZDOTDIR)
 item(tt(ZDOTDIR))(
 The directory to search for shell startup files (.zshrc, etc),
--- Src/utils.c.vb	Sun Jun 20 14:57:26 1999
+++ Src/utils.c	Wed Jun 23 17:35:29 1999
@@ -2133,7 +2133,12 @@
 void
 zbeep(void)
 {
-    if (isset(BEEP))
+    char *vb;
+    if ((vb = getsparam("ZBEEP"))) {
+	int len;
+	vb = getkeystring(vb, &len, 2, NULL);
+	write(SHTTY, vb, len);
+    } else if (isset(BEEP))
 	write(SHTTY, "\07", 1);
 }
 
-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author