annotate lisp/gutter-items.el @ 2720:6fa9919a9a0b

[xemacs-hg @ 2005-04-08 23:10:01 by crestani] ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         New configure flag: `MC_ALLOC':         * configure.ac (XE_COMPLEX_ARG_ENABLE): Add `--enable-mc-alloc' as         a new configure flag.         * configure.in (AC_INIT_PARSE_ARGS): Add `--mc-alloc' as a new         configure flag.         * configure.usage: Add description for `mc-alloc'.         DUMP_IN_EXEC:         * Makefile.in.in: Condition the installation of a separate dump         file on !DUMP_ON_EXEC.         * configure.ac (XE_COMPLEX_ARG_ENABLE): Add         `--enable-dump-in-exec' as a new configure flag.         * configure.ac: DUMP_IN_EXEC is define as default for PDUMP but         not default for MC_ALLOC.         * configure.in (AC_INIT_PARSE_ARGS): Add `--dump-in-exec' as a         new configure flag.         * configure.in: DUMP_IN_EXEC is define as default for PDUMP but         not default for MC_ALLOC.         * configure.usage: Add description for `dump-in-exec'. lib-src/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         DUMP_IN_EXEC:                  * Makefile.in.in: Only compile insert-data-in-exec if         DUMP_IN_EXEC is defined. lisp/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         MEMORY_USAGE_STATS         * diagnose.el: Add new lisp function to pretty print statistics         about the new allocator.         * diagnose.el (show-mc-alloc-memory-usage): New. modules/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         Remove Lcrecords:                  * postgresql/postgresql.c (allocate_pgconn): Allocate with new         allocator.         * postgresql/postgresql.c (allocate_pgresult): Allocate PGresult         with new allocator.           * postgresql/postgresql.h (struct Lisp_PGconn): Add         lrecord_header.         * postgresql/postgresql.h (struct Lisp_PGresult): Add         lrecord_header.         * ldap/eldap.c (allocate_ldap): Allocate with new allocator.         * ldap/eldap.h (struct Lisp_LDAP): Add lrecord_header. nt/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         New configure flag: `MC_ALLOC':         * config.inc.samp: Add new flag `MC_ALLOC'.         * xemacs.mak: Add flag and configuration output for `MC_ALLOC'.         New files:         * xemacs.dsp: Add source files mc-alloc.c and mc-alloc.h.         * xemacs.mak: Add new object file mc-alloc.obj to dependencies. src/ChangeLog addition: 2005-04-01  Marcus Crestani  <crestani@xemacs.org>         The new allocator.         New configure flag: `MC_ALLOC':         * config.h.in: Add new flag `MC_ALLOC'.         New files:         * Makefile.in.in: Add new object file mc-alloc.o.         * depend: Add new files to dependencies.         * mc-alloc.c: New.         * mc-alloc.h: New.         Running the new allocator from XEmacs:         * alloc.c (deadbeef_memory): Moved to mc-alloc.c.         * emacs.c (main_1): Initialize the new allocator and add         syms_of_mc_alloc.         * symsinit.h: Add syms_of_mc_alloc.         New lrecord allocation and free functions:         * alloc.c (alloc_lrecord): New. Allocates an lrecord, includes         type checking and initializing of the lrecord_header.         * alloc.c (noseeum_alloc_lrecord): Same as above, but increments         the NOSEEUM cons counter.         * alloc.c (free_lrecord): New. Calls the finalizer and frees the         lrecord.         * lrecord.h: Add lrecord allocation prototypes and comments.         Remove old lrecord FROB block allocation:                  * alloc.c (allocate_lisp_storage): Former function to expand         heap. Not needed anymore, remove.         * alloc.c: Completely remove `Fixed-size type macros'         * alloc.c (release_breathing_space): Remove.         * alloc.c (memory_full): Remove release_breathing_space.         * alloc.c (refill_memory_reserve): Remove.         * alloc.c (TYPE_ALLOC_SIZE): Remove.         * alloc.c (DECLARE_FIXED_TYPE_ALLOC): Remove.         * alloc.c (ALLOCATE_FIXED_TYPE_FROM_BLOCK): Remove.         * alloc.c (ALLOCATE_FIXED_TYPE_1): Remove.         * alloc.c (ALLOCATE_FIXED_TYPE): Remove.         * alloc.c (NOSEEUM_ALLOCATE_FIXED_TYPE): Remove.         * alloc.c (struct Lisp_Free): Remove.         * alloc.c (LRECORD_FREE_P): Remove.         * alloc.c (MARK_LRECORD_AS_FREE): Remove.         * alloc.c (MARK_LRECORD_AS_NOT_FREE): Remove.         * alloc.c (PUT_FIXED_TYPE_ON_FREE_LIST): Remove.         * alloc.c (FREE_FIXED_TYPE): Remove.         * alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC): Remove.         Allocate old lrecords with new allocator:                  * alloc.c: DECLARE_FIXED_TYPE_ALLOC removed for all lrecords         defined in alloc.c.         * alloc.c (Fcons): Allocate with new allocator.         * alloc.c (noseeum_cons): Allocate with new allocator.         * alloc.c (make_float): Allocate with new allocator.         * alloc.c (make_bignum): Allocate with new allocator.         * alloc.c (make_bignum_bg): Allocate with new allocator.         * alloc.c (make_ratio): Allocate with new allocator.         * alloc.c (make_ratio_bg): Allocate with new allocator.         * alloc.c (make_ratio_rt): Allocate with new allocator.         * alloc.c (make_bigfloat): Allocate with new allocator.         * alloc.c (make_bigfloat_bf): Allocate with new allocator.         * alloc.c (make_compiled_function): Allocate with new allocator.         * alloc.c (Fmake_symbol): Allocate with new allocator.         * alloc.c (allocate_extent): Allocate with new allocator.         * alloc.c (allocate_event): Allocate with new allocator.         * alloc.c (make_key_data): Allocate with new allocator.         * alloc.c (make_button_data): Allocate with new allocator.         * alloc.c (make_motion_data): Allocate with new allocator.         * alloc.c (make_process_data): Allocate with new allocator.         * alloc.c (make_timeout_data): Allocate with new allocator.         * alloc.c (make_magic_data): Allocate with new allocator.         * alloc.c (make_magic_eval_data): Allocate with new allocator.         * alloc.c (make_eval_data): Allocate with new allocator.         * alloc.c (make_misc_user_data): Allocate with new allocator.         * alloc.c (Fmake_marker): Allocate with new allocator.         * alloc.c (noseeum_make_marker): Allocate with new allocator.         * alloc.c (make_uninit_string): Allocate with new allocator.         * alloc.c (resize_string): Allocate with new allocator.         * alloc.c (make_string_nocopy): Allocate with new allocator.         Garbage Collection:         * alloc.c (GC_CHECK_NOT_FREE): Remove obsolete assertions.         * alloc.c (SWEEP_FIXED_TYPE_BLOCK): Remove.         * alloc.c (SWEEP_FIXED_TYPE_BLOCK_1): Remove.         * alloc.c (sweep_conses): Remove.         * alloc.c (free_cons): Use new allocator to free.         * alloc.c (sweep_compiled_functions): Remove.         * alloc.c (sweep_floats): Remove.         * alloc.c (sweep_bignums): Remove.         * alloc.c (sweep_ratios): Remove.         * alloc.c (sweep_bigfloats): Remove.         * alloc.c (sweep_symbols): Remove.         * alloc.c (sweep_extents): Remove.         * alloc.c (sweep_events): Remove.         * alloc.c (sweep_key_data): Remove.         * alloc.c (free_key_data): Use new allocator to free.         * alloc.c (sweep_button_data): Remove.         * alloc.c (free_button_data): Use new allocator to free.         * alloc.c (sweep_motion_data): Remove.         * alloc.c (free_motion_data): Use new allocator to free.         * alloc.c (sweep_process_data): Remove.         * alloc.c (free_process_data): Use new allocator to free.         * alloc.c (sweep_timeout_data): Remove.         * alloc.c (free_timeout_data): Use new allocator to free.         * alloc.c (sweep_magic_data): Remove.         * alloc.c (free_magic_data): Use new allocator to free.         * alloc.c (sweep_magic_eval_data): Remove.         * alloc.c (free_magic_eval_data): Use new allocator to free.         * alloc.c (sweep_eval_data): Remove.         * alloc.c (free_eval_data): Use new allocator to free.         * alloc.c (sweep_misc_user_data): Remove.         * alloc.c (free_misc_user_data): Use new allocator to free.         * alloc.c (sweep_markers): Remove.         * alloc.c (free_marker): Use new allocator to free.         * alloc.c (garbage_collect_1): Remove release_breathing_space.         * alloc.c (gc_sweep): Remove all the old lcrecord and lrecord         related stuff. Sweeping now works like this: compact string         chars, finalize, sweep.         * alloc.c (common_init_alloc_early): Remove old lrecord         initializations, remove breathing_space.         * emacs.c (Fdump_emacs): Remove release_breathing_space.         * lisp.h: Remove prototype for release_breathing_space.         * lisp.h: Adjust the special cons mark makros.         Lrecord Finalizer:         * alloc.c: Add finalizer to lrecord definition.         * alloc.c (finalize_string): Add finalizer for string.         * bytecode.c: Add finalizer to lrecord definition.         * bytecode.c (finalize_compiled_function): Add finalizer for         compiled function.         * marker.c: Add finalizer to lrecord definition.         * marker.c (finalize_marker): Add finalizer for marker.         These changes build the interface to mc-alloc:         * lrecord.h (MC_ALLOC_CALL_FINALIZER): Tell mc-alloc how to         finalize lrecords.         * lrecord.h (MC_ALLOC_CALL_FINALIZER_FOR_DISKSAVE): Tell         mc-alloc how to finalize for disksave.         Unify lrecords and lcrecords:         * lisp.h (struct Lisp_String): Adjust string union hack to         new lrecord header.         * lrecord.h: Adjust comments.         * lrecord.h (struct lrecord_header): The new lrecord header         includes type, lisp-readonly, free, and uid.         * lrecord.h (set_lheader_implementation): Adjust to new         lrecord_header.         * lrecord.h (struct lrecord_implementation): The field basic_p         for indication of an old lrecord is not needed anymore, remove.         * lrecord.h (MAKE_LRECORD_IMPLEMENTATION): Remove basic_p.         * lrecord.h (MAKE_EXTERNAL_LRECORD_IMPLEMENTATION): Remove         basic_p.         * lrecord.h (copy_sized_lrecord): Remove distinction between         old lrecords and lcrecords.         * lrecord.h (copy_lrecord): Remove distinction between old         lrecords and lcrecords.         * lrecord.h (zero_sized_lrecord): Remove distinction between         old lrecords and lcrecords.         * lrecord.h (zero_lrecord): Remove distinction between old         lrecords and lcrecords.         Remove lcrecords and lcrecord lists:         * alloc.c (basic_alloc_lcrecord): Not needed anymore, remove.         * alloc.c (very_old_free_lcrecord): Not needed anymore, remove.         * alloc.c (copy_lisp_object): No more distinction between         lrecords and lcrecords.         * alloc.c (all_lcrecords): Not needed anymore, remove.         * alloc.c (make_vector_internal): Allocate as lrecord.         * alloc.c (make_bit_vector_internal): Allocate as lrecord.         * alloc.c: Completely remove `lcrecord lists'.         * alloc.c (free_description): Remove.         * alloc.c (lcrecord_list_description): Remove.         * alloc.c (mark_lcrecord_list): Remove.         * alloc.c (make_lcrecord_list): Remove.         * alloc.c (alloc_managed_lcrecord): Remove.         * alloc.c (free_managed_lcrecord): Remove.         * alloc.c (alloc_automanaged_lcrecord): Remove.         * alloc.c (free_lcrecord): Remove.         * alloc.c (lcrecord_stats): Remove.         * alloc.c (tick_lcrecord_stats): Remove.         * alloc.c (disksave_object_finalization_1): Add call to         mc_finalize_for_disksave. Remove the lcrecord way to visit all         objects.         * alloc.c (kkcc_marking): Remove XD_FLAG_FREE_LISP_OBJECT         * alloc.c (sweep_lcrecords_1): Remove.         * alloc.c (common_init_alloc_early): Remove everything related         to lcrecords, remove old lrecord initializations,         * alloc.c (init_lcrecord_lists): Not needed anymore, remove.         * alloc.c (reinit_alloc_early): Remove everything related to         lcrecords.         * alloc.c (init_alloc_once_early): Remove everything related to         lcrecords.         * buffer.c (allocate_buffer): Allocate as lrecord.         * buffer.c (nuke_all_buffer_slots): Use lrecord functions.         * buffer.c (common_init_complex_vars_of_buffer): Allocate as         lrecord.         * buffer.h (struct buffer): Add lrecord_header.         * casetab.c (allocate_case_table): Allocate as lrecord.         * casetab.h (struct Lisp_Case_Table): Add lrecord_header.         * charset.h (struct Lisp_Charset): Add lrecord_header.         * chartab.c (fill_char_table): Use lrecord functions.         * chartab.c (Fmake_char_table): Allocate as lrecord.         * chartab.c (make_char_table_entry): Allocate as lrecord.         * chartab.c (copy_char_table_entry): Allocate as lrecord.         * chartab.c (Fcopy_char_table): Allocate as lrecord.         * chartab.c (put_char_table): Use lrecord functions.         * chartab.h (struct Lisp_Char_Table_Entry): Add lrecord_header.         * chartab.h (struct Lisp_Char_Table): Add lrecord_header.         * console-impl.h (struct console): Add lrecord_header.         * console-msw-impl.h (struct Lisp_Devmode): Add lrecord_header.         * console-msw-impl.h (struct mswindows_dialog_id): Add         lrecord_header.         * console.c (allocate_console): Allocate as lrecord.         * console.c (nuke_all_console_slots): Use lrecord functions.         * console.c (common_init_complex_vars_of_console): Allocate as         lrecord.         * data.c (make_weak_list): Allocate as lrecord.         * data.c (make_weak_box): Allocate as lrecord.         * data.c (make_ephemeron): Allocate as lrecord.         * database.c (struct Lisp_Database): Add lrecord_header.         * database.c (allocate_database): Allocate as lrecord.         * device-impl.h (struct device): Add lrecord_header.         * device-msw.c (allocate_devmode): Allocate as lrecord.         * device.c (nuke_all_device_slots): Use lrecord functions.         * device.c (allocate_device): Allocate as lrecord.         * dialog-msw.c (handle_question_dialog_box): Allocate as lrecord.         * elhash.c (struct Lisp_Hash_Table): Add lrecord_header.         * elhash.c (make_general_lisp_hash_table): Allocate as lrecord.         * elhash.c (Fcopy_hash_table): Allocate as lrecord.         * event-stream.c: Lcrecord lists Vcommand_builder_free_list and         Vtimeout_free_list are no longer needed. Remove.         * event-stream.c (allocate_command_builder): Allocate as lrecord.         * event-stream.c (free_command_builder): Use lrecord functions.         * event-stream.c (event_stream_generate_wakeup): Allocate as         lrecord.         * event-stream.c (event_stream_resignal_wakeup): Use lrecord         functions.         * event-stream.c (event_stream_disable_wakeup): Use lrecord         functions.         * event-stream.c (reinit_vars_of_event_stream): Lcrecord lists         remove.         * events.h (struct Lisp_Timeout): Add lrecord_header.         * events.h (struct command_builder): Add lrecord_header.         * extents-impl.h (struct extent_auxiliary): Add lrecord_header.         * extents-impl.h (struct extent_info): Add lrecord_header.         * extents.c (allocate_extent_auxiliary): Allocate as lrecord.         * extents.c (allocate_extent_info): Allocate as lrecord.         * extents.c (copy_extent): Allocate as lrecord.         * faces.c (allocate_face): Allocate as lrecord.         * faces.h (struct Lisp_Face): Add lrecord_header.         * file-coding.c (allocate_coding_system): Allocate as lrecord.         * file-coding.c (Fcopy_coding_system): Allocate as lrecord.         * file-coding.h (struct Lisp_Coding_System): Add lrecord_header.         * fns.c (Ffillarray): Allocate as lrecord.         * frame-impl.h (struct frame): Add lrecord_header.         * frame.c (nuke_all_frame_slots): Use lrecord functions.         * frame.c (allocate_frame_core): Allocate as lrecord.         * glyphs.c (allocate_image_instance): Allocate as lrecord.         * glyphs.c (Fcolorize_image_instance): Allocate as lrecord.         * glyphs.c (allocate_glyph): Allocate as lrecord.         * glyphs.h (struct Lisp_Image_Instance): Add lrecord_header.         * glyphs.h (struct Lisp_Glyph): Add lrecord_header.         * gui.c (allocate_gui_item): Allocate as lrecord.         * gui.h (struct Lisp_Gui_Item): Add lrecord_header.         * keymap.c (struct Lisp_Keymap): Add lrecord_header.         * keymap.c (make_keymap): Allocate as lrecord.         * lisp.h (struct Lisp_Vector): Add lrecord_header.         * lisp.h (struct Lisp_Bit_Vector): Add lrecord_header.         * lisp.h (struct weak_box): Add lrecord_header.         * lisp.h (struct ephemeron): Add lrecord_header.         * lisp.h (struct weak_list): Add lrecord_header.         * lrecord.h (struct lcrecord_header): Not used, remove.         * lrecord.h (struct free_lcrecord_header): Not used, remove.         * lrecord.h (struct lcrecord_list): Not needed anymore, remove.         * lrecord.h (lcrecord_list): Not needed anymore, remove.         * lrecord.h: (enum data_description_entry_flags): Remove         XD_FLAG_FREE_LISP_OBJECT.         * lstream.c: Lrecord list Vlstream_free_list remove.         * lstream.c (Lstream_new): Allocate as lrecord.         * lstream.c (Lstream_delete): Use lrecod functions.         * lstream.c (reinit_vars_of_lstream): Vlstream_free_list         initialization remove.           * lstream.h (struct lstream): Add lrecord_header.         * emacs.c (main_1): Remove lstream initialization.         * mule-charset.c (make_charset): Allocate as lrecord.         * objects-impl.h (struct Lisp_Color_Instance): Add         lrecord_header.         * objects-impl.h (struct Lisp_Font_Instance): Add lrecord_header.         * objects.c (Fmake_color_instance): Allocate as lrecord.         * objects.c (Fmake_font_instance): Allocate as lrecord.         * objects.c (reinit_vars_of_objects): Allocate as lrecord.         * opaque.c: Lcreord list Vopaque_ptr_list remove.         * opaque.c (make_opaque): Allocate as lrecord.         * opaque.c (make_opaque_ptr): Allocate as lrecord.         * opaque.c (free_opaque_ptr): Use lrecord functions.         * opaque.c (reinit_opaque_early):         * opaque.c (init_opaque_once_early): Vopaque_ptr_list         initialization remove.         * opaque.h (Lisp_Opaque): Add lrecord_header.         * opaque.h (Lisp_Opaque_Ptr): Add lrecord_header.         * emacs.c (main_1): Remove opaque variable initialization.         * print.c (default_object_printer): Use new lrecord_header.         * print.c (print_internal): Use new lrecord_header.         * print.c (debug_p4): Use new lrecord_header.         * process.c (make_process_internal): Allocate as lrecord.         * procimpl.h (struct Lisp_Process): Add lrecord_header.         * rangetab.c (Fmake_range_table): Allocate as lrecord.         * rangetab.c (Fcopy_range_table): Allocate as lrecord.         * rangetab.h (struct Lisp_Range_Table): Add lrecord_header.         * scrollbar.c (create_scrollbar_instance): Allocate as lrecord.         * scrollbar.h (struct scrollbar_instance): Add lrecord_header.         * specifier.c (make_specifier_internal): Allocate as lrecord.         * specifier.h (struct Lisp_Specifier): Add lrecord_header.         * symbols.c:         * symbols.c (Fmake_variable_buffer_local): Allocate as lrecord.         * symbols.c (Fdontusethis_set_symbol_value_handler): Allocate         as lrecord.         * symbols.c (Fdefvaralias): Allocate as lrecord.         * symeval.h (struct symbol_value_magic): Add lrecord_header.         * toolbar.c (update_toolbar_button): Allocate as lrecord.         * toolbar.h (struct toolbar_button): Add lrecord_header.         * tooltalk.c (struct Lisp_Tooltalk_Message): Add lrecord_header.         * tooltalk.c (make_tooltalk_message): Allocate as lrecord.         * tooltalk.c (struct Lisp_Tooltalk_Pattern): Add lrecord_header.         * tooltalk.c (make_tooltalk_pattern): Allocate as lrecord.         * ui-gtk.c (allocate_ffi_data): Allocate as lrecord.         * ui-gtk.c (allocate_emacs_gtk_object_data): Allocate as lrecord.         * ui-gtk.c (allocate_emacs_gtk_boxed_data): Allocate as lrecord.         * ui-gtk.h (structs): Add lrecord_header.         * window-impl.h (struct window): Add lrecord_header.         * window-impl.h (struct window_mirror): Add lrecord_header.         * window.c (allocate_window): Allocate as lrecord.         * window.c (new_window_mirror): Allocate as lrecord.         * window.c (make_dummy_parent): Allocate as lrecord.         MEMORY_USAGE_STATS         * alloc.c (fixed_type_block_overhead): Not used anymore, remove.         * buffer.c (compute_buffer_usage): Get storage size from new         allocator.         * marker.c (compute_buffer_marker_usage): Get storage size from         new allocator.         * mule-charset.c (compute_charset_usage): Get storage size from         new allocator.         * scrollbar-gtk.c (gtk_compute_scrollbar_instance_usage): Get         storage size from new allocator.         * scrollbar-msw.c (mswindows_compute_scrollbar_instance_usage):         Get storage size from new allocator.         * scrollbar-x.c (x_compute_scrollbar_instance_usage): Get         storage size from new allocator.         * scrollbar.c (compute_scrollbar_instance_usage): Get storage         size from new allocator.         * unicode.c (compute_from_unicode_table_size_1): Get storage         size from new allocator.         * unicode.c (compute_to_unicode_table_size_1): Get storage size         from new allocator.         * window.c (compute_window_mirror_usage): Get storage size from         new allocator.         * window.c (compute_window_usage): Get storage size from new         allocator.         MC_ALLOC_TYPE_STATS:         * alloc.c (alloc_lrecord): Bump lrecord count.         * alloc.c (noseeum_alloc_lrecord): Bump lrecord count.         * alloc.c (struct lrecord_stats): Storage for counts.         * alloc.c (init_lrecord_stats): Zero statistics.         * alloc.c (inc_lrecord_stats): Increase the statistic.         * alloc.c (dec_lrecord_stats): Decrease the statistic.         * alloc.c (gc_plist_hack): Used to print the information.         * alloc.c (Fgarbage_collect): Return the collected information.         * mc-alloc.c (remove_cell): Decrease lrecord count.         * mc-alloc.h: Set flag MC_ALLOC_TYPE_STATS.         * emacs.c (main_1): Init lrecord statistics.         * lrecord.h: Add prototypes for *_lrecord_stats.         Strings:         * alloc.c (Fmake_string): Initialize ascii_begin to zero.         * alloc.c (gc_count_num_short_string_in_use): Remove.         * alloc.c (gc_count_string_total_size): Remove.         * alloc.c (gc_count_short_string_total_size): Remove.         * alloc.c (debug_string_purity): Remove.         * alloc.c (debug_string_purity_print): Remove.         * alloc.c (sweep_strings): Remove.                  Remove static C-readonly Lisp objects:         * alloc.c (c_readonly): Not needed anymore, remove.         * alloc.c (GC_CHECK_LHEADER_INVARIANTS): Remove some obsolete         lheader invariants assertions.         * buffer.c (DEFVAR_BUFFER_LOCAL_1): Allocate dynamically.         * console.c (DEFVAR_CONSOLE_LOCAL_1): Allocate dynamically.         * gpmevent.c: Indirection via MC_ALLOC_Freceive_gpm_event.         * gpmevent.c (Fgpm_enable): Allocate dynamically.         * gpmevent.c (syms_of_gpmevent): Allocate dynamically.         * lisp.h (C_READONLY): Not needed anymore, remove.         * lisp.h (DEFUN): Allocate dynamically.         * lrecord.h (C_READONLY_RECORD_HEADER_P): Not needed anymore,         remove.         * lrecord.h (SET_C_READONLY_RECORD_HEADER): Not needed anymore,         remove.         * symbols.c (guts_of_unbound_marker):         * symeval.h (defsubr): Allocate dynamically.         * symeval.h (DEFSUBR_MACRO): Allocate dynamically.         * symeval.h (DEFVAR_ SYMVAL_FWD): Allocate dynamically.         * tests.c (TESTS_DEFSUBR): Allocate dynamically.         Definition of mcpro:         * lisp.h: Add mcpro prototypes.         * alloc.c (common_init_alloc_early): Add initialization for         mcpros.         * alloc.c (mcpro_description_1): New.         * alloc.c (mcpro_description): New.         * alloc.c (mcpros_description_1): New.         * alloc.c (mcpros_description): New.         * alloc.c (mcpro_one_name_description_1): New.         * alloc.c (mcpro_one_name_description): New.         * alloc.c (mcpro_names_description_1): New.         * alloc.c (mcpro_names_description): New.         * alloc.c (mcpros): New.         * alloc.c (mcpro_names): New.         * alloc.c (mcpro_1): New.         * alloc.c (mc_pro): New.         * alloc.c (garbage_collect_1): Add mcpros to root set.         Usage of mcpro:         * alloc.c (make_string_nocopy): Add string to root set.         * symbols.c (init_symbols_once_early): Add Qunbound to root set.         Changes to the Portable Dumper:                  * alloc.c (FREE_OR_REALLOC_BEGIN): Since dumped objects can be         freed with the new allocator, remove assertion for !DUMPEDP.         * dumper.c: Adjust comments, increase PDUMP_HASHSIZE.         * dumper.c (pdump_make_hash): Shift address only 2 bytes, to         avoid collisions.         * dumper.c (pdump_objects_unmark): No more mark bits within         the object, remove.         * dumper.c (mc_addr_elt): New. Element data structure for mc         hash table.         * dumper.c (pdump_mc_hash): New hash table: `lookup table'.         * dumper.c (pdump_get_mc_addr): New. Lookup for hash table.         * dumper.c (pdump_get_indirect_mc_addr): New. Lookup for         convertibles.         * dumper.c (pdump_put_mc_addr): New. Putter for hash table.         * dumper.c (pdump_dump_mc_data): New. Writes the table for         relocation at load time to the dump file.         * dumper.c (pdump_scan_lisp_objects_by_alignment): New.         Visits all dumped Lisp objects.         * dumper.c (pdump_scan_non_lisp_objects_by_alignment): New.         Visits all other dumped objects.         * dumper.c (pdump_reloc_one_mc): New. Updates all pointers         of an object by using the hash table pdump_mc_hash.         * dumper.c (pdump_reloc_one): Replaced by pdump_reloc_one_mc.         * dumper.c (pdump): Change the structure of the dump file, add         the mc post dump relocation table to dump file.         * dumper.c (pdump_load_finish): Hand all dumped objects to the         new allocator and use the mc post dump relocation table for         relocating the dumped objects at dump file load time, free not         longer used data structures.         * dumper.c (pdump_load): Free the dump file.         * dumper.h: Remove pdump_objects_unmark.         * lrecord.h (DUMPEDP): Dumped objects can be freed, remove.              DUMP_IN_EXEC:         * Makefile.in.in: Linking for and with dump in executable only if         DUMP_IN_EXEC is defined.         * config.h.in: Add new flag `DUMP_IN_EXEC'         * emacs.c: Condition dump-data.h on DUMP_IN_EXEC.         * emacs.c (main_1): Flag `-si' only works if dump image is         written into executable.         Miscellanious         * lrecord.h (enum lrecord_type): Added numbers to all types,         very handy for debugging.         * xemacs.def.in.in: Add mc-alloc functions to make them visible         to the modules.
author crestani
date Fri, 08 Apr 2005 23:11:35 +0000
parents cfe4bcb9bdd4
children 16b17fd1dc93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; gutter-items.el --- Gutter content for XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1999 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Keywords: frames, extensions, internal, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; along with Xmacs; see the file COPYING. If not, write to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 502
diff changeset
25 ;;; Gutter-specific buffers tab code
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
27 (defvar gutter-buffers-tab nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
28 "A tab widget in the gutter for displaying buffers.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
29 Do not set this. Use `set-glyph-image' to change the properties of the tab.")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
30
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
31 (defcustom gutter-buffers-tab-visible-p
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
32 (gutter-element-visible-p default-gutter-visible-p 'buffers-tab)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
33 "Whether the buffers tab is globally visible.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
34 This option should be set through the options menu."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
35 :group 'buffers-tab
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
36 :type 'boolean
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
37 :set #'(lambda (var val)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
38 (set-gutter-element-visible-p default-gutter-visible-p
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
39 'buffers-tab val)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
40 (setq gutter-buffers-tab-visible-p val)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
41
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
42 (defcustom gutter-buffers-tab-enabled t
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
43 "*Whether to enable support for buffers tab in the gutter.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
44 This is different to `gutter-buffers-tab-visible-p' which still runs hooks
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
45 even when the gutter is invisible."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
46 :group 'buffers-tab
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
47 :type 'boolean)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
48
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 430
diff changeset
49 (defvar gutter-buffers-tab-orientation 'top
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 430
diff changeset
50 "Where the buffers tab currently is. Do not set this.")
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 430
diff changeset
51
903
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
52 (defcustom buffers-tab-max-size 6
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
53 "*Maximum number of entries which may appear on the \"Buffers\" tab.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
54 If this is 10, then only the ten most-recently-selected buffers will be
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
55 shown. If this is nil, then all buffers will be shown. Setting this to
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
56 a large number or nil will slow down tab responsiveness."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
57 :type '(choice (const :tag "Show all" nil)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
58 (integer 6))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
59 :group 'buffers-tab)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
60
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
61 (defcustom buffers-tab-switch-to-buffer-function 'buffers-tab-switch-to-buffer
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
62 "*The function to call to select a buffer from the buffers tab.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
63 `switch-to-buffer' is a good choice, as is `pop-to-buffer'."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
64 :type '(radio (function-item switch-to-buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
65 (function-item pop-to-buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
66 (function :tag "Other"))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
67 :group 'buffers-tab)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
68
931
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
69 (defcustom buffers-tab-omit-function 'buffers-tab-omit-some-buffers
903
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
70 "*If non-nil, a function specifying the buffers to omit from the buffers tab.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
71 This is passed a buffer and should return non-nil if the buffer should be
931
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
72 omitted. The default value `buffers-tab-omit-some-buffers' omits
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
73 buffers based on the value of `buffers-tab-omit-list'."
903
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
74 :type '(choice (const :tag "None" nil)
931
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
75 function)
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
76 :group 'buffers-tab)
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
77
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
78 (defcustom buffers-tab-omit-list '("\\` ")
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
79 "*A list of types of buffers to omit from the buffers tab.
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
80 This is only used if `buffers-tab-omit-function' is set to
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
81 `buffers-tab-omit-some-buffers', its default value."
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
82 :type '(checklist
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
83 :greedy t
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
84 :format "%{Omit List%}: \n%v"
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
85 (const
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
86 :tag "Invisible buffers (those whose names start with a space) "
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
87 "\\` ")
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
88 (const
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
89 :tag "Help buffers "
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
90 "\\`\\*Help")
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
91 (const
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
92 :tag "Customize buffers "
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
93 "\\`\\*Customize")
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
94 (const
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
95 :tag "`special' buffers (those whose names start with *) "
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
96 "\\`\\*")
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
97 (const
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
98 :tag "`special' buffers other than *scratch*"
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
99 "\\`\\*\\([^s]\\|s[^c]\\|sc[^r]\\|scr[^a]\\|scra[^t]\\|scrat[^c]\\|scratc[^h]\\|scratch[^*]\\|scratch\\*.+\\)"))
903
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
100 :group 'buffers-tab)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
101
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
102 (defvar buffers-tab-selection-function 'select-buffers-tab-buffers-by-mode
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
103 "*If non-nil, a function specifying the buffers to select in the
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
104 buffers tab. This is passed two buffers and should return non-nil if
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
105 the first buffer should be selected. The default value
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
106 `select-buffers-tab-buffers-by-mode' groups buffers by major mode and
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
107 by `buffers-tab-grouping-regexp'.")
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
108
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
109 (make-obsolete-variable buffers-tab-selection-function
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
110 "Set `buffers-tab-filter-functions' instead.")
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
111
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
112 (defcustom buffers-tab-filter-functions (list 'select-buffers-tab-buffers-by-mode)
1362
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
113 "*A list of functions specifying buffers to display in the buffers tab.
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
114
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
115 If nil, all buffers are kept, up to `buffers-tab-max-size', in usual order.
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
116 Otherwise, each function in the list must take arguments (BUF1 BUF2).
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
117 BUF1 is the candidate, and BUF2 is the current buffer (first in the buffers
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
118 list). The function should return non-nil if BUF1 should be added to the
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
119 buffers tab. BUF1 will be omitted if any of the functions returns nil.
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
120
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
121 Defaults to `select-buffers-tab-buffers-by-mode', which adds BUF1 if BUF1 and
cfe4bcb9bdd4 [xemacs-hg @ 2003-03-18 06:58:19 by stephent]
stephent
parents: 931
diff changeset
122 BUF2 have the same major mode, or both match `buffers-tab-grouping-regexp'."
903
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
123
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
124 :type '(repeat function)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
125 :group 'buffers-tab)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
126
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
127 (defcustom buffers-tab-sort-function nil
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
128 "*If non-nil, a function specifying the buffers to select from the
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
129 buffers tab. This is passed the buffer list and returns the list in the
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
130 order desired for the tab widget. The default value `nil' leaves the
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
131 list in `buffer-list' order (usual most-recently-selected-first)."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
132
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
133 :type '(choice (const :tag "None" nil)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
134 function)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
135 :group 'buffers-tab)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
136
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
137 (make-face 'buffers-tab "Face for displaying the buffers tab.")
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
138 (set-face-parent 'buffers-tab 'modeline)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
139
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
140 (defcustom buffers-tab-face 'buffers-tab
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
141 "*Face to use for displaying the buffers tab."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
142 :type 'face
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
143 :group 'buffers-tab)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
144
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
145 (defcustom buffers-tab-grouping-regexp
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
146 '("^\\(gnus-\\|message-mode\\|mime/viewer-mode\\)"
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
147 "^\\(emacs-lisp-\\|lisp-\\)")
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
148 "*If non-nil, a list of regular expressions for buffer grouping.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
149 Each regular expression is applied to the current major-mode symbol
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
150 name and mode-name, if it matches then any other buffers that match
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
151 the same regular expression be added to the current group."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
152 :type '(choice (const :tag "None" nil)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
153 sexp)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
154 :group 'buffers-tab)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
155
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
156 (defcustom buffers-tab-format-buffer-line-function 'format-buffers-tab-line
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
157 "*The function to call to return a string to represent a buffer in the
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
158 buffers tab. The function is passed a buffer and should return a
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
159 string. The default value `format-buffers-tab-line' just returns the
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
160 name of the buffer, optionally truncated to
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
161 `buffers-tab-max-buffer-line-length'. Also check out
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
162 `slow-format-buffers-menu-line' which returns a whole bunch of info
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
163 about a buffer."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
164 :type 'function
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
165 :group 'buffers-tab)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
166
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
167 (defvar buffers-tab-default-buffer-line-length
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
168 (make-specifier-and-init 'generic '((global ((default) . 25))) t)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
169 "*Maximum length of text which may appear in a \"Buffers\" tab.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
170 This is a specifier, use set-specifier to modify it.")
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
171
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
172 (defcustom buffers-tab-max-buffer-line-length
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
173 (specifier-instance buffers-tab-default-buffer-line-length)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
174 "*Maximum length of text which may appear in a \"Buffers\" tab.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
175 Buffer names over this length will be truncated with elipses.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
176 If this is 0, then the full buffer name will be shown."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
177 :type '(choice (const :tag "Show all" 0)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
178 (integer 25))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
179 :group 'buffers-tab
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
180 :set #'(lambda (var val)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
181 (set-specifier buffers-tab-default-buffer-line-length val)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
182 (setq buffers-tab-max-buffer-line-length val)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
183
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
184 (defun buffers-tab-switch-to-buffer (buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
185 "For use as a value for `buffers-tab-switch-to-buffer-function'."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
186 (unless (eq (window-buffer) buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
187 ;; this used to add the norecord flag to both calls below.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
188 ;; this is bogus because it is a pervasive assumption in XEmacs
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
189 ;; that the current buffer is at the front of the buffers list.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
190 ;; for example, select an item and then do M-C-l
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
191 ;; (switch-to-other-buffer). Things get way confused.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
192 (if (> (length (windows-of-buffer buffer)) 0)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
193 (select-window (car (windows-of-buffer buffer)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
194 (switch-to-buffer buffer))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
195
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
196 (defun select-buffers-tab-buffers-by-mode (buffer-to-select buf1)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
197 "For use as a value of `buffers-tab-selection-function'.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
198 This selects buffers by major mode `buffers-tab-grouping-regexp'."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
199 (let ((mode1 (symbol-name (symbol-value-in-buffer 'major-mode buf1)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
200 (mode2 (symbol-name (symbol-value-in-buffer 'major-mode
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
201 buffer-to-select)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
202 (modenm1 (symbol-value-in-buffer 'mode-name buf1))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
203 (modenm2 (symbol-value-in-buffer 'mode-name buffer-to-select)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
204 (cond ((or (eq mode1 mode2)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
205 (eq modenm1 modenm2)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
206 (and (string-match "^[^-]+-" mode1)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
207 (string-match
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
208 (concat "^" (regexp-quote
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
209 (substring mode1 0 (match-end 0))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
210 mode2))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
211 (and buffers-tab-grouping-regexp
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
212 (find-if #'(lambda (x)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
213 (or
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
214 (and (string-match x mode1)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
215 (string-match x mode2))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
216 (and (string-match x modenm1)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
217 (string-match x modenm2))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
218 buffers-tab-grouping-regexp)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
219 t)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
220 (t nil))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
221
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
222 (defun format-buffers-tab-line (buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
223 "For use as a value of `buffers-tab-format-buffer-line-function'.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
224 This just returns the buffer's name, optionally truncated."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
225 (let ((len (specifier-instance buffers-tab-default-buffer-line-length)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
226 (if (and (> len 0)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
227 (> (length (buffer-name buffer)) len))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
228 (if (string-match ".*<.>$" (buffer-name buffer))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
229 (concat (substring (buffer-name buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
230 0 (- len 6)) "..."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
231 (substring (buffer-name buffer) -3))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
232 (concat (substring (buffer-name buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
233 0 (- len 3)) "..."))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
234 (buffer-name buffer))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
235
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
236 (defsubst build-buffers-tab-internal (buffers)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
237 (let ((selected t))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
238 (mapcar
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
239 #'(lambda (buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
240 (prog1
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
241 (vector
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
242 (funcall buffers-tab-format-buffer-line-function
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
243 buffer)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
244 (list buffers-tab-switch-to-buffer-function
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
245 (buffer-name buffer))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
246 :selected selected)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
247 (when selected (setq selected nil))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
248 buffers)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
249
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
250 ;;; #### SJT would like this function to have a sort function list. I
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
251 ;;; don't see how this could work given that sorting is not
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
252 ;;; cumulative --andyp.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
253 (defun buffers-tab-items (&optional in-deletion frame force-selection)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
254 "Return a list of tab instantiators based on the current buffers list.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
255 This function is used as the tab filter for the top-level buffers
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
256 \"Buffers\" tab. It dynamically creates a list of tab instantiators
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
257 to use as the contents of the tab. The contents and order of the list
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
258 is controlled by `buffers-tab-filter-functions' which by default
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
259 groups buffers according to major mode and removes invisible buffers.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
260 You can control how many buffers will be shown by setting
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
261 `buffers-tab-max-size'. You can control the text of the tab items by
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
262 redefining the function `format-buffers-menu-line'."
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
263 (save-match-data
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
264 ;; NB it is too late if we run the omit function as part of the
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
265 ;; filter functions because we need to know which buffer is the
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
266 ;; context buffer before they get run.
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
267 (let* ((buffers (delete-if
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
268 buffers-tab-omit-function (buffer-list frame)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
269 (first-buf (car buffers)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
270 ;; maybe force the selected window
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
271 (when (and force-selection
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
272 (not in-deletion)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
273 (not (eq first-buf (window-buffer (selected-window frame)))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
274 (setq buffers (cons (window-buffer (selected-window frame))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
275 (delq first-buf buffers))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
276 ;; if we're in deletion ignore the current buffer
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
277 (when in-deletion
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
278 (setq buffers (delq (current-buffer) buffers))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
279 (setq first-buf (car buffers)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
280 ;; filter buffers
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
281 (when buffers-tab-filter-functions
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
282 (setq buffers
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
283 (delete-if
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
284 #'null
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
285 (mapcar #'(lambda (buf)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
286 (let ((tmp-buf buf))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
287 (mapc #'(lambda (fun)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
288 (unless (funcall fun buf first-buf)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
289 (setq tmp-buf nil)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
290 buffers-tab-filter-functions)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
291 tmp-buf))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
292 buffers))))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
293 ;; maybe shorten list of buffers
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
294 (and (integerp buffers-tab-max-size)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
295 (> buffers-tab-max-size 1)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
296 (> (length buffers) buffers-tab-max-size)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
297 (setcdr (nthcdr (1- buffers-tab-max-size) buffers) nil))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
298 ;; sort buffers in group (default is most-recently-selected)
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
299 (when buffers-tab-sort-function
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
300 (setq buffers (funcall buffers-tab-sort-function buffers)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
301 ;; convert list of buffers to list of structures used by tab widget
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
302 (setq buffers (build-buffers-tab-internal buffers))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
303 buffers)))
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 863
diff changeset
304
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 (defun add-tab-to-gutter ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 "Put a tab control in the gutter area to hold the most recent buffers."
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 430
diff changeset
307 (setq gutter-buffers-tab-orientation (default-gutter-position))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
308 (let* ((gutter-string (copy-sequence "\n"))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
309 (gutter-buffers-tab-extent (make-extent 0 1 gutter-string)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
310 (set-extent-begin-glyph gutter-buffers-tab-extent
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
311 (setq gutter-buffers-tab
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
312 (make-glyph)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
313 ;; Nuke all existing tabs
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
314 (remove-gutter-element top-gutter 'buffers-tab)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
315 (remove-gutter-element bottom-gutter 'buffers-tab)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
316 (remove-gutter-element left-gutter 'buffers-tab)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
317 (remove-gutter-element right-gutter 'buffers-tab)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
318 ;; Put tabs into all devices that will be able to display them
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
319 (mapcar
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
320 #'(lambda (x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
321 (when (valid-image-instantiator-format-p 'tab-control x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
322 (cond ((eq gutter-buffers-tab-orientation 'top)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
323 ;; This looks better than a 3d border
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
324 (set-specifier top-gutter-border-width 0 'global x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
325 (set-gutter-element top-gutter 'buffers-tab
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
326 gutter-string 'global x))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
327 ((eq gutter-buffers-tab-orientation 'bottom)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
328 (set-specifier bottom-gutter-border-width 0 'global x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
329 (set-gutter-element bottom-gutter 'buffers-tab
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
330 gutter-string 'global x))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
331 ((eq gutter-buffers-tab-orientation 'left)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
332 (set-specifier left-gutter-border-width 0 'global x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
333 (set-gutter-element left-gutter 'buffers-tab
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
334 gutter-string 'global x))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
335 ((eq gutter-buffers-tab-orientation 'right)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
336 (set-specifier right-gutter-border-width 0 'global x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
337 (set-gutter-element right-gutter 'buffers-tab
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
338 gutter-string 'global x))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
339 )))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
340 (console-type-list))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
341
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
342 (defun update-tab-in-gutter (frame &optional force-selection)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 "Update the tab control in the gutter area."
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
344 ;; dedicated frames don't get tabs
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
345 (unless (or (window-dedicated-p (frame-selected-window frame))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
346 (frame-property frame 'popup))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
347 (when (specifier-instance default-gutter-visible-p frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
348 (unless (and gutter-buffers-tab
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 430
diff changeset
349 (eq (default-gutter-position)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 430
diff changeset
350 gutter-buffers-tab-orientation))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 (add-tab-to-gutter))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
352 (when (valid-image-instantiator-format-p 'tab-control frame)
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
353 (let ((items (buffers-tab-items nil frame force-selection)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
354 (when items
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
355 (set-glyph-image
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
356 gutter-buffers-tab
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
357 (vector 'tab-control :descriptor "Buffers" :face buffers-tab-face
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
358 :orientation gutter-buffers-tab-orientation
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
359 (if (or (eq gutter-buffers-tab-orientation 'top)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
360 (eq gutter-buffers-tab-orientation 'bottom))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
361 :pixel-width :pixel-height)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
362 (if (or (eq gutter-buffers-tab-orientation 'top)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
363 (eq gutter-buffers-tab-orientation 'bottom))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
364 '(gutter-pixel-width) '(gutter-pixel-height))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
365 :items items)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
366 frame)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
367 ;; set-glyph-image will not make the gutter dirty
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
368 (set-gutter-dirty-p gutter-buffers-tab-orientation)))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
370 ;; A myriad of different update hooks all doing slightly different things
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
371 (add-one-shot-hook
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
372 'after-init-hook
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
373 #'(lambda ()
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
374 ;; don't add the hooks if the user really doesn't want them
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
375 (when gutter-buffers-tab-enabled
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
376 (add-hook 'create-frame-hook
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
377 #'(lambda (frame)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
378 (when gutter-buffers-tab (update-tab-in-gutter frame t))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
379 (add-hook 'buffer-list-changed-hook 'update-tab-in-gutter)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
380 (add-hook 'default-gutter-position-changed-hook
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
381 #'(lambda ()
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
382 (when gutter-buffers-tab
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
383 (mapc #'update-tab-in-gutter (frame-list)))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
384 (add-hook 'gutter-element-visibility-changed-hook
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
385 #'(lambda (prop visible-p)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
386 (when (and (eq prop 'buffers-tab) visible-p)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
387 (mapc #'update-tab-in-gutter (frame-list)))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
388 (update-tab-in-gutter (selected-frame) t))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
389
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 ;; progress display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 ;; ripped off from message display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 ;;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
394 (defcustom progress-feedback-use-echo-area nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
395 "*Whether progress gauge display should display in the echo area.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
396 If NIL then progress gauges will be displayed with whatever native widgets
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
397 are available on the current console. If non-NIL then progress display will be
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
398 textual and displayed in the echo area."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
399 :type 'boolean
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
400 :group 'gutter)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
401
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
402 (defvar progress-glyph-height 24
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
403 "Height of the progress gauge glyph.")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
404
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
405 (defvar progress-feedback-popup-period 0.5
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
406 "The time that the progress gauge should remain up after completion")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
407
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
408 (defcustom progress-feedback-style 'large
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
409 "*Control the appearance of the progress gauge.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
410 If 'large, the default, then the progress-feedback text is displayed
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
411 above the gauge itself. If 'small then the gauge and text are arranged
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
412 side-by-side."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
413 :group 'gutter
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
414 :type '(choice (const :tag "large" large)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
415 (const :tag "small" small)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
416
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
417 ;; private variables
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
418 (defvar progress-text-instantiator [string :data ""])
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
419 (defvar progress-layout-glyph (make-glyph))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
420 (defvar progress-layout-instantiator nil)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
421
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
422 (defvar progress-gauge-instantiator
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
423 [progress-gauge
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
424 :value 0
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
425 :pixel-height (eval progress-glyph-height)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
426 :pixel-width 250
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
427 :descriptor "Progress"])
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
428
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
429 (defun set-progress-feedback-instantiator (&optional locale)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
430 (cond
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
431 ((eq progress-feedback-style 'small)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
432 (setq progress-glyph-height 16)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
433 (setq progress-layout-instantiator
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
434 `[layout
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
435 :orientation horizontal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
436 :margin-width 4
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
437 :items (,progress-gauge-instantiator
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
438 [button
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
439 :pixel-height (eval progress-glyph-height)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
440 ;; 'quit is special and acts "asynchronously".
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
441 :descriptor "Stop" :callback 'quit]
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
442 ,progress-text-instantiator)])
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
443 (set-glyph-image progress-layout-glyph progress-layout-instantiator
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
444 locale))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
445 (t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
446 (setq progress-glyph-height 24)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
447 (setq progress-layout-instantiator
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
448 `[layout
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 771
diff changeset
449 :orientation vertical :margin-width 4
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 771
diff changeset
450 :horizontally-justify left :vertically-justify center
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
451 :items (,progress-text-instantiator
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
452 [layout
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
453 :orientation horizontal
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
454 :items (,progress-gauge-instantiator
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
455 [button
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
456 :pixel-height (eval progress-glyph-height)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
457 :descriptor " Stop "
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
458 ;; 'quit is special and acts "asynchronously".
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
459 :callback 'quit])])])
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
460 (set-glyph-image progress-layout-glyph progress-layout-instantiator
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
461 locale))))
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
462
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
463 (defvar progress-abort-glyph (make-glyph))
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
464
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
465 (defun set-progress-abort-instantiator (&optional locale)
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
466 (set-glyph-image progress-abort-glyph
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 771
diff changeset
467 `[layout :orientation vertical
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 771
diff changeset
468 :horizontally-justify left :vertically-justify center
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
469 :items (,progress-text-instantiator
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
470 [layout
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
471 :margin-width 4
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
472 :pixel-height progress-glyph-height
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
473 :orientation horizontal])]
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
474 locale))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
475
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 (defvar progress-stack nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 "An alist of label/string pairs representing active progress gauges.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 The first element in the list is currently displayed in the gutter area.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
479 Do not modify this directly--use the `progress-feedback' or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
480 `display-progress-feedback'/`clear-progress-feedback' functions.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
482 (defun progress-feedback-displayed-p (&optional return-string frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 "Return a non-nil value if a progress gauge is presently displayed in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 gutter area. If optional argument RETURN-STRING is non-nil,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 return a string containing the message, otherwise just return t."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 (let ((buffer (get-buffer-create " *Gutter Area*")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 (and (< (point-min buffer) (point-max buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 (if return-string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 (buffer-substring nil nil buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 ;;; Returns the string which remains in the echo area, or nil if none.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 ;;; If label is nil, the whole message stack is cleared.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
494 (defun clear-progress-feedback (&optional label frame no-restore)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
495 "Remove any progress gauge with LABEL from the progress gauge-stack,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 erasing it from the gutter area if it's currently displayed there.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 If a message remains at the head of the progress-stack and NO-RESTORE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 is nil, it will be displayed. The string which remains in the gutter
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 area will be returned, or nil if the progress-stack is now empty.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 If LABEL is nil, the entire progress-stack is cleared.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 Unless you need the return value or you need to specify a label,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 you should just use (progress nil)."
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
504 (if (or (not (valid-image-instantiator-format-p 'progress-gauge frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
505 progress-feedback-use-echo-area)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
506 (clear-message label frame nil no-restore)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
507 (or frame (setq frame (selected-frame)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
508 (remove-progress-feedback label frame)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 458
diff changeset
509 (let ((inhibit-read-only t))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
510 (erase-buffer (get-buffer-create " *Gutter Area*")))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
511 (if no-restore
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
512 nil ; just preparing to put another msg up
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
513 (if progress-stack
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
514 (let ((oldmsg (cdr (car progress-stack))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
515 (raw-append-progress-feedback oldmsg nil frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
516 oldmsg)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
517 ;; nothing to display so get rid of the gauge
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
518 (set-specifier bottom-gutter-border-width 0 frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
519 (set-gutter-element-visible-p bottom-gutter-visible-p
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
520 'progress nil frame)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
522 (defun progress-feedback-clear-when-idle (&optional label)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
523 (add-one-shot-hook 'pre-idle-hook
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
524 `(lambda ()
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
525 (clear-progress-feedback ',label))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
526
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
527 (defun remove-progress-feedback (&optional label frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 ;; If label is nil, we want to remove all matching progress gauges.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 (while (and progress-stack
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 (or (null label) ; null label means clear whole stack
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 (eq label (car (car progress-stack)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 (setq progress-stack (cdr progress-stack)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 (let ((s progress-stack))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 (while (cdr s)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 (let ((msg (car (cdr s))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 (if (eq label (car msg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 (setcdr s (cdr (cdr s))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 (setq s (cdr s)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
541 (defun progress-feedback-dispatch-non-command-events ()
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
542 ;; don't allow errors to hose things
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
543 (condition-case t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
544 ;; (sit-for 0) is too agressive and cause more display than we
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
545 ;; want.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
546 (dispatch-non-command-events)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
547 nil))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
548
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
549 (defun append-progress-feedback (label message &optional value frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 (or frame (setq frame (selected-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 ;; Add a new entry to the message-stack, or modify an existing one
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 (let* ((top (car progress-stack))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 (tmsg (cdr top)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 (if (eq label (car top))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 (setcdr top message)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
557 (if (equal tmsg message)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
558 (progn
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
559 (set-instantiator-property progress-gauge-instantiator :value value)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
560 (set-progress-feedback-instantiator (frame-selected-window frame)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
561 (raw-append-progress-feedback message value frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
562 (redisplay-gutter-area))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 (push (cons label message) progress-stack)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
564 (raw-append-progress-feedback message value frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
565 (progress-feedback-dispatch-non-command-events)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
566 ;; either get command events or sit waiting for them
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
567 (when (eq value 100)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
568 ; (sit-for progress-feedback-popup-period nil)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
569 (clear-progress-feedback label))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
571 (defun abort-progress-feedback (label message &optional frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
572 (if (or (not (valid-image-instantiator-format-p 'progress-gauge frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
573 progress-feedback-use-echo-area)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
574 (display-message label (concat message "aborted.") frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
575 (or frame (setq frame (selected-frame)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
576 ;; Add a new entry to the message-stack, or modify an existing one
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
577 (let* ((top (car progress-stack))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 458
diff changeset
578 (inhibit-read-only t))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
579 (if (eq label (car top))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
580 (setcdr top message)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
581 (push (cons label message) progress-stack))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
582 (unless (equal message "")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
583 (insert-string message (get-buffer-create " *Gutter Area*"))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
584 (let* ((gutter-string (copy-sequence "\n"))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
585 (ext (make-extent 0 1 gutter-string)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
586 ;; do some funky display here.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
587 (set-extent-begin-glyph ext progress-abort-glyph)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 ;; fixup the gutter specifiers
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
589 (set-gutter-element bottom-gutter 'progress gutter-string frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 (set-specifier bottom-gutter-border-width 2 frame)
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
591 (set-instantiator-property progress-text-instantiator :data message)
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
592 (set-progress-abort-instantiator (frame-selected-window frame))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 (set-specifier bottom-gutter-height 'autodetect frame)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
594 (set-gutter-element-visible-p bottom-gutter-visible-p
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
595 'progress t frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 ;; we have to do this so redisplay is up-to-date and so
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 ;; redisplay-gutter-area performs optimally.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 (redisplay-gutter-area)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
599 (sit-for progress-feedback-popup-period nil)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
600 (clear-progress-feedback label frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
601 (set-extent-begin-glyph ext progress-layout-glyph)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
602 (set-gutter-element bottom-gutter 'progress gutter-string frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 )))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
605 (defun raw-append-progress-feedback (message &optional value frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 (unless (equal message "")
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
607 (let* ((inhibit-read-only t)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
608 (val (or value 0))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
609 (gutter-string (copy-sequence "\n"))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
610 (ext (make-extent 0 1 gutter-string)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 (insert-string message (get-buffer-create " *Gutter Area*"))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
612 ;; do some funky display here.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
613 (set-extent-begin-glyph ext progress-layout-glyph)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
614 ;; fixup the gutter specifiers
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
615 (set-gutter-element bottom-gutter 'progress gutter-string frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
616 (set-specifier bottom-gutter-border-width 2 frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
617 (set-instantiator-property progress-gauge-instantiator :value val)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
618 (set-progress-feedback-instantiator (frame-selected-window frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
619
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
620 (set-instantiator-property progress-text-instantiator :data message)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
621 (set-progress-feedback-instantiator (frame-selected-window frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
622 (if (and (eq (specifier-instance bottom-gutter-height frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
623 'autodetect)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
624 (gutter-element-visible-p bottom-gutter-visible-p
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
625 'progress frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
626 ;; if the gauge is already visible then just draw the gutter
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
627 ;; checking for user events
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 (progn
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
629 (redisplay-gutter-area)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
630 (progress-feedback-dispatch-non-command-events))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
631 ;; otherwise make the gutter visible and redraw the frame
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
632 (set-specifier bottom-gutter-height 'autodetect frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
633 (set-gutter-element-visible-p bottom-gutter-visible-p
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
634 'progress t frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
635 ;; we have to do this so redisplay is up-to-date and so
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
636 ;; redisplay-gutter-area performs optimally. This may also
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
637 ;; make sure the frame geometry looks ok.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
638 (progress-feedback-dispatch-non-command-events)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
639 (redisplay-frame frame)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
640 ))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
642 (defun display-progress-feedback (label message &optional value frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 "Display a progress gauge and message in the bottom gutter area.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 First argument LABEL is an identifier for this message. MESSAGE is
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
645 the string to display. Use `clear-progress-feedback' to remove a labelled
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 message."
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
647 (cond ((eq value 'abort)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
648 (abort-progress-feedback label message frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
649 ((or (not (valid-image-instantiator-format-p 'progress-gauge frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
650 progress-feedback-use-echo-area)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
651 (display-message label
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
652 (concat message (if (eq value 100) "done."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
653 (make-string (/ value 5) ?.)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
654 frame))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
655 (t
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
656 (append-progress-feedback label message value frame))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
658 (defun current-progress-feedback (&optional frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 "Return the current progress gauge in the gutter area, or nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 The FRAME argument is currently unused."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 (cdr (car progress-stack)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 ;;; may eventually be frame-dependent
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
664 (defun current-progress-feedback-label (&optional frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 (car (car progress-stack)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
667 (defun progress-feedback (fmt &optional value &rest args)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 "Print a progress gauge and message in the bottom gutter area of the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 The arguments are the same as to `format'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 If the only argument is nil, clear any existing progress gauge."
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
672 (save-excursion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
673 (if (and (null fmt) (null args))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
674 (prog1 nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
675 (clear-progress-feedback nil))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
676 (let ((str (apply 'format fmt args)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
677 (display-progress-feedback 'progress str value)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
678 str))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
680 (defun progress-feedback-with-label (label fmt &optional value &rest args)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 "Print a progress gauge and message in the bottom gutter area of the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 First argument LABEL is an identifier for this progress gauge. The rest of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 arguments are the same as to `format'."
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
684 ;; #### sometimes the buffer gets changed temporarily. I don't know
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
685 ;; why this is, so protect against it.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
686 (save-excursion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
687 (if (and (null fmt) (null args))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
688 (prog1 nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
689 (clear-progress-feedback label nil))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
690 (let ((str (apply 'format fmt args)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
691 (display-progress-feedback label str value)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
692 str))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693
931
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
694 (defun buffers-tab-omit-some-buffers (buf)
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
695 "For use as a value of `buffers-tab-omit-function'.
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
696 Omit buffers based on the value of `buffers-tab-omit-list', which
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
697 see."
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
698 (let ((regexp (mapconcat 'concat buffers-tab-omit-list "\\|")))
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
699 (not (null (string-match regexp (buffer-name buf))))))
3508e2f71814 [xemacs-hg @ 2002-07-24 04:46:29 by andyp]
andyp
parents: 903
diff changeset
700
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 (provide 'gutter-items)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 ;;; gutter-items.el ends here.