comparison src/window.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents 0784d089fdc9
children 190b164ddcac
comparison
equal deleted inserted replaced
562:c775bd016b32 563:183866b06e0b
182 print_window (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) 182 print_window (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
183 { 183 {
184 char buf[200]; 184 char buf[200];
185 185
186 if (print_readably) 186 if (print_readably)
187 error ("printing unreadable object #<window 0x%x>", 187 printing_unreadable_object ("#<window 0x%x>", XWINDOW (obj)->header.uid);
188 XWINDOW (obj)->header.uid);
189 188
190 write_c_string ("#<window", printcharfun); 189 write_c_string ("#<window", printcharfun);
191 if (!NILP (XWINDOW (obj)->buffer)) 190 if (!NILP (XWINDOW (obj)->buffer))
192 { 191 {
193 Lisp_Object name = XBUFFER (XWINDOW (obj)->buffer)->name; 192 Lisp_Object name = XBUFFER (XWINDOW (obj)->buffer)->name;
1975 if (NILP (memq_no_quit (frame, DEVICE_FRAME_LIST (d)))) 1974 if (NILP (memq_no_quit (frame, DEVICE_FRAME_LIST (d))))
1976 /* this frame isn't fully initialized yet; don't blow up. */ 1975 /* this frame isn't fully initialized yet; don't blow up. */
1977 return Qnil; 1976 return Qnil;
1978 1977
1979 if (MINI_WINDOW_P (XWINDOW (window))) 1978 if (MINI_WINDOW_P (XWINDOW (window)))
1980 error ("Attempt to delete the minibuffer window"); 1979 signal_error (Qinvalid_operation, "Attempt to delete the minibuffer window", Qunbound);
1981 1980
1982 /* It has been suggested that it's a good thing for C-x 0 to have this 1981 /* It has been suggested that it's a good thing for C-x 0 to have this
1983 behavior, but not such a good idea for #'delete-window to have it. 1982 behavior, but not such a good idea for #'delete-window to have it.
1984 Maybe C-x 0 should be bound to something else, or maybe frame 1983 Maybe C-x 0 should be bound to something else, or maybe frame
1985 deletion should only happen when this is called interactively. 1984 deletion should only happen when this is called interactively.
2971 int old_top = WINDOW_TOP (w); 2970 int old_top = WINDOW_TOP (w);
2972 2971
2973 XSETWINDOW (window, w); 2972 XSETWINDOW (window, w);
2974 2973
2975 if (MINI_WINDOW_P (w) && old_top > 0) 2974 if (MINI_WINDOW_P (w) && old_top > 0)
2976 error ("Can't expand minibuffer to full frame"); 2975 invalid_operation ("Can't expand minibuffer to full frame", Qunbound);
2977 2976
2978 /* Ignore dedicated windows. */ 2977 /* Ignore dedicated windows. */
2979 window_loop (DELETE_OTHER_WINDOWS, window, 0, w->frame, 0, Qnil); 2978 window_loop (DELETE_OTHER_WINDOWS, window, 0, w->frame, 0, Qnil);
2980 2979
2981 start_pos = marker_position (w->start[CURRENT_DISP]); 2980 start_pos = marker_position (w->start[CURRENT_DISP]);
3387 3386
3388 buffer = Fget_buffer (buffer); 3387 buffer = Fget_buffer (buffer);
3389 CHECK_BUFFER (buffer); 3388 CHECK_BUFFER (buffer);
3390 3389
3391 if (!BUFFER_LIVE_P (XBUFFER (buffer))) 3390 if (!BUFFER_LIVE_P (XBUFFER (buffer)))
3392 error ("Attempt to display deleted buffer"); 3391 invalid_operation ("Attempt to display deleted buffer", Qunbound);
3393 3392
3394 tem = w->buffer; 3393 tem = w->buffer;
3395 if (NILP (tem)) 3394 if (NILP (tem))
3396 error ("Window is deleted"); 3395 invalid_operation ("Window is deleted", Qunbound);
3397 3396
3398 /* While this seems like a logical thing to do, it causes problems 3397 /* While this seems like a logical thing to do, it causes problems
3399 because of saved window configurations. It is possible for a 3398 because of saved window configurations. It is possible for a
3400 buffer to get restored into a window in which it is already being 3399 buffer to get restored into a window in which it is already being
3401 displayed, but start and point are actually at completely 3400 displayed, but start and point are actually at completely
3410 #endif 3409 #endif
3411 else if (! EQ (tem, Qt)) /* w->buffer is t when the window 3410 else if (! EQ (tem, Qt)) /* w->buffer is t when the window
3412 is first being set up. */ 3411 is first being set up. */
3413 { 3412 {
3414 if (!NILP (w->dedicated) && !EQ (tem, buffer)) 3413 if (!NILP (w->dedicated) && !EQ (tem, buffer))
3415 error ("Window is dedicated to buffer %s", 3414 signal_error (Qinvalid_operation, "Window is dedicated to buffer", tem);
3416 XSTRING_DATA (XBUFFER (tem)->name));
3417 3415
3418 old_buffer_local_face_property = 3416 old_buffer_local_face_property =
3419 XBUFFER (w->buffer)->buffer_local_face_property; 3417 XBUFFER (w->buffer)->buffer_local_face_property;
3420 unshow_buffer (w); 3418 unshow_buffer (w);
3421 } 3419 }
3473 CHECK_LIVE_WINDOW (window); 3471 CHECK_LIVE_WINDOW (window);
3474 w = XWINDOW (window); 3472 w = XWINDOW (window);
3475 3473
3476 /* we have already caught dead-window errors */ 3474 /* we have already caught dead-window errors */
3477 if (!NILP (w->hchild) || !NILP (w->vchild)) 3475 if (!NILP (w->hchild) || !NILP (w->vchild))
3478 error ("Trying to select non-leaf window"); 3476 invalid_operation ("Trying to select non-leaf window", Qunbound);
3479 3477
3480 w->use_time = make_int (++window_select_count); 3478 w->use_time = make_int (++window_select_count);
3481 3479
3482 if (EQ (window, old_selected_window)) 3480 if (EQ (window, old_selected_window))
3483 return window; 3481 return window;
3670 else 3668 else
3671 psize = window_char_height_to_pixel_height (o, csize, 1); 3669 psize = window_char_height_to_pixel_height (o, csize, 1);
3672 } 3670 }
3673 3671
3674 if (MINI_WINDOW_P (o)) 3672 if (MINI_WINDOW_P (o))
3675 error ("Attempt to split minibuffer window"); 3673 invalid_operation ("Attempt to split minibuffer window", Qunbound);
3676 else if (FRAME_NO_SPLIT_P (XFRAME (WINDOW_FRAME (o)))) 3674 else if (FRAME_NO_SPLIT_P (XFRAME (WINDOW_FRAME (o))))
3677 error ("Attempt to split unsplittable frame"); 3675 invalid_operation ("Attempt to split unsplittable frame", Qunbound);
3678 3676
3679 check_min_window_sizes (); 3677 check_min_window_sizes ();
3680 3678
3681 if (NILP (horflag)) 3679 if (NILP (horflag))
3682 { 3680 {
3683 if (csize < window_min_height) 3681 if (csize < window_min_height)
3684 error ("Window height %d too small (after splitting)", csize); 3682 signal_error (Qinvalid_operation, "Window height too small (after splitting)", make_int (csize));
3685 if (csize + window_min_height > window_char_height (o, 1)) 3683 if (csize + window_min_height > window_char_height (o, 1))
3686 error ("Window height %d too small (after splitting)", 3684 signal_error (Qinvalid_operation, "Window height too small (after splitting)",
3687 window_char_height (o, 1) - csize); 3685 make_int (window_char_height (o, 1) - csize));
3688 if (NILP (o->parent) 3686 if (NILP (o->parent)
3689 || NILP (XWINDOW (o->parent)->vchild)) 3687 || NILP (XWINDOW (o->parent)->vchild))
3690 { 3688 {
3691 make_dummy_parent (window); 3689 make_dummy_parent (window);
3692 #if 0 3690 #if 0
3701 } 3699 }
3702 } 3700 }
3703 else 3701 else
3704 { 3702 {
3705 if (csize < window_min_width) 3703 if (csize < window_min_width)
3706 error ("Window width %d too small (after splitting)", csize); 3704 signal_error (Qinvalid_operation, "Window width too small (after splitting)", make_int (csize));
3707 if (csize + window_min_width > window_char_width (o, 0)) 3705 if (csize + window_min_width > window_char_width (o, 0))
3708 error ("Window width %d too small (after splitting)", 3706 signal_error (Qinvalid_operation, "Window width too small (after splitting)",
3709 window_char_width (o, 0) - csize); 3707 make_int (window_char_width (o, 0) - csize));
3710 if (NILP (o->parent) 3708 if (NILP (o->parent)
3711 || NILP (XWINDOW (o->parent)->hchild)) 3709 || NILP (XWINDOW (o->parent)->hchild))
3712 { 3710 {
3713 make_dummy_parent (window); 3711 make_dummy_parent (window);
3714 #if 0 3712 #if 0
4087 check_min_window_sizes (); 4085 check_min_window_sizes ();
4088 4086
4089 XSETWINDOW (window, win); 4087 XSETWINDOW (window, win);
4090 f = XFRAME (win->frame); 4088 f = XFRAME (win->frame);
4091 if (EQ (window, FRAME_ROOT_WINDOW (f))) 4089 if (EQ (window, FRAME_ROOT_WINDOW (f)))
4092 error ("Won't change only window"); 4090 invalid_operation ("Won't change only window", Qunbound);
4093 4091
4094 /* #### This is very likely incorrect and instead the char_to_pixel_ 4092 /* #### This is very likely incorrect and instead the char_to_pixel_
4095 functions should be called. */ 4093 functions should be called. */
4096 default_face_height_and_width (window, &defheight, &defwidth); 4094 default_face_height_and_width (window, &defheight, &defwidth);
4097 4095
4100 w = XWINDOW (window); 4098 w = XWINDOW (window);
4101 parent = w->parent; 4099 parent = w->parent;
4102 if (NILP (parent)) 4100 if (NILP (parent))
4103 { 4101 {
4104 if (widthflag) 4102 if (widthflag)
4105 error ("No other window to side of this one"); 4103 invalid_operation ("No other window to side of this one", Qunbound);
4106 break; 4104 break;
4107 } 4105 }
4108 if (widthflag 4106 if (widthflag
4109 ? !NILP (XWINDOW (parent)->hchild) 4107 ? !NILP (XWINDOW (parent)->hchild)
4110 : !NILP (XWINDOW (parent)->vchild)) 4108 : !NILP (XWINDOW (parent)->vchild))
4352 4350
4353 if (vtarget < value && 4351 if (vtarget < value &&
4354 (w->window_end_pos[CURRENT_DISP] == -1 4352 (w->window_end_pos[CURRENT_DISP] == -1
4355 || (BUF_Z (b) - w->window_end_pos[CURRENT_DISP] > BUF_ZV (b)))) 4353 || (BUF_Z (b) - w->window_end_pos[CURRENT_DISP] > BUF_ZV (b))))
4356 { 4354 {
4357 maybe_signal_error (Qend_of_buffer, Qnil, Qwindow, errb); 4355 maybe_signal_error_1 (Qend_of_buffer, Qnil, Qwindow, errb);
4358 return; 4356 return;
4359 } 4357 }
4360 else 4358 else
4361 { 4359 {
4362 set_marker_restricted (w->start[CURRENT_DISP], make_int (startp), 4360 set_marker_restricted (w->start[CURRENT_DISP], make_int (startp),
4409 startp = vmotion (w, old_start, value, &vtarget); 4407 startp = vmotion (w, old_start, value, &vtarget);
4410 4408
4411 if (vtarget > value 4409 if (vtarget > value
4412 && marker_position (w->start[CURRENT_DISP]) == BUF_BEGV (b)) 4410 && marker_position (w->start[CURRENT_DISP]) == BUF_BEGV (b))
4413 { 4411 {
4414 maybe_signal_error (Qbeginning_of_buffer, Qnil, Qwindow, errb); 4412 maybe_signal_error_1 (Qbeginning_of_buffer, Qnil, Qwindow, errb);
4415 return; 4413 return;
4416 } 4414 }
4417 else 4415 else
4418 { 4416 {
4419 set_marker_restricted (w->start[CURRENT_DISP], make_int (startp), 4417 set_marker_restricted (w->start[CURRENT_DISP], make_int (startp),
4466 WINDOW_TEXT_TOP_CLIP (w) = 0; 4464 WINDOW_TEXT_TOP_CLIP (w) = 0;
4467 MARK_WINDOWS_CHANGED (w); 4465 MARK_WINDOWS_CHANGED (w);
4468 } 4466 }
4469 if (marker_position (w->start[CURRENT_DISP]) == BUF_BEGV (b)) 4467 if (marker_position (w->start[CURRENT_DISP]) == BUF_BEGV (b))
4470 { 4468 {
4471 maybe_signal_error (Qbeginning_of_buffer, Qnil, Qwindow, errb); 4469 maybe_signal_error_1 (Qbeginning_of_buffer, Qnil, Qwindow, errb);
4472 return; 4470 return;
4473 } 4471 }
4474 else 4472 else
4475 { 4473 {
4476 int vtarget; 4474 int vtarget;
4583 } 4581 }
4584 4582
4585 CHECK_LIVE_WINDOW (window); 4583 CHECK_LIVE_WINDOW (window);
4586 4584
4587 if (EQ (window, selected_window)) 4585 if (EQ (window, selected_window))
4588 error ("There is no other window"); 4586 invalid_operation ("There is no other window", Qunbound);
4589 4587
4590 return window; 4588 return window;
4591 } 4589 }
4592 4590
4593 DEFUN ("scroll-other-window", Fscroll_other_window, 0, 1, "_P", /* 4591 DEFUN ("scroll-other-window", Fscroll_other_window, 0, 1, "_P", /*
5088 print_window_config (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) 5086 print_window_config (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
5089 { 5087 {
5090 struct window_config *config = XWINDOW_CONFIGURATION (obj); 5088 struct window_config *config = XWINDOW_CONFIGURATION (obj);
5091 char buf[200]; 5089 char buf[200];
5092 if (print_readably) 5090 if (print_readably)
5093 error ("printing unreadable object #<window-configuration 0x%x>", 5091 printing_unreadable_object ("#<window-configuration 0x%x>",
5094 config->header.uid); 5092 config->header.uid);
5095 write_c_string ("#<window-configuration ", printcharfun); 5093 write_c_string ("#<window-configuration ", printcharfun);
5096 sprintf (buf, "0x%x>", config->header.uid); 5094 sprintf (buf, "0x%x>", config->header.uid);
5097 write_c_string (buf, printcharfun); 5095 write_c_string (buf, printcharfun);
5098 } 5096 }
5099 5097
6064 syms_of_window (void) 6062 syms_of_window (void)
6065 { 6063 {
6066 INIT_LRECORD_IMPLEMENTATION (window); 6064 INIT_LRECORD_IMPLEMENTATION (window);
6067 INIT_LRECORD_IMPLEMENTATION (window_configuration); 6065 INIT_LRECORD_IMPLEMENTATION (window_configuration);
6068 6066
6069 defsymbol (&Qwindowp, "windowp"); 6067 DEFSYMBOL (Qwindowp);
6070 defsymbol (&Qwindow_live_p, "window-live-p"); 6068 DEFSYMBOL (Qwindow_live_p);
6071 defsymbol (&Qwindow_configurationp, "window-configuration-p"); 6069 DEFSYMBOL_MULTIWORD_PREDICATE (Qwindow_configurationp);
6072 defsymbol (&Qtemp_buffer_show_hook, "temp-buffer-show-hook"); 6070 DEFSYMBOL (Qtemp_buffer_show_hook);
6073 defsymbol (&Qdisplay_buffer, "display-buffer"); 6071 DEFSYMBOL (Qdisplay_buffer);
6074 6072
6075 #ifdef MEMORY_USAGE_STATS 6073 #ifdef MEMORY_USAGE_STATS
6076 defsymbol (&Qface_cache, "face-cache"); 6074 DEFSYMBOL (Qface_cache);
6077 defsymbol (&Qglyph_cache, "glyph-cache"); 6075 DEFSYMBOL (Qglyph_cache);
6078 defsymbol (&Qline_start_cache, "line-start-cache"); 6076 DEFSYMBOL (Qline_start_cache);
6079 #ifdef HAVE_SCROLLBARS 6077 #ifdef HAVE_SCROLLBARS
6080 defsymbol (&Qscrollbar_instances, "scrollbar-instances"); 6078 DEFSYMBOL (Qscrollbar_instances);
6081 #endif 6079 #endif
6082 defsymbol (&Qother_redisplay, "other-redisplay"); 6080 DEFSYMBOL (Qother_redisplay);
6083 /* Qother in general.c */ 6081 /* Qother in general.c */
6084 #endif 6082 #endif
6085 6083
6086 DEFSUBR (Fselected_window); 6084 DEFSUBR (Fselected_window);
6087 DEFSUBR (Flast_nonminibuf_window); 6085 DEFSUBR (Flast_nonminibuf_window);