diff options
| author | Richard M. Stallman | 1996-08-29 20:50:15 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-08-29 20:50:15 +0000 |
| commit | c291d9ef2b87b430b7c0958a7dea0974fa347380 (patch) | |
| tree | 38e73045430067c5e20f253c1ad56862d29d1c00 /src/term.c | |
| parent | 531483fbd3a89e58858b733bad5b467511e1b0a7 (diff) | |
| download | emacs-c291d9ef2b87b430b7c0958a7dea0974fa347380.tar.gz emacs-c291d9ef2b87b430b7c0958a7dea0974fa347380.zip | |
(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 (); | |||
| 43 | #define OUTPUT_IF(a) { if (a) tputs (a, FRAME_HEIGHT (selected_frame) - curY, cmputc); } | 43 | #define OUTPUT_IF(a) { if (a) tputs (a, FRAME_HEIGHT (selected_frame) - curY, cmputc); } |
| 44 | #define OUTPUT1_IF(a) { if (a) tputs (a, 1, cmputc); } | 44 | #define OUTPUT1_IF(a) { if (a) tputs (a, 1, cmputc); } |
| 45 | 45 | ||
| 46 | /* Function to use to ring the bell. */ | ||
| 47 | Lisp_Object Vring_bell_function; | ||
| 48 | |||
| 46 | /* Terminal characteristics that higher levels want to look at. | 49 | /* Terminal characteristics that higher levels want to look at. |
| 47 | These are all extern'd in termchar.h */ | 50 | These are all extern'd in termchar.h */ |
| 48 | 51 | ||
| @@ -310,6 +313,26 @@ extern char *tgetstr (); | |||
| 310 | 313 | ||
| 311 | ring_bell () | 314 | ring_bell () |
| 312 | { | 315 | { |
| 316 | if (! NILP (Vring_bell_function)) | ||
| 317 | { | ||
| 318 | Lisp_Object function; | ||
| 319 | |||
| 320 | /* Temporarily set the global variable to nil | ||
| 321 | so that if we get an error, it stays nil | ||
| 322 | and we don't call it over and over. | ||
| 323 | |||
| 324 | We don't specbind it, because that would carefully | ||
| 325 | restore the bad value if there's an error | ||
| 326 | and make the loop of errors happen anyway. */ | ||
| 327 | function = Vring_bell_function; | ||
| 328 | Vring_bell_function = Qnil; | ||
| 329 | |||
| 330 | call0 (function); | ||
| 331 | |||
| 332 | Vring_bell_function = function; | ||
| 333 | return; | ||
| 334 | } | ||
| 335 | |||
| 313 | if (! FRAME_TERMCAP_P (selected_frame)) | 336 | if (! FRAME_TERMCAP_P (selected_frame)) |
| 314 | { | 337 | { |
| 315 | (*ring_bell_hook) (); | 338 | (*ring_bell_hook) (); |
| @@ -1777,4 +1800,9 @@ This variable can be used by terminal emulator packages."); | |||
| 1777 | #else | 1800 | #else |
| 1778 | system_uses_terminfo = 0; | 1801 | system_uses_terminfo = 0; |
| 1779 | #endif | 1802 | #endif |
| 1803 | |||
| 1804 | DEFVAR_LISP ("ring-bell-function", &Vring_bell_function, | ||
| 1805 | "Non-nil means call this function to ring the bell.\n\ | ||
| 1806 | The function should accept no arguments."); | ||
| 1807 | Vring_bell_function = Qnil; | ||
| 1780 | } | 1808 | } |