1. 11 Jun, 2011 5 commits
    • Martin Rudalics's avatar
      Window configuration, balancing and fit-to-buffer rewrites. · 6198ccd0
      Martin Rudalics authored
      * window.c (delete_deletable_window): Re-add.
      (Fset_window_configuration): Rewrite to handle dead buffers and
      consequently deletable windows.
      (window_tree, Fwindow_tree): Remove.  Supply functionality in
      (compare_window_configurations): Simplify code.
      * window.el (window-tree-1, window-tree): New functions, moving
      the latter to window.el.
      (bw-get-tree, bw-get-tree-1, bw-find-tree-sub)
      (bw-find-tree-sub-1, bw-l, bw-t, bw-r, bw-b, bw-dir, bw-eqdir)
      (bw-refresh-edges): Remove.
      (balance-windows-1, balance-windows-2): New functions.
      (balance-windows): Rewrite in terms of window tree functions,
      balance-windows-1 and balance-windows-2.
      (bw-adjust-window): Remove.
      (balance-windows-area-adjust): New function with functionality of
      bw-adjust-window but using resize-window.
      (set-window-text-height): Rewrite doc-string.  Use
      normalize-live-window and resize-window.
      (enlarge-window-horizontally, shrink-window-horizontally): Rename
      argument to DELTA.
      (window-buffer-height): New function.
      (fit-window-to-buffer, shrink-window-if-larger-than-buffer):
      Rewrite using new window resize routines.
      (kill-buffer-and-window, mouse-autoselect-window-select): Use
      ignore-errors instead of condition-case.
      (quit-window): Call delete-frame instead of delete-windows-on
      for the only buffer on frame.
    • Andreas Schwab's avatar
      * src/image.c (imagemagick_load_image): Fix type mismatch. · 1ab0dee5
      Andreas Schwab authored
      (Fimagemagick_types): Likewise.
    • Andreas Schwab's avatar
    • Martin Rudalics's avatar
      Move/add window-buffer-related functions to window.el. · 9397e56f
      Martin Rudalics authored
      * buffer.c: New Lisp objects Qbuffer_list_update_hook and
      Qclone_number.  Remove external declaration of Qdelete_window.
      (Fbuffer_list): Rewrite doc-string.  Minor restructuring of
      (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run
      Qbuffer_list_update_hook if allowed.
      (Fother_buffer): Rewrite doc-string.  Major rewrite for new
      buffer list implementation.
      (other_buffer_safely): New function.
      (Fkill_buffer): Replace call to replace_buffer_in_all_windows by
      calls to replace_buffer_in_windows and
      replace_buffer_in_windows_safely.  Run Qbuffer_list_update_hook
      if allowed.
      (record_buffer): Inhibit quitting and rewrite using quittable
      functions.  Run Qbuffer_list_update_hook if allowed.
      (Frecord_buffer, Funrecord_buffer): New functions.
      (switch_to_buffer_1, Fswitch_to_buffer): Remove.  Move
      switch-to-buffer to window.el.
      (bury-buffer): Move to window.el.
      (Vbuffer_list_update_hook): New variable.
      * lisp.h (other_buffer_safely): Add prototype in buffer.c
      * window.h (resize_frame_windows): Move up in code.
      (Fwindow_frame): Remove EXFUN.
      (replace_buffer_in_all_windows): Remove prototype.
      (replace_buffer_in_windows_safely): Add prototype.
      * window.c: Declare Qdelete_window static again.  Move down
      declaration of select_count.
      (Fnext_window, Fprevious_window): Rewrite doc-strings.
      (Fother_window): Move to window.el.
      (window_loop): Remove DELETE_BUFFER_WINDOWS and UNSHOW_BUFFER
      (Fdelete_windows_on, Freplace_buffer_in_windows): Move to
      (replace_buffer_in_windows): Implement by calling
      (replace_buffer_in_all_windows): Remove with some functionality
      moved into replace_buffer_in_windows_safely.
      (replace_buffer_in_windows_safely): New function.
      (select_window_norecord, select_frame_norecord): Move in front
      of run_window_configuration_change_hook.  Remove now obsolete
      (Fset_window_buffer): Rewrite doc-string.  Call
      (keys_of_window): Move binding for other-window to window.el.
      * loadup.el (top-level): Load window before files for the sake
      of replace-buffer-in-windows.
      * files.el (read-buffer-to-switch)
      (switch-to-buffer-other-frame, display-buffer-other-frame): Move
      to window.el.
      * simple.el (get-next-valid-buffer, last-buffer, next-buffer)
      (previous-buffer): Move to window.el.
      * bindings.el (unbury-buffer): Move to window.el.
      * window.el (delete-other-windows-vertically): Move after
      definition of delete-other-windows.
      (other-window, delete-windows-on, replace-buffer-in-windows):
      Move here from window.c.
      (record-window-buffer, unrecord-window-buffer)
      (set-window-buffer-start-and-point, switch-to-prev-buffer)
      (switch-to-next-buffer): New functions.
      (get-next-valid-buffer, last-buffer, next-buffer): Move here
      from simple.el.  Call switch-to-next-buffer.
      (previous-buffer): Move here from simple.el.  Call
      (bury-buffer): Move here from buffer.c.  Switch to previous
      buffer when window cannot be deleted.
      (unbury-buffer): Move here from bindings.el.
      (ctl-x-map): Move binding for other-window from window.c to
      (read-buffer-to-switch, switch-to-buffer-other-window)
      (switch-to-buffer-other-frame): Move here from files.el.
      (normalize-buffer-to-switch-to): New functions.
      (switch-to-buffer): Move here from buffer.c.  Use
      read-buffer-to-switch and normalize-buffer-to-switch-to.
    • Chong Yidong's avatar
      Cruft removal in struct image. · b50691aa
      Chong Yidong authored
      * src/dispextern.h (struct image): Replace data member, whose int_val
      and ptr_val fields were not used by anything, with a single
      lisp_val object.
      * src/image.c (Fimage_metadata, make_image, mark_image, tiff_load)
      (gif_clear_image, gif_load, imagemagick_load_image)
      (gs_clear_image, gs_load): Callers changed.
  2. 10 Jun, 2011 11 commits
    • Paul Eggert's avatar
      * buffer.h: Include <time.h>, for time_t. · cca69397
      Paul Eggert authored
      Needed to build on FreeBSD 8.2.  Problem reported by Herbert J. Skuhra.
    • Paul Eggert's avatar
    • Paul Eggert's avatar
      Make identifiers static if they are not used in other modules. · 4b66faf3
      Paul Eggert authored
      * data.c (Qcompiled_function, Qframe, Qvector):
      * image.c (QimageMagick, Qsvg):
      * minibuf.c (Qmetadata):
      * window.c (resize_window_check, resize_root_window): Now static.
      * window.h (resize_window_check, resize_root_window): Remove decls.
    • Paul Eggert's avatar
    • Paul Eggert's avatar
      * window.c: Fix minor problems reported by GCC 4.6.0. · 46a4ce9e
      Paul Eggert authored
      (window_deletion_count, delete_deletable_window): Remove; unused.
      (window_body_lines): Now static.
      (Fdelete_other_windows_internal): Mark vars as initialized.
      Make sure 'resize_failed' is initialized.
      (run_window_configuration_change_hook): Rename local to avoid shadowing.
      (resize_window_apply): Remove unused local.
      * window.h (delete_deletable_window): Remove decl.
    • Paul Eggert's avatar
      * image.c: Fix minor problems reported by GCC 4.6.0. · 33290528
      Paul Eggert authored
      (gif_load, svg_load_image): Rename locals to avoid shadowing.
      (imagemagick_load_image): Fix pointer signedness problem by changing
      last arg from unsigned char * to char *.  All uses changed.
      Also, fix a local for similar reasons.
      Remove unused locals.  Remove locals to avoid shadowing.
      (fn_rsvg_handle_free): Remove; unused.
      (svg_load, svg_load_image): Fix pointer signedness problem.
    • Paul Eggert's avatar
    • Chong Yidong's avatar
    • Martin Rudalics's avatar
      Some more window.h fixes missing in 2011-06-10T06:55:18Z!rudalics@gmx.at. · 2c8e37d4
      Martin Rudalics authored
      * window.h (resize_proportionally, orig_total_lines)
      (orig_top_line): Remove from window structure.
      (set_window_height, set_window_width, change_window_heights)
      (Fdelete_window): Remove prototypes.
      (resize_frame_windows): Remove duplicate declaration.
    • Eli Zaretskii's avatar
      Avoid compiler warnings about missing prototypes of window.c functions. · 440a42e3
      Eli Zaretskii authored
       src/window.h (resize_frame_windows, resize_window_check)
       (delete_deletable_window, resize_root_window)
       (resize_frame_windows): Declare prototypes.
       src/ window.c (resize_window_apply): Make definition be "static" to
       match the prototype.
    • Martin Rudalics's avatar
      Move window resize code from window.c to window.el. · 562dd5e9
      Martin Rudalics authored
      * window.c: Remove declarations of Qwindow_size_fixed,
      window_min_size_1, window_min_size_2, window_min_size,
      size_window, window_fixed_size_p, enlarge_window, delete_window.
      Remove static from declaration of Qdelete_window, it's
      temporarily needed by Fbury_buffer.
      (replace_window): Don't assign orig_top_line and
      (Fdelete_window, delete_window): Remove.  Window deletion is
      handled by window.el.
      (window_loop): Remove DELETE_OTHER_WINDOWS case.  Replace
      Fdelete_window calls with calls to Qdelete_window.
      (Fdelete_other_windows): Remove.  Deleting other windows is
      handled by window.el.
      (window_fixed_size_p): Remove.  Fixed-sizeness of windows is
      handled in window.el.
      (window_min_size_2, window_min_size_1, window_min_size): Remove.
      Window minimum sizes are handled in window.el.
      (shrink_windows, size_window, set_window_height)
      (set_window_width, change_window_heights, window_height)
      (window_width, CURBEG, CURSIZE, enlarge_window)
      (adjust_window_trailing_edge, Fadjust_window_trailing_edge)
      (Fenlarge_window, Fshrink_window): Remove.  Window resizing is
      handled in window.el.
      (make_dummy_parent): Rename to make_parent_window and give it a
      second argument horflag.
      (make_window): Don't set resize_proportionally any more.
      (Fsplit_window): Remove.  Windows are split in window.el.
      (save_restore_action, save_restore_orig_size)
      (shrink_window_lowest_first, save_restore_orig_size): Remove.
      Resize mini windows in window.el.
      (grow_mini_window, shrink_mini_window): Implement by calling
      Qresize_root_window_vertically, resize_window_check and
      (saved_window, Fset_window_configuration, save_window_save): Do
      not handle orig_top_line, orig_total_lines, and
      (window_min_height, window_min_width): Move to window.el.
      (keys_of_window): Move bindings for delete-other-windows,
      split-window, delete-window and enlarge-window to window.el.
      * buffer.c: Temporarily extern Qdelete_window.
      (Fbury_buffer): Temporarily call Qdelete_window instead of
      Fdelete_window (Fbury_buffer will move to window.el soon).
      * frame.c (set_menu_bar_lines_1): Remove code handling
      orig_top_line and orig_total_lines.
      * dispnew.c (adjust_frame_glyphs_initially): Don't use
      set_window_height but set heights directly.
      (change_frame_size_1): Use resize_frame_windows.
      * xdisp.c (init_xdisp): Don't use set_window_height but set
      heights directly.
      * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): Use
      resize_frame_windows instead of change_window_heights and run
      * w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows
      instead of change_window_heights and run
      * window.el (window-min-height, window-min-width): Move here
      from window.c.  Add defcustoms and rewrite doc-strings.
      (resize-mini-window, resize-window): New functions.
      (adjust-window-trailing-edge, enlarge-window, shrink-window):
      Move here from window.c.
      (maximize-window, minimize-window): New functions.
      (delete-window, delete-other-windows, split-window): Move here
      from window.c.
      (window-split-min-size): New function.
      (split-window-keep-point): Mention split-window-above-each-other
      instead of split-window-vertically.
      (split-window-above-each-other, split-window-vertically): Rename
      split-window-vertically to split-window-above-each-other and
      provide defalias for old definition.
      (split-window-side-by-side, split-window-horizontally): Rename
      split-window-horizontally to split-window-side-by-side and provide
      defalias for the old definition.
      (ctl-x-map): Move bindings for delete-window,
      delete-other-windows and enlarge-window here from window.c.
      Replace bindings for split-window-vertically and
      split-window-horizontally by bindings for
      split-window-above-each-other and split-window-side-by-side.
      * cus-start.el (all): Remove entries for window-min-height and
      window-min-width.  Add entries for window-splits and
  3. 09 Jun, 2011 1 commit
    • Martin Rudalics's avatar
      Final preparations for new window resize code. · 1a13852e
      Martin Rudalics authored
      * window.c (replace_window): Rename second argument REPLACEMENT to
      NEW.  New third argument SETFLAG.  Rewrite.
      (delete_window, make_dummy_parent): Call replace_window with
      third argument 1.
      (window_list_1): Move down in code.
      (run_window_configuration_change_hook): Move set_buffer part
      before select_frame_norecord part in order to unwind correctly.
      Rename count1 to count.
      (recombine_windows, delete_deletable_window, resize_root_window)
      (Frun_window_configuration_change_hook, make_parent_window)
      (resize_window_check, resize_window_apply, Fresize_window_apply)
      (resize_frame_windows, Fsplit_window_internal)
      (Fdelete_window_internal, Fresize_mini_window_internal): New
      (syms_of_window): New variables Vwindow_splits and Vwindow_nest.
  4. 08 Jun, 2011 3 commits
    • Martin Rudalics's avatar
      New symbols in window.c. · b9e809c2
      Martin Rudalics authored
      (MIN_SAFE_WINDOW_HEIGHT): Really remove them from window.c.
      (syms_of_window): New Lisp objects Qrecord_window_buffer,
      Qwindow_deletable_p, Qdelete_window, Qreplace_buffer_in_windows,
      Qget_mru_window, Qresize_root_window,
      Qresize_root_window_vertically, Qsafe, Qabove, Qbelow,
      Qauto_buffer_name; staticpro them.
    • Martin Rudalics's avatar
      Add some new members to window structure in window.h. · 496e208e
      Martin Rudalics authored
      * window.h (window): Add some new members to window structure -
      normal_lines, normal_cols, new_total, new_normal, clone_number,
      splits, nest, prev_buffers, next_buffers.
      (WINDOW_TOTAL_SIZE): Move here from window.c.
      * window.c (WINDOW_TOTAL_SIZE): Move to window.h.
      (make_dummy_parent): Set new members of windows structure.
      (make_window): Move down in code.  Handle new members of window
      (Fwindow_clone_number, Fwindow_splits, Fset_window_splits)
      (Fwindow_nest, Fset_window_nest, Fwindow_new_total)
      (Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers)
      (Fset_window_prev_buffers, Fwindow_next_buffers)
      (Fset_window_next_buffers, Fset_window_clone_number): New
      (Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start)
      (Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p):
      Doc-string fixes.
      (Fwindow_parameters, Fwindow_parameter, Fset_window_parameter):
      Argument WINDOW can be now internal window too.
      (Fwindow_use_time): Move up in code.
      (Fget_buffer_window): Rename argument FRAME to ALL-FRAMES.
      Rewrite doc-string.
      (Fset_window_configuration, saved_window)
      (Fcurrent_window_configuration, save_window_save): Handle new
      members of window structure.
    • Martin Rudalics's avatar
      window-height, window-width, and window-full-width-p are now in window.el. · f3d1777e
      Martin Rudalics authored
      * window.c (Fwindow_height, Fwindow_width, Fwindow_full_width_p):
      * window.el (window-height): Defalias to window-total-height.
      (window-width): Defalias to window-body-width.
  5. 07 Jun, 2011 4 commits
    • Martin Rudalics's avatar
      Move get-lru-window and get-largest-window to window.el. · 190b47e6
      Martin Rudalics authored
      * window.c (window_loop): Remove handling of GET_LRU_WINDOW and
      (Fget_lru_window, Fget_largest_window): Move to window.el.
      * window.el (get-lru-window, get-largest-window): Move here from
      window.c.  Rename first argument to ALL-FRAMES.  Rephrase
      (get-buffer-window-list): Rewrite using window-list-1.  Rephrase
    • Martin Rudalics's avatar
      Make delete_all_subwindows argument a Lisp_Object. · fa8a67e6
      Martin Rudalics authored
      * window.c (delete_window, Fset_window_configuration): Call
      delete_all_subwindows with window as argument.
      (delete_all_subwindows): Take a window as argument and not a
      structure.  Rewrite.
      * window.h: delete_all_subwindows now takes a Lisp_Object as
      * frame.c (delete_frame): Call delete_all_subwindows with root
      window as argument.
    • Martin Rudalics's avatar
      Install some window-size related functions and window-list-1. · abde8f8c
      Martin Rudalics authored
      * window.c (Fwindow_total_size, Fwindow_left_column)
      (Fwindow_top_line, window_body_lines, Fwindow_body_size)
      (Fwindow_list_1): New functions.
      (window_box_text_cols): Replace with window_body_cols.
      (Fwindow_width, Fscroll_left, Fscroll_right): Use
      window_body_cols instead of window_box_text_cols.
      * window.h: Extern window_body_cols instead of
      * indent.c (compute_motion, Fcompute_motion): Use
      window_body_cols instead of window_box_text_cols.
    • Daniel Colascione's avatar
  6. 06 Jun, 2011 13 commits
    • Chong Yidong's avatar
    • Paul Eggert's avatar
      Add Bug#8794 to ChangeLog entry. · b862a52a
      Paul Eggert authored
    • Stefan Monnier's avatar
      * src/window.h (Fwindow_frame): Declare. · d6d100dd
      Stefan Monnier authored
    • Paul Eggert's avatar
      * alloc.c: Simplify handling of large-request failures (Bug#8800). · 2b6148e4
      Paul Eggert authored
      (SPARE_MEMORY): Always define.
      (LARGE_REQUEST): Remove.
      (memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.
    • Martin Rudalics's avatar
      Move some window-related functions from frame.c to window.c. · 727e958e
      Martin Rudalics authored
      * lisp.h: Move EXFUNS for Fframe_root_window,
      Fframe_first_window and Fset_frame_selected_window to window.h.
      * window.h: Move EXFUNS for Fframe_root_window,
      Fframe_first_window and Fset_frame_selected_window here from
      * frame.c (Fwindow_frame, Fframe_first_window)
      (Fframe_root_window, Fframe_selected_window)
      (Fset_frame_selected_window): Move to window.c.
      (Factive_minibuffer_window): Move to minibuf.c.
      (Fother_visible_frames_p): New function.
      * minibuf.c (Factive_minibuffer_window): Move here from frame.c.
      * window.c (Fwindow_frame): Move here from frame.c.  Accept any
      window as argument.
      (Fframe_root_window, Fframe_first_window)
      (Fframe_selected_window): Move here from frame.c.  Accept frame
      or arbitrary window as argument.  Update doc-strings.
      (Fminibuffer_window): Move up in code.
      (Fwindow_minibuffer_p): Move up in code and simplify.
      (Fset_frame_selected_window): Move here from frame.c.  Marginal
      (Fselected_window, select_window, Fselect_window): Move up in
      code.  Minor doc-string fixes.
    • Martin Rudalics's avatar
      Expose window-tree functions in Elisp. · bf60a96b
      Martin Rudalics authored
      (Fwindow_buffer): Move up and rewrite doc-string.
      (Fwindow_parent, Fwindow_vchild, Fwindow_hchild, Fwindow_next)
      (Fwindow_prev): New functions.
    • Paul Eggert's avatar
      Check for overflow when converting integer to cons and back. · be44ca6c
      Paul Eggert authored
      * charset.c (Fdefine_charset_internal, Fdecode_char):
      Use cons_to_unsigned to catch overflow.
      (Fencode_char): Use INTEGER_TO_CONS.
      * composite.h (LGLYPH_CODE): Use cons_to_unsigned.
      * data.c (long_to_cons, cons_to_long): Remove.
      (cons_to_unsigned, cons_to_signed): New functions.
      These signal an error for invalid or out-of-range values.
      * dired.c (Ffile_attributes): Use INTEGER_TO_CONS.
      * fileio.c (Fset_visited_file_modtime): Use CONS_TO_INTEGER.
      * font.c (Ffont_variation_glyphs):
      * fontset.c (Finternal_char_font): Use INTEGER_TO_CONS.
      * lisp.h: Include <intprops.h>.
      (cons_to_signed, cons_to_unsigned): New decls.
      (long_to_cons, cons_to_long): Remove decls.
      * undo.c (record_first_change): Use INTEGER_TO_CONS.
      (Fprimitive_undo): Use CONS_TO_INTEGER.
      * xfns.c (Fx_window_property): Likewise.
      * xselect.c: Include <limits.h>.
      (x_own_selection, selection_data_to_lisp_data):
      (x_handle_selection_request, x_handle_selection_clear)
      (x_get_foreign_selection, Fx_disown_selection_internal)
      (Fx_get_atom_name, x_send_client_event): Use CONS_TO_INTEGER.
      (lisp_data_to_selection_data): Use cons_to_unsigned.
      (x_fill_property_data): Use cons_to_signed.
      Report values out of range.
    • Martin Rudalics's avatar
      Prepare for exposing window-tree functions in Elisp. · f230ecc9
      Martin Rudalics authored
      * window.c (decode_window, decode_any_window): Move up in code.
      (Fwindowp, Fwindow_live_p): Rewrite doc-strings.
      (inhibit_frame_unsplittable): Remove unused variable.
    • Paul Eggert's avatar
      Check for buffer and string overflow more precisely. · d1f3d2af
      Paul Eggert authored
      * buffer.h (BUF_BYTES_MAX): New macro.
      * lisp.h (STRING_BYTES_MAX): New macro.
      * alloc.c (Fmake_string):
      * character.c (string_escape_byte8):
      * coding.c (coding_alloc_by_realloc):
      * doprnt.c (doprnt):
      * editfns.c (Fformat):
      * eval.c (verror):
      since they may not be the same number.
      * editfns.c (Finsert_char):
      * fileio.c (Finsert_file_contents):
      Likewise for BUF_BYTES_MAX.
    • Paul Eggert's avatar
      * image.c: Use ptrdiff_t, not int, for sizes. · dd52fcea
      Paul Eggert authored
      (slurp_file): Switch from int to ptrdiff_t.
      All uses changed.
      (slurp_file): Check that file size fits in both size_t (for
      malloc) and ptrdiff_t (for sanity and safety).
    • Paul Eggert's avatar
      * fileio.c (Fverify_visited_file_modtime): Avoid time overflow · 7f9bbdbb
      Paul Eggert authored
      if b->modtime has its maximal value.
    • Paul Eggert's avatar
    • Paul Eggert's avatar
      * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacO). · 4d09bcf6
      Paul Eggert authored
      Fixes: debbugs:8800
  7. 05 Jun, 2011 3 commits