comparison src/dispnew.c @ 7810:15c0bf73737e

(Fframe_or_buffer_changed_p): New function.
author Karl Heuer <kwzh@gnu.org>
date Mon, 06 Jun 1994 05:03:41 +0000
parents 52e2eb6245d4
children e1e536773850
comparison
equal deleted inserted replaced
7809:cf23573fa6fb 7810:15c0bf73737e
1856 temp1 = desired_frame->charstarts[vpos]; 1856 temp1 = desired_frame->charstarts[vpos];
1857 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos]; 1857 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos];
1858 current_frame->charstarts[vpos] = temp1; 1858 current_frame->charstarts[vpos] = temp1;
1859 } 1859 }
1860 1860
1861 /* A vector of size NFRAMES + 3 * NBUFFERS + 1, containing the session's
1862 frames, buffers, buffer-read-only flags, and buffer-modified-flags,
1863 and a trailing sentinel (so we don't need to add length checks). */
1864 static Lisp_Object frame_and_buffer_state;
1865
1866 DEFUN ("frame-or-buffer-changed-p", Fframe_or_buffer_changed_p,
1867 Sframe_or_buffer_changed_p, 0, 0, 0,
1868 "Return non-nil if the frame and buffer state appears to have changed.\n\
1869 The state variable is an internal vector containing all frames and buffers,\n\
1870 along with the buffers' read-only and modified flags, which allows a fast\n\
1871 check to see whether the menu bars might need to be recomputed.\n\
1872 If this function returns non-nil, it updates the internal vector to reflect\n\
1873 the current state.\n")
1874 ()
1875 {
1876 Lisp_Object tail, frame, buf;
1877 Lisp_Object *vecp;
1878 int n;
1879 vecp = XVECTOR (frame_and_buffer_state)->contents;
1880 FOR_EACH_FRAME (tail, frame)
1881 if (!EQ (*vecp++, frame))
1882 goto changed;
1883 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr)
1884 {
1885 buf = XCONS (XCONS (tail)->car)->cdr;
1886 if (!EQ (*vecp++, buf))
1887 goto changed;
1888 if (!EQ (*vecp++, XBUFFER (buf)->read_only))
1889 goto changed;
1890 if (!EQ (*vecp++, Fbuffer_modified_p (buf)))
1891 goto changed;
1892 }
1893 return Qnil;
1894 changed:
1895 n = 1;
1896 FOR_EACH_FRAME (tail, frame)
1897 n++;
1898 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr)
1899 n += 3;
1900 frame_and_buffer_state = Fmake_vector (make_number (n), Qlambda);
1901 vecp = XVECTOR (frame_and_buffer_state)->contents;
1902 FOR_EACH_FRAME (tail, frame)
1903 *vecp++ = frame;
1904 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr)
1905 {
1906 buf = XCONS (XCONS (tail)->car)->cdr;
1907 *vecp++ = buf;
1908 *vecp++ = XBUFFER (buf)->read_only;
1909 *vecp++ = Fbuffer_modified_p (buf);
1910 }
1911 return Qt;
1912 }
1913
1861 DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript, 1914 DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript,
1862 1, 1, "FOpen termscript file: ", 1915 1, 1, "FOpen termscript file: ",
1863 "Start writing all terminal output to FILE as well as the terminal.\n\ 1916 "Start writing all terminal output to FILE as well as the terminal.\n\
1864 FILE = nil means just close any termscript file currently open.") 1917 FILE = nil means just close any termscript file currently open.")
1865 (file) 1918 (file)
2393 { 2446 {
2394 #ifdef MULTI_FRAME 2447 #ifdef MULTI_FRAME
2395 defsubr (&Sredraw_frame); 2448 defsubr (&Sredraw_frame);
2396 #endif 2449 #endif
2397 defsubr (&Sredraw_display); 2450 defsubr (&Sredraw_display);
2451 defsubr (&Sframe_or_buffer_changed_p);
2398 defsubr (&Sopen_termscript); 2452 defsubr (&Sopen_termscript);
2399 defsubr (&Sding); 2453 defsubr (&Sding);
2400 defsubr (&Ssit_for); 2454 defsubr (&Ssit_for);
2401 defsubr (&Ssleep_for); 2455 defsubr (&Ssleep_for);
2402 defsubr (&Ssend_string_to_terminal); 2456 defsubr (&Ssend_string_to_terminal);
2457
2458 frame_and_buffer_state = Fmake_vector (make_number (1), Qlambda);
2459 staticpro (&frame_and_buffer_state);
2403 2460
2404 DEFVAR_INT ("baud-rate", &baud_rate, 2461 DEFVAR_INT ("baud-rate", &baud_rate,
2405 "The output baud rate of the terminal.\n\ 2462 "The output baud rate of the terminal.\n\
2406 On most systems, changing this value will affect the amount of padding\n\ 2463 On most systems, changing this value will affect the amount of padding\n\
2407 and the other strategic decisions made during redisplay."); 2464 and the other strategic decisions made during redisplay.");