zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: pws-N: more useful sort of beep
@ 1999-06-23 15:49 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 1999-06-23 15:49 UTC (permalink / raw)
  To: Zsh hackers list

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@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-06-23 16:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-23 15:49 PATCH: pws-N: more useful sort of beep 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).