1. 12 Jun, 2011 1 commit
    • Martin Rudalics's avatar
      Fix make_frame, introduce Vtemp_buffer_show_specifiers, cleanup doc-strings. · e10ac9f1
      Martin Rudalics authored
      * frame.c (make_frame): Call other_buffer_safely instead of
      other_buffer.
      
      * window.c (temp_output_buffer_show): Call display_buffer with
      second argument Vtemp_buffer_show_specifiers and reset latter
      immediately after the call.
      (Vtemp_buffer_show_specifiers): New variable.
      (auto_window_vscroll_p, next_screen_context_lines)
      (Vscroll_preserve_screen_position): Remove leading asterisks from
      doc-strings.
      e10ac9f1
  2. 11 Jun, 2011 3 commits
    • Paul Eggert's avatar
      * buffer.c (Qclone_number): Remove for now, as it's unused. · 4475bec4
      Paul Eggert authored
      (record_buffer, Funrecord_buffer): Rename local to avoid shadowing.
      (record_buffer): Remove unused local.
      * frame.c (other_visible_frames, frame_buffer_list): Now static.
      (set_frame_buffer_list): Remove; unused.
      * frame.h (other_visible_frames): Remove decl.
      * keyboard.h (menu_items_inuse): Declare only if USE_GTK || USE_MOTIF.
      * lisp.h (frame_buffer_list, set_frame_buffer_list): Remove decls.
      (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Declare only
      if HAVE_GPM.
      * menu.c (menu_items_inuse): Now static unless USE_GTK || USE_MOTIF.
      * process.c (add_gpm_wait_descriptor, delete_gpm_wait_descriptor):
      Define only if HAVE_GPM.
      * widget.c (EmacsFrameResize, emacsFrameClassRec): Now static.
      (update_hints_inhibit): Remove; never set.  All uses removed.
      * widgetprv.h (emacsFrameClassRec): Remove decl.
      * window.c (delete_deletable_window): Now returns void, since it
      wasn't returning anything.
      (compare_window_configurations): Remove unused locals.
      * xfns.c (x_set_scroll_bar_default_width): Remove unused locals.
      * xmenu.c (x_menu_set_in_use): Define only if USE_GTK || USE_MOTIF.
      Omit no-longer-needed #ifdef USE_X_TOOLKIT, since USE_X_TOOLKIT is
      implied by USE_GTK || USE_MOTIF.
      (dialog_selection_callback) [!USE_GTK]: Prefer intptr_t for integers
      the same widths as pointers.  This follows up on the 2011-05-06 patch.
      * xterm.c (x_alloc_lighter_color_for_widget): Define only if USE_LUCID.
      * xterm.h: Likewise.
      (x_menu_set_in_use): Declare only if USE_GTK || USE_MOTIF.
      4475bec4
    • 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
      window.el.
      (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.
      6198ccd0
    • 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
      code.
      (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
      section.
      
      * 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
      cases.  Add REPLACE_BUFFER_IN_WINDOWS_SAFELY case.
      (Fdelete_windows_on, Freplace_buffer_in_windows): Move to
      window.el.
      (replace_buffer_in_windows): Implement by calling
      Qreplace_buffer_in_windows.
      (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
      declarations.
      (Fset_window_buffer): Rewrite doc-string.  Call
      Qrecord_window_buffer.
      (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-window)
      (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
      switch-to-prev-buffer.
      (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
      here.
      (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.
      9397e56f
  3. 10 Jun, 2011 4 commits
    • 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.
      4b66faf3
    • 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.
      46a4ce9e
    • 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.
      440a42e3
    • 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
      orig_total_lines.
      (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
      resize_window_apply.
      (saved_window, Fset_window_configuration, save_window_save): Do
      not handle orig_top_line, orig_total_lines, and
      resize_proportionally.
      (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
      run_window_configuration_change_hook.
      
      * w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows
      instead of change_window_heights and run
      run_window_configuration_change_hook.
      
      * 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
      window-nest.
      562dd5e9
  4. 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)
      (Fdelete_other_windows_internal)
      (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
      functions.
      (syms_of_window): New variables Vwindow_splits and Vwindow_nest.
      1a13852e
  5. 08 Jun, 2011 3 commits
    • Martin Rudalics's avatar
      New symbols in window.c. · b9e809c2
      Martin Rudalics authored
      * window.c: (WINDOW_TOTAL_SIZE, MIN_SAFE_WINDOW_WIDTH)
      (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.
      b9e809c2
    • 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.
      (MIN_SAFE_WINDOW_WIDTH, MIN_SAFE_WINDOW_HEIGHT): Define.
      
      * 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
      structure.
      (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
      functions.
      (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.
      496e208e
    • 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):
      Remove.
      * window.el (window-height): Defalias to window-total-height.
      (window-width): Defalias to window-body-width.
      f3d1777e
  6. 07 Jun, 2011 3 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
      GET_LARGEST_WINDOW.
      (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
      doc-strings.
      (get-buffer-window-list): Rewrite using window-list-1.  Rephrase
      doc-string.
      190b47e6
    • 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
      argument.
      
      * frame.c (delete_frame): Call delete_all_subwindows with root
      window as argument.
      fa8a67e6
    • 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
      window_box_text_cols.
      
      * indent.c (compute_motion, Fcompute_motion): Use
      window_body_cols instead of window_box_text_cols.
      abde8f8c
  7. 06 Jun, 2011 3 commits
    • 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
      lisp.h.
      
      * 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
      rewrite.
      (Fselected_window, select_window, Fselect_window): Move up in
      code.  Minor doc-string fixes.
      727e958e
    • 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.
      bf60a96b
    • 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.
      f230ecc9
  8. 11 May, 2011 1 commit
  9. 09 May, 2011 1 commit
    • Eli Zaretskii's avatar
      Backport revisions... · 14fe7b53
      Eli Zaretskii authored
      Backport revisions 2011-04-24T05:30:24Z!eggert@cs.ucla.edu..2011-04-25T19:40:22Z!eggert@cs.ucla.edu (inclusive) from trunk (bug#8623)
      
      	The next log entry shows the actual changes by Paul Eggert.
      
       Fix a problem with aliasing and vector headers.
       GCC 4.6.0 optimizes based on type-based alias analysis.  For
       example, if b is of type struct buffer * and v of type struct
       Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
       != &v->size, and therefore "v->size = 1; b->size = 2; return
       v->size;" must therefore return 1.  This assumption is incorrect
       for Emacs, since it type-puns struct Lisp_Vector * with many other
       types.  To fix this problem, this patch adds a new type struct
       vector_header that documents the constraints on layout of vectors
       and pseudovectors, and helps optimizing compilers not get fooled
       by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
       XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
       src/lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
       XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
       of writing XVECTOR (foo)->header.size.
       src/lisp.h: Say "vectorlike header" rather than "vector header.
       (struct vectorlike_header): Rename from struct vector_header.
       (XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE.
       All uses changed.
       (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
       (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
       member.
       (XSETPVECTYPE): Rewrite in terms of new macro.
       (XSETPVECTYPESIZE): New macro, specifying both type and size.
       This is a bit clearer, and further avoids the possibility of
       undesirable aliasing.
       (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
       (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
       and XVECTOR_HEADER_SIZE.
       (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
       since Lisp_Subr is a special case (no "next" field).
       (ASIZE): Rewrite in terms of XVECTOR_SIZE.
       (struct vector_header): New type.
       (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
       object, to help avoid aliasing.
       (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
       (SUBRP): Likewise, since Lisp_Subr is a special case.
       src/lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
       (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
       (struct Lisp_Hash_Table): Combine first two members into a single
       struct vector_header member.  All uses of "size" and "next" members
       changed to be "header.size" and "header.next".
       src/buffer.h (struct buffer): Likewise.
       src/font.h (struct font_spec, struct font_entity, struct font): Likewise.
       src/frame.h (struct frame): Likewise.
       src/process.h (struct Lisp_Process): Likewise.
       src/termhooks.h (struct terminal): Likewise.
       src/window.c (struct save_window_data, struct saved_window): Likewise.
       src/window.h (struct window): Likewise.
       src/alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
       Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
       src/buffer.c (init_buffer_once): Likewise.
       src/lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
       special case.
       src/process.c (Fformat_network_address): Use local var for size,
       for brevity.
       src/fns.c (vector): Remove; this old hack is no longer needed.
       src/bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
      14fe7b53
  10. 29 Apr, 2011 1 commit
  11. 25 Apr, 2011 2 commits
    • Paul Eggert's avatar
      * lisp.h: Say "vectorlike header" rather than "vector header. · b102ceb1
      Paul Eggert authored
      (struct vectorlike_header): Rename from struct vector_header.
      (XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE.
      All uses changed.
      b102ceb1
    • Paul Eggert's avatar
      lisp.h: Fix a problem with aliasing and vector headers. · eab3844f
      Paul Eggert authored
      GCC 4.6.0 optimizes based on type-based alias analysis.  For
      example, if b is of type struct buffer * and v of type struct
      Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
      != &v->size, and therefore "v->size = 1; b->size = 2; return
      v->size;" must therefore return 1.  This assumption is incorrect
      for Emacs, since it type-puns struct Lisp_Vector * with many other
      types.  To fix this problem, this patch adds a new type struct
      vector_header that documents the constraints on layout of vectors
      and pseudovectors, and helps optimizing compilers not get fooled
      by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
      XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
      * lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
      XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
      of writing XVECTOR (foo)->header.size.
      (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
      (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
      member.
      (XSETPVECTYPE): Rewrite in terms of new macro.
      (XSETPVECTYPESIZE): New macro, specifying both type and size.
      This is a bit clearer, and further avoids the possibility of
      undesirable aliasing.
      (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
      (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
      and XVECTOR_HEADER_SIZE.
      (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
      since Lisp_Subr is a special case (no "next" field).
      (ASIZE): Rewrite in terms of XVECTOR_SIZE.
      (struct vector_header): New type.
      (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
      object, to help avoid aliasing.
      (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
      (SUBRP): Likewise, since Lisp_Subr is a special case.
      * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
      (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
      (struct Lisp_Hash_Table): Combine first two members into a single
      struct vector_header member.  All uses of "size" and "next" members
      changed to be "header.size" and "header.next".
      * buffer.h (struct buffer): Likewise.
      * font.h (struct font_spec, struct font_entity, struct font): Likewise.
      * frame.h (struct frame): Likewise.
      * process.h (struct Lisp_Process): Likewise.
      * termhooks.h (struct terminal): Likewise.
      * window.c (struct save_window_data, struct saved_window): Likewise.
      * window.h (struct window): Likewise.
      * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
      Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
      * buffer.c (init_buffer_once): Likewise.
      * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
      special case.
      * process.c (Fformat_network_address): Use local var for size,
      for brevity.
      eab3844f
  12. 14 Apr, 2011 4 commits
  13. 11 Apr, 2011 2 commits
    • Paul Eggert's avatar
      Declare Lisp_Object Q* variables to be 'static' if not exproted. · 955cbe7b
      Paul Eggert authored
      This makes it easier for human readers (and static analyzers)
      to see whether these variables are used from other modules.
      * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c:
      * ccl.c, character.c, charset.c, cmds.c, coding.c, composite.c:
      * data.c, dbusbind.c, dired.c, editfns.c, eval.c, fileio.c, fns.c:
      * font.c, frame.c, fringe.c, ftfont.c, image.c, keyboard.c, keymap.c:
      * lread.c, macros.c, minibuf.c, print.c, process.c, search.c:
      * sound.c, syntax.c, textprop.c, window.c, xdisp.c, xfaces.c, xfns.c:
      * xmenu.c, xselect.c:
      Declare Q* vars static if they are not used in other modules.
      * ccl.h, character.h, charset.h, coding.h, composite.h, font.h:
      * frame.h, intervals.h, keyboard.h, lisp.h, process.h, syntax.h:
      Remove decls of unexported vars.
      * keyboard.h (EVENT_HEAD_UNMODIFIED): Remove now-unused macro.
      955cbe7b
    • Paul Eggert's avatar
      Make Emacs functions such as Fatom 'static' by default. · 16a97296
      Paul Eggert authored
      This makes it easier for human readers (and static analyzers)
      to see whether these functions can be called from other modules.
      DEFUN now defines a static function.  To make the function external
      so that it can be used in other C modules, use the new macro DEFUE.
      * lisp.h (DEFINE_FUNC): New macro, with the old contents of DEFUN.
      (DEFUN): Rewrite in terms of DEFINE_FUNC.  It now generates a
      static function definition.  Use DEFUE if you want an extern one.
      (DEFUE, INFUN): New macros.
      (Funibyte_char_to_multibyte, Fsyntax_table_p, Finit_image_library):
      (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer):
      (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute):
      (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes):
      Remove decls, since these functions are now static.
      (Funintern, Fget_internal_run_time): New decls, since these functions
      were already external.
      * alloc.c, buffer.c, callint.c, callproc.c, casefiddle.c, casetab.c:
      * ccl.c, character.c, chartab.c, cmds.c, coding.c, data.c, dispnew.c:
      * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, floatfns.c:
      * fns.c, font.c, fontset.c, frame.c, image.c, indent.c:
      * keyboard.c, keymap.c, lread.c:
      * macros.c, marker.c, menu.c, minibuf.c, print.c, process.c, search.c:
      * syntax.c, term.c, terminal.c, textprop.c, undo.c:
      * window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xsettings.c:
      Mark functions with DEFUE instead of DEFUN,
      if they are used in other modules.
      * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): New forward
      decls for now-static functions.
      * buffer.h (Fdelete_overlay): Remove decl.
      * callproc.c (Fgetenv_internal): Mark as internal.
      * composite.c (Fremove_list_of_text_properties): Remove decl.
      (Fcomposition_get_gstring): New forward static decl.
      * composite.h (Fcomposite_get_gstring): Remove decl.
      * dired.c (Ffile_attributes): New forward static decl.
      * doc.c (Fdocumntation_property): New forward static decl.
      * eval.c (Ffetch_bytecode): New forward static decl.
      (Funintern): Remove extern decl; now in .h file where it belongs.
      * fileio.c (Fmake_symbolic_link): New forward static decl.
      * image.c (Finit_image_library): New forward static decl.
      * insdel.c (Fcombine_after_change_execute): Make forward decl static.
      * intervals.h (Fprevious_property_change):
      (Fremove_list_of_text_properties): Remove decls.
      * keyboard.c (Fthis_command_keys): Remove decl.
      (Fcommand_execute): New forward static decl.
      * keymap.c (Flookup_key): New forward static decl.
      (Fcopy_keymap): Now static.
      * keymap.h (Flookup_key): Remove decl.
      * process.c (Fget_process): New forward static decl.
      (Fprocess_datagram_address): Mark as internal.
      * syntax.c (Fsyntax_table_p): New forward static decl.
      (skip_chars): Remove duplicate decl.
      * textprop.c (Fprevious_property_change): New forward static decl.
      * window.c (Fset_window_fringes, Fset_window_scroll_bars):
      Now internal.
      (Fset_window_margins, Fset_window_vscroll): New forward static decls.
      * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls.
      16a97296
  14. 08 Apr, 2011 1 commit
    • Chong Yidong's avatar
      Remove internal_with_output_to_temp_buffer, replacing sole user with Lisp. · cbb59342
      Chong Yidong authored
      * lisp/help.el (help-form-show): New function, to be called from C.
      Put help-form output in a buffer named differently than *Help*.
      
      * src/keyboard.c (read_char): Call Lisp function help-form-show,
      instead of using internal_with_output_to_temp_buffer.
      (Qhelp_form_show): New var.
      
      * src/lisp.h (internal_with_output_to_temp_buffer): Remove prototype.
      
      * src/print.c (internal_with_output_to_temp_buffer): Function deleted.
      cbb59342
  15. 07 Apr, 2011 1 commit
    • Paul Eggert's avatar
      error: Print 32- and 64-bit integers portably (Bug#8435). · 5fdb398c
      Paul Eggert authored
      Without this change, on typical 64-bit hosts error ("...%d...", N)
      was used to print both 32- and 64-bit integers N, which relied on
      undefined behavior.
      * lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
      New macro.
      * lisp.h (error, verror): Mark as printf-like functions.
      * eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
      Report overflow in size calculations when allocating printf buffer.
      Do not truncate output string at its first null byte.
      * xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
      Truncate the output at a character boundary, since vsnprintf does not
      do that.
      * charset.c (check_iso_charset_parameter): Convert internal
      character to string before calling 'error', since %c now has the
      printf meaning.
      * coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
      overflow when computing char to be passed to 'error'.  Do not
      pass Lisp_Object to 'error'; pass the integer instead.
      * nsfns.m (Fns_do_applescript): Use int, not long, since it's
      formatted with plain %d.
      5fdb398c
  16. 01 Apr, 2011 1 commit
    • Stefan Monnier's avatar
      Miscellanous cleanups in preparation for the merge. · 7200d79c
      Stefan Monnier authored
      * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
      Remove debug statement.
      * lisp/emacs-lisp/bytecomp.el (byte-compile-single-version)
      (byte-compile-version-cond, byte-compile-delay-out)
      (byte-compile-delayed-out): Remove, unused.
      * src/bytecode.c (Fbyte_code): Revert to old calling convention.
      * src/lisp.h (COMPILED_PUSH_ARGS): Remove, unused.
      7200d79c
  17. 31 Mar, 2011 1 commit
    • Juanma Barranquero's avatar
      src/xdisp.c: Remove unused parameters. · e4cc2dfc
      Juanma Barranquero authored
      * dispextern.h (move_it_by_lines):
      * xdisp.c (move_it_by_lines): Remove parameter `need_y_p', unused
        since 2000-12-29T14:24:09Z!gerd@gnu.org.  All callers changed.
        (message_log_check_duplicate): Remove parameters `prev_bol' and
        `this_bol', unused since 1998-01-01T02:27:27Z!rms@gnu.org.  All callers changed.
        (redisplay_internal): Remove parameter `preserve_echo_area',
        unused since 1999-07-21T21:43:52Z!gerd@gnu.org.  All callers changed.
      * indent.c (Fvertical_motion):
      * window.c (window_scroll_pixel_based, Frecenter):
        Don't pass `need_y_p' to `move_it_by_lines'.
      e4cc2dfc
  18. 29 Mar, 2011 1 commit
  19. 23 Mar, 2011 1 commit
  20. 08 Mar, 2011 1 commit
  21. 07 Mar, 2011 2 commits
  22. 06 Mar, 2011 1 commit
  23. 21 Feb, 2011 1 commit
    • Stefan Monnier's avatar
      Use offsets relative to top rather than bottom for stack refs · 3e21b6a7
      Stefan Monnier authored
      * lisp/emacs-lisp/byte-opt.el (byte-compile-side-effect-and-error-free-ops):
      Remove interactive-p.
      (byte-optimize-lapcode): Update optimizations now that stack-refs are
      relative to the top rather than to the bottom.
      * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode):
      Turn stack-ref-0 into dup.
      (byte-compile-form): Don't indirect-function since it can signal
      errors.
      (byte-compile-stack-ref, byte-compile-stack-set): Adjust to stack-refs
      being relative to top rather than to bottom in the byte-code.
      (with-output-to-temp-buffer): Remove.
      (byte-compile-with-output-to-temp-buffer): Remove.
      * lisp/emacs-lisp/cconv.el: Use lexical-binding.
      (cconv--lookup-let): Rename from cconv-lookup-let.
      (cconv-closure-convert-rec): Fix handling of captured+mutated
      arguments in defun/defmacro.
      * lisp/emacs-lisp/eieio-comp.el (eieio-byte-compile-file-form-defmethod):
      Rename from byte-compile-file-form-defmethod.
      Don't byte-compile-lambda.
      (eieio-byte-compile-defmethod-param-convert): Rename from
      byte-compile-defmethod-param-convert.
      * lisp/emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
      Call byte-compile rather than byte-compile-lambda.
      * src/alloc.c (Fgarbage_collect): Don't mark the byte-stack redundantly.
      * src/bytecode.c (exec_byte_code): Change stack_ref and stack_set to use
      offsets relative to top rather than to bottom.
      * lisp/subr.el (with-output-to-temp-buffer): New macro.
      * lisp/simple.el (count-words-region): Don't use interactive-p.
      3e21b6a7