diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-08-29 20:50:15 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-08-29 20:50:15 +0000 |
commit | c291d9ef2b87b430b7c0958a7dea0974fa347380 (patch) | |
tree | 38e73045430067c5e20f253c1ad56862d29d1c00 /src/term.c | |
parent | 531483fbd3a89e58858b733bad5b467511e1b0a7 (diff) | |
download | emacs-c291d9ef2b87b430b7c0958a7dea0974fa347380.tar.gz |
(Vring_bell_function): New variable.
(syms_of_term): Set up Lisp variable.
(ring_bell): Use Vring_bell_function.
Diffstat (limited to 'src/term.c')
-rw-r--r-- | src/term.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c index 0a58c4b8dcd..a9533ece45a 100644 --- a/src/term.c +++ b/src/term.c @@ -43,6 +43,9 @@ extern Lisp_Object Fmake_sparse_keymap (); #define OUTPUT_IF(a) { if (a) tputs (a, FRAME_HEIGHT (selected_frame) - curY, cmputc); } #define OUTPUT1_IF(a) { if (a) tputs (a, 1, cmputc); } +/* Function to use to ring the bell. */ +Lisp_Object Vring_bell_function; + /* Terminal characteristics that higher levels want to look at. These are all extern'd in termchar.h */ @@ -310,6 +313,26 @@ extern char *tgetstr (); ring_bell () { + if (! NILP (Vring_bell_function)) + { + Lisp_Object function; + + /* Temporarily set the global variable to nil + so that if we get an error, it stays nil + and we don't call it over and over. + + We don't specbind it, because that would carefully + restore the bad value if there's an error + and make the loop of errors happen anyway. */ + function = Vring_bell_function; + Vring_bell_function = Qnil; + + call0 (function); + + Vring_bell_function = function; + return; + } + if (! FRAME_TERMCAP_P (selected_frame)) { (*ring_bell_hook) (); @@ -1777,4 +1800,9 @@ This variable can be used by terminal emulator packages."); #else system_uses_terminfo = 0; #endif + + DEFVAR_LISP ("ring-bell-function", &Vring_bell_function, + "Non-nil means call this function to ring the bell.\n\ +The function should accept no arguments."); + Vring_bell_function = Qnil; } |