Mercurial > emacs
comparison src/term.c @ 15974:61249a8fe735
(Vring_bell_function): New variable.
(syms_of_term): Set up Lisp variable.
(ring_bell): Use Vring_bell_function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 29 Aug 1996 20:50:15 +0000 |
parents | 77e6de616e58 |
children | 4c74d7f1cfa6 |
comparison
equal
deleted
inserted
replaced
15973:6ad9e8fee494 | 15974:61249a8fe735 |
---|---|
40 #define OUTPUT(a) tputs (a, FRAME_HEIGHT (selected_frame) - curY, cmputc) | 40 #define OUTPUT(a) tputs (a, FRAME_HEIGHT (selected_frame) - curY, cmputc) |
41 #define OUTPUT1(a) tputs (a, 1, cmputc) | 41 #define OUTPUT1(a) tputs (a, 1, cmputc) |
42 #define OUTPUTL(a, lines) tputs (a, lines, cmputc) | 42 #define OUTPUTL(a, lines) tputs (a, lines, cmputc) |
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 | |
46 /* Function to use to ring the bell. */ | |
47 Lisp_Object Vring_bell_function; | |
45 | 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 |
49 int must_write_spaces; /* Nonzero means spaces in the text | 52 int must_write_spaces; /* Nonzero means spaces in the text |
308 #define FRAME_TERMCAP_P(_f_) 0 | 311 #define FRAME_TERMCAP_P(_f_) 0 |
309 #endif /* WINDOWSNT */ | 312 #endif /* WINDOWSNT */ |
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) (); |
316 return; | 339 return; |
317 } | 340 } |
1775 #ifdef TERMINFO | 1798 #ifdef TERMINFO |
1776 system_uses_terminfo = 1; | 1799 system_uses_terminfo = 1; |
1777 #else | 1800 #else |
1778 system_uses_terminfo = 0; | 1801 system_uses_terminfo = 0; |
1779 #endif | 1802 #endif |
1780 } | 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; | |
1808 } |