Mercurial > emacs
annotate src/doc.c @ 112364:42e22c4f06b7
Move all DEFVAR'd globals into a structure -- threading infrastructure
* globals.h: New file.
* xterm.h (Vx_pixel_size_width_font_regexp): Remove declaration.
* window.h (Vinitial_window_system, Vminibuf_scroll_window)
(Vwindow_system_version): Remove declaration.
* w32term.h (Vw32_enable_palette)
(Vx_pixel_size_width_font_regexp): Remove declaration.
* w32menu.c (Voverriding_local_map)
(Voverriding_local_map_menu_flag): Remove declaration.
* w32inevt.c (Vw32_alt_is_meta, Vw32_apps_modifier)
(Vw32_capslock_is_shiftlock, Vw32_enable_caps_lock)
(Vw32_enable_num_lock, Vw32_lwindow_modifier)
(Vw32_pass_lwindow_to_system, Vw32_pass_rwindow_to_system)
(Vw32_phantom_key_code, Vw32_recognize_altgr)
(Vw32_rwindow_modifier, Vw32_scroll_lock_modifier)
(w32_use_full_screen_buffer): Remove declaration.
* w32.c (Vsystem_configuration, Vw32_downcase_file_names)
(Vw32_generate_fake_inodes, Vw32_get_true_file_attributes)
(w32_num_mouse_buttons, w32_pipe_read_delay): Remove declaration.
* termopts.h (Vtruncate_partial_width_windows, inverse_video)
(no_redraw_on_reenter, visible_bell): Remove declaration.
* sysdep.c (Vsystem_name): Remove declaration.
* syntax.h (parse_sexp_lookup_properties): Remove declaration.
* menu.h (Vmenu_updating_frame): Remove declaration.
* macros.h (Vexecuting_kbd_macro, executing_kbd_macro_index):
Remove declaration.
* lisp.h (Vafter_init_time, Vafter_load_alist)
(Vauto_save_list_file_name, Vbefore_init_time, Vcommand_history)
(Vcompletion_regexp_list, Vcurrent_load_list)
(Vcurrent_prefix_arg, Vdata_directory, Vdebug_on_error)
(Vdoc_directory, Vdoc_file_name, Vdynamic_library_alist)
(Vexec_directory, Vexec_path, Vexec_suffixes)
(Vface_font_rescale_alist, Vface_ignored_fonts, Vfeatures)
(Vhelp_form, Vhistory_length, Vinhibit_field_text_motion)
(Vinhibit_quit, Vinhibit_read_only, Vinhibit_redisplay)
(Vinstallation_directory, Vinvocation_directory)
(Vinvocation_name, Vload_file_rep_suffixes, Vload_history)
(Vload_suffixes, Vmark_even_if_inactive, Vmemory_full)
(Vmessage_log_max, Vobarray, Vprint_length, Vprint_level)
(Vpurify_flag, Vquit_flag, Vsaved_region_selection)
(Vscalable_fonts_allowed, Vselect_active_regions)
(Vshell_file_name, Vstandard_input, Vstandard_output)
(Vsystem_name, Vtemporary_file_directory, Vthrow_on_input)
(Vtop_level, Vtty_erase_char, Vundo_outer_limit)
(Vuser_login_name, Vwindow_scroll_functions)
(Vwindow_system_version, Vx_no_window_manager)
(Vx_resource_class, Vx_resource_name, baud_rate)
(completion_ignore_case, debug_on_next_call, gc_cons_threshold)
(history_delete_duplicates, inhibit_x_resources)
(last_nonmenu_event, load_in_progress, max_specpdl_size)
(minibuffer_auto_raise, print_escape_newlines, scroll_margin)
(use_dialog_box, use_file_dialog): Remove declaration. Include
globals.h.
* keymap.h (Voverriding_local_map)
(Voverriding_local_map_menu_flag, meta_prefix_char): Remove
declaration.
* keyboard.h (Vdouble_click_time, Vfunction_key_map)
(Vinput_method_function, Vkey_translation_map)
(Vlucid_menu_bar_dirty_flag, Vthis_original_command)
(do_mouse_tracking, extra_keyboard_modifiers)
(num_nonmacro_input_events): Remove declaration.
* intervals.h (Vchar_property_alias_alist)
(Vdefault_text_properties, Vinhibit_point_motion_hooks)
(Vtext_property_default_nonsticky): Remove declaration.
* gtkutil.h (x_gtk_file_dialog_help_text)
(x_gtk_show_hidden_files, x_gtk_use_old_file_dialog)
(x_gtk_whole_detached_tool_bar): Remove declaration.
* frame.h (Vdefault_frame_alist, Vframe_alpha_lower_limit)
(Vmenu_bar_mode, Vmouse_highlight, Vterminal_frame)
(Vtool_bar_mode, Vx_resource_class, Vx_resource_name)
(focus_follows_mouse): Remove declaration.
* fontset.h (Valternate_fontname_alist, Vfontset_alias_alist)
(Vignore_relative_composition, Votf_script_alist)
(Vuse_default_ascent, Vvertical_centering_font_regexp): Remove
declaration.
* font.h (Vfont_log): Remove declaration.
* dosfns.h (Vdos_display_scancodes, Vdos_version)
(Vdos_windows_version, dos_codepage, dos_country_code)
(dos_decimal_point, dos_hyper_key, dos_keyboard_layout)
(dos_keypad_mode, dos_super_key, dos_timezone_offset): Remove
declaration.
* disptab.h (Vglyph_table, Vstandard_display_table): Remove
declaration.
* dispextern.h (Vface_remapping_alist, Vglyphless_char_display)
(Vmouse_autoselect_window, Voverflow_newline_into_fringe)
(Vshow_trailing_whitespace, Vtool_bar_button_margin)
(Vtool_bar_style, cursor_in_echo_area, display_hourglass_p)
(inverse_video, mode_line_in_non_selected_windows)
(tool_bar_button_relief, tool_bar_max_label_size)
(underline_minimum_offset)
(unibyte_display_via_language_environment, x_stretch_cursor_p):
Remove declaration.
* composite.h (Vauto_composition_function)
(Vcomposition_function_table): Remove declaration.
* commands.h (Vexecuting_kbd_macro)
(Vminibuffer_local_completion_map)
(Vminibuffer_local_filename_completion_map)
(Vminibuffer_local_filename_must_match_map)
(Vminibuffer_local_map, Vminibuffer_local_must_match_map)
(Vminibuffer_local_ns_map, Vthis_command)
(Vunread_command_events, cursor_in_echo_area)
(last_command_event, last_nonmenu_event, unread_command_char):
Remove declaration.
* coding.h (Vcoding_system_for_read, Vcoding_system_for_write)
(Vdefault_file_name_coding_system)
(Vdefault_process_coding_system, Vfile_name_coding_system)
(Vlast_coding_system_used, Vlocale_coding_system)
(Vselect_safe_coding_system_function)
(Vtranslation_table_for_input, coding_system_require_warning)
(eol_mnemonic_dos, eol_mnemonic_mac, eol_mnemonic_undecided)
(eol_mnemonic_unix, inherit_process_coding_system): Remove
declaration.
* charset.h (Vcharset_list, Vcurrent_iso639_language): Remove
declaration.
* character.h (Vauto_fill_chars, Vchar_direction_table)
(Vchar_script_table, Vchar_width_table, Vprintable_chars)
(Vscript_representative_chars, Vtranslation_table_vector)
(Vunicode_category_table): Remove declaration.
* ccl.h (Vfont_ccl_encoder_alist): Remove declaration.
* buffer.h (Vafter_change_functions, Vbefore_change_functions)
(Vdeactivate_mark, Vfirst_change_hook, Vtransient_mark_mode)
(inhibit_modification_hooks): Remove declaration.
* xterm.c (syms_of_xterm): Update.
(Vx_alt_keysym, Vx_hyper_keysym, Vx_keysym_table)
(Vx_meta_keysym, Vx_super_keysym, Vx_toolkit_scroll_bars)
(x_mouse_click_focus_ignore_position)
(x_underline_at_descent_line)
(x_use_underline_position_properties): Remove.
* xsmfns.c (syms_of_xsmfns): Update.
(Vx_session_id, Vx_session_previous_id): Remove.
* xsettings.c (syms_of_xsettings): Update.
(Vxft_settings, use_system_font): Remove.
* xselect.c (syms_of_xselect): Update.
(Vselection_converter_alist, Vx_lost_selection_functions)
(Vx_sent_selection_functions, x_selection_timeout): Remove.
* xfns.c (syms_of_xfns): Update.
(Vgtk_version_string, Vmotif_version_string)
(Vx_cursor_fore_pixel, Vx_hourglass_pointer_shape)
(Vx_max_tooltip_size, Vx_mode_pointer_shape)
(Vx_no_window_manager, Vx_nontext_pointer_shape)
(Vx_pixel_size_width_font_regexp, Vx_pointer_shape)
(Vx_sensitive_text_pointer_shape)
(Vx_window_horizontal_drag_shape, x_gtk_file_dialog_help_text)
(x_gtk_show_hidden_files, x_gtk_use_old_file_dialog)
(x_gtk_use_system_tooltips, x_gtk_whole_detached_tool_bar):
Remove.
* xfaces.c (syms_of_xfaces): Update.
(Vface_default_stipple, Vface_font_rescale_alist)
(Vface_ignored_fonts, Vface_new_frame_defaults)
(Vface_remapping_alist, Vfont_list_limit)
(Vscalable_fonts_allowed, Vtty_defined_color_alist): Remove.
* xdisp.c (syms_of_xdisp): Update.
(Vauto_resize_tool_bars, Vblink_cursor_alist)
(Vdisplay_pixels_per_inch, Vfontification_functions)
(Vframe_title_format, Vglobal_mode_string)
(Vglyphless_char_display, Vhourglass_delay, Vhscroll_step)
(Vicon_title_format, Vinhibit_redisplay)
(Vline_number_display_limit, Vline_prefix)
(Vmax_mini_window_height, Vmenu_bar_update_hook)
(Vmenu_updating_frame, Vmessage_log_max)
(Vmouse_autoselect_window, Vnobreak_char_display)
(Voverlay_arrow_position, Voverlay_arrow_string)
(Voverlay_arrow_variable_list, Vredisplay_end_trigger_functions)
(Vresize_mini_windows, Vshow_trailing_whitespace)
(Vtool_bar_border, Vtool_bar_button_margin, Vtool_bar_style)
(Vtruncate_partial_width_windows, Vvoid_text_area_pointer)
(Vwindow_scroll_functions, Vwindow_size_change_functions)
(Vwindow_text_change_functions, Vwrap_prefix)
(auto_raise_tool_bar_buttons_p, automatic_hscrolling_p)
(debug_end_pos, display_hourglass_p, emacs_scroll_step)
(highlight_nonselected_windows, hscroll_margin)
(inhibit_eval_during_redisplay, inhibit_free_realized_faces)
(inhibit_menubar_update, inhibit_try_cursor_movement)
(inhibit_try_window_id, inhibit_try_window_reusing)
(line_number_display_limit_width)
(make_cursor_line_fully_visible_p, message_truncate_lines)
(mode_line_inverse_video, multiple_frames, overline_margin)
(scroll_conservatively, scroll_margin, tool_bar_button_relief)
(tool_bar_max_label_size, underline_minimum_offset)
(unibyte_display_via_language_environment, x_stretch_cursor_p):
Remove.
* window.c (syms_of_window): Update.
(Vminibuf_scroll_window, Vother_window_scroll_buffer)
(Vrecenter_redisplay, Vscroll_preserve_screen_position)
(Vtemp_buffer_show_function, Vwindow_configuration_change_hook)
(Vwindow_point_insertion_type, auto_window_vscroll_p)
(mode_line_in_non_selected_windows, next_screen_context_lines)
(window_min_height, window_min_width): Remove.
(scroll_margin): Remove declaration.
* w32term.c (syms_of_w32term): Update.
(Vw32_capslock_is_shiftlock, Vw32_grab_focus_on_raise)
(Vw32_recognize_altgr, Vw32_swap_mouse_buttons)
(Vx_toolkit_scroll_bars, w32_num_mouse_buttons)
(w32_use_visible_system_caret, x_underline_at_descent_line)
(x_use_underline_position_properties): Remove.
(Vcommand_line_args, Vsystem_name, extra_keyboard_modifiers):
Remove declaration.
* w32select.c (syms_of_w32select): Update.
(Vnext_selection_coding_system, Vselection_coding_system): Remove.
* w32proc.c (syms_of_ntproc): Update.
(Vw32_downcase_file_names, Vw32_generate_fake_inodes)
(Vw32_get_true_file_attributes, Vw32_quote_process_args)
(Vw32_start_process_inherit_error_mode)
(Vw32_start_process_share_console)
(Vw32_start_process_show_window, w32_pipe_read_delay): Remove.
(Vsystem_name): Remove declaration.
* w32font.c (syms_of_w32font): Update.
(Vw32_charset_info_alist): Remove.
* w32fns.c (globals_of_w32fns, syms_of_w32fns): Update.
(Vw32_alt_is_meta, Vw32_apps_modifier, Vw32_bdf_filename_alist)
(Vw32_color_map, Vw32_enable_caps_lock, Vw32_enable_num_lock)
(Vw32_enable_palette, Vw32_lwindow_modifier)
(Vw32_pass_alt_to_system, Vw32_pass_lwindow_to_system)
(Vw32_pass_rwindow_to_system, Vw32_phantom_key_code)
(Vw32_rwindow_modifier, Vw32_scroll_lock_modifier)
(Vx_cursor_fore_pixel, Vx_hourglass_pointer_shape)
(Vx_max_tooltip_size, Vx_mode_pointer_shape)
(Vx_no_window_manager, Vx_nontext_pointer_shape)
(Vx_pixel_size_width_font_regexp, Vx_pointer_shape)
(Vx_sensitive_text_pointer_shape)
(Vx_window_horizontal_drag_shape, w32_ansi_code_page)
(w32_enable_synthesized_fonts, w32_mouse_button_tolerance)
(w32_mouse_move_interval)
(w32_pass_extra_mouse_buttons_to_system)
(w32_pass_multimedia_buttons_to_system, w32_quit_key)
(w32_strict_fontnames, w32_strict_painting): Remove.
(Vhourglass_delay, Vmenu_bar_mode, Vtool_bar_mode)
(Vw32_recognize_altgr, Vwindow_system_version)
(w32_num_mouse_buttons, w32_use_visible_system_caret): Remove
declaration.
* w32console.c (syms_of_ntterm): Update.
(w32_use_full_screen_buffer): Remove.
(Vtty_defined_color_alist): Remove declaration.
* w16select.c (syms_of_win16select): Update.
(Vnext_selection_coding_system, Vselection_coding_system): Remove.
* undo.c (syms_of_undo): Update.
(Vundo_outer_limit, Vundo_outer_limit_function)
(undo_inhibit_record_point, undo_limit, undo_strong_limit):
Remove.
* textprop.c (syms_of_textprop): Update.
(Vchar_property_alias_alist, Vdefault_text_properties)
(Vinhibit_point_motion_hooks, Vtext_property_default_nonsticky):
Remove.
* terminal.c (syms_of_terminal): Update.
(Vdelete_terminal_functions, Vring_bell_function): Remove.
* term.c (syms_of_term): Update.
(Vresume_tty_functions, Vsuspend_tty_functions)
(no_redraw_on_reenter, system_uses_terminfo, visible_cursor):
Remove.
* syntax.c (syms_of_syntax): Update.
(Vfind_word_boundary_function_table, multibyte_syntax_as_symbol)
(open_paren_in_column_0_is_defun_start)
(parse_sexp_ignore_comments, parse_sexp_lookup_properties)
(words_include_escapes): Remove.
* search.c (syms_of_search): Update.
(Vinhibit_changing_match_data, Vsearch_spaces_regexp): Remove.
* process.c (syms_of_process): Update.
(Vprocess_adaptive_read_buffering, Vprocess_connection_type)
(delete_exited_processes): Remove.
* print.c (syms_of_print): Update.
(Vfloat_output_format, Vprint_charset_text_property)
(Vprint_circle, Vprint_continuous_numbering, Vprint_gensym)
(Vprint_length, Vprint_level, Vprint_number_table)
(Vstandard_output, print_escape_multibyte)
(print_escape_newlines, print_escape_nonascii, print_quoted):
Remove.
* msdos.c (syms_of_msdos): Update.
(Vdos_unsupported_char_glyph): Remove.
(unibyte_display_via_language_environment): Remove declaration.
* minibuf.c (syms_of_minibuf): Update.
(Vcompletion_regexp_list, Vhistory_add_new_input)
(Vhistory_length, Vminibuffer_completing_file_name)
(Vminibuffer_completion_confirm)
(Vminibuffer_completion_predicate, Vminibuffer_completion_table)
(Vminibuffer_exit_hook, Vminibuffer_help_form)
(Vminibuffer_history_position, Vminibuffer_history_variable)
(Vminibuffer_prompt_properties, Vminibuffer_setup_hook)
(Vread_buffer_function, Vread_expression_map)
(completion_ignore_case, enable_recursive_minibuffers)
(history_delete_duplicates, minibuffer_allow_text_properties)
(minibuffer_auto_raise, read_buffer_completion_ignore_case):
Remove.
* marker.c (syms_of_marker): Update.
(byte_debug_flag): Remove.
* macros.c (syms_of_macros): Update.
(Vexecuting_kbd_macro, executing_kbd_macro_index): Remove.
* lread.c (syms_of_lread): Update.
(Vafter_load_alist, Vbyte_boolean_vars)
(Vbytecomp_version_regexp, Vcurrent_load_list)
(Veval_buffer_list, Vload_file_name, Vload_file_rep_suffixes)
(Vload_history, Vload_path, Vload_read_function)
(Vload_source_file_function, Vload_suffixes, Vobarray)
(Vold_style_backquotes, Vpreloaded_file_list, Vread_circle)
(Vread_symbol_positions_list, Vread_with_symbol_positions)
(Vsource_directory, Vstandard_input, Vuser_init_file, Vvalues)
(force_load_messages, load_convert_to_unibyte)
(load_dangerous_libraries, load_force_doc_strings)
(load_in_progress): Remove.
* keymap.c (syms_of_keymap): Update.
(Vdefine_key_rebound_commands, Vemulation_mode_map_alists)
(Vminibuffer_local_completion_map)
(Vminibuffer_local_filename_completion_map)
(Vminibuffer_local_filename_must_match_map)
(Vminibuffer_local_map, Vminibuffer_local_must_match_map)
(Vminibuffer_local_ns_map, Vminor_mode_map_alist)
(Vminor_mode_overriding_map_alist, Vwhere_is_preferred_modifier):
Remove.
* keyboard.c (syms_of_keyboard): Update.
(Vauto_save_timeout, Vcommand_error_function)
(Vcommand_hook_internal, Vdeactivate_mark)
(Vdeferred_action_function, Vdeferred_action_list)
(Vdisable_point_adjustment, Vdouble_click_time)
(Vecho_keystrokes, Venable_disabled_menus_and_buttons)
(Vfunction_key_map, Vglobal_disable_point_adjustment)
(Vhelp_char, Vhelp_event_list, Vhelp_form)
(Vinput_method_function, Vinput_method_previous_message)
(Vkey_translation_map, Vlast_event_frame)
(Vlucid_menu_bar_dirty_flag, Vmenu_bar_final_items)
(Vminibuffer_message_timeout, Voverriding_local_map)
(Voverriding_local_map_menu_flag, Vpost_command_hook)
(Vpre_command_hook, Vprefix_help_command)
(Vsaved_region_selection, Vselect_active_regions)
(Vshow_help_function, Vspecial_event_map, Vsuggest_key_bindings)
(Vthis_command, Vthis_command_keys_shift_translated)
(Vthis_original_command, Vthrow_on_input, Vtimer_idle_list)
(Vtimer_list, Vtool_bar_separator_image_expression, Vtop_level)
(Vtty_erase_char, Vunread_command_events)
(Vunread_input_method_events, Vunread_post_input_method_events)
(auto_save_interval, cannot_suspend, do_mouse_tracking)
(double_click_fuzz, extra_keyboard_modifiers)
(inhibit_local_menu_bar_menus, last_command_event)
(last_input_event, last_nonmenu_event, menu_prompt_more_char)
(menu_prompting, meta_prefix_char, num_input_keys)
(num_nonmacro_input_events, polling_period, unread_command_char):
Remove.
* insdel.c (syms_of_insdel): Update.
(Vcombine_after_change_calls, check_markers_debug_flag): Remove.
* indent.c (syms_of_indent): Update.
(indent_tabs_mode): Remove.
* image.c (syms_of_image): Update.
(Vimage_cache_eviction_delay, Vimage_types)
(Vimagemagick_render_type, Vmax_image_size, Vx_bitmap_file_path)
(cross_disabled_images): Remove.
* fringe.c (syms_of_fringe): Update.
(Vfringe_bitmaps, Voverflow_newline_into_fringe): Remove.
* frame.c (syms_of_frame): Update.
(Vdefault_frame_alist, Vdefault_frame_scroll_bars)
(Vdelete_frame_functions, Vframe_alpha_lower_limit)
(Vmake_pointer_invisible, Vmenu_bar_mode, Vmouse_highlight)
(Vmouse_position_function, Vterminal_frame, Vtool_bar_mode)
(Vx_resource_class, Vx_resource_name, focus_follows_mouse):
Remove.
* fontset.c (syms_of_fontset): Update.
(Valternate_fontname_alist, Vfont_encoding_charset_alist)
(Vfontset_alias_alist, Vignore_relative_composition)
(Votf_script_alist, Vuse_default_ascent)
(Vvertical_centering_font_regexp): Remove.
* font.c (syms_of_font): Update.
(Vfont_encoding_alist, Vfont_log, Vfont_slant_table)
(Vfont_weight_table, Vfont_width_table): Remove.
* fns.c (syms_of_fns): Update.
(Vfeatures, use_dialog_box, use_file_dialog): Remove.
* filelock.c (syms_of_filelock): Update.
(Vtemporary_file_directory): Remove.
* fileio.c (syms_of_fileio): Update.
(Vafter_insert_file_functions, Vauto_save_include_big_deletions)
(Vauto_save_list_file_name, Vauto_save_visited_file_name)
(Vdefault_file_name_coding_system, Vfile_name_coding_system)
(Vfile_name_handler_alist, Vinhibit_file_name_handlers)
(Vinhibit_file_name_operation, Vset_auto_coding_function)
(Vwrite_region_annotate_functions)
(Vwrite_region_annotations_so_far)
(Vwrite_region_post_annotation_function)
(delete_by_moving_to_trash, write_region_inhibit_fsync): Remove.
(Vw32_get_true_file_attributes): Remove declaration.
* eval.c (syms_of_eval): Update.
(Vdebug_ignored_errors, Vdebug_on_error, Vdebug_on_signal)
(Vdebugger, Vinhibit_quit, Vmacro_declaration_function)
(Vquit_flag, Vsignal_hook_function, Vstack_trace_on_error)
(debug_on_next_call, debug_on_quit, debugger_may_continue)
(max_lisp_eval_depth, max_specpdl_size): Remove.
* emacs.c (syms_of_emacs): Update.
(Vafter_init_time, Vbefore_init_time, Vcommand_line_args)
(Vdynamic_library_alist, Vemacs_copyright, Vemacs_version)
(Vinstallation_directory, Vinvocation_directory)
(Vinvocation_name, Vkill_emacs_hook, Vpath_separator)
(Vprevious_system_messages_locale, Vprevious_system_time_locale)
(Vsystem_configuration, Vsystem_configuration_options)
(Vsystem_messages_locale, Vsystem_time_locale, Vsystem_type)
(inhibit_x_resources, noninteractive1): Remove.
* editfns.c (syms_of_editfns): Update.
(Vbuffer_access_fontified_property)
(Vbuffer_access_fontify_functions, Vinhibit_field_text_motion)
(Voperating_system_release, Vsystem_name, Vuser_full_name)
(Vuser_login_name, Vuser_real_login_name): Remove.
* dosfns.c (syms_of_dosfns): Update.
(Vdos_display_scancodes, Vdos_version, Vdos_windows_version)
(dos_codepage, dos_country_code, dos_decimal_point)
(dos_hyper_key, dos_keyboard_layout, dos_keypad_mode)
(dos_super_key, dos_timezone_offset): Remove.
* doc.c (syms_of_doc): Update.
(Vbuild_files, Vdoc_file_name): Remove.
* dispnew.c (syms_of_display): Update.
(Vglyph_table, Vinitial_window_system)
(Vredisplay_preemption_period, Vstandard_display_table)
(Vwindow_system_version, baud_rate, cursor_in_echo_area)
(inverse_video, redisplay_dont_pause, visible_bell): Remove.
* dired.c (syms_of_dired): Update.
(Vcompletion_ignored_extensions): Remove.
(Vw32_get_true_file_attributes): Remove declaration.
* dbusbind.c (syms_of_dbusbind): Update.
(Vdbus_debug, Vdbus_registered_buses)
(Vdbus_registered_objects_table): Remove.
* data.c (syms_of_data): Update.
(Vmost_negative_fixnum, Vmost_positive_fixnum): Remove.
* composite.c (syms_of_composite): Update.
(Vauto_composition_function, Vauto_composition_mode)
(Vcompose_chars_after_function, Vcomposition_function_table):
Remove.
* coding.c (syms_of_coding): Update.
(Vcharset_revision_table, Vcoding_category_list)
(Vcoding_system_alist, Vcoding_system_for_read)
(Vcoding_system_for_write, Vcoding_system_list)
(Vdefault_process_coding_system, Venable_character_translation)
(Vfile_coding_system_alist, Vlast_code_conversion_error)
(Vlast_coding_system_used, Vlatin_extra_code_table)
(Vlocale_coding_system, Vnetwork_coding_system_alist)
(Vprocess_coding_system_alist)
(Vselect_safe_coding_system_function)
(Vstandard_translation_table_for_decode)
(Vstandard_translation_table_for_encode)
(Vtranslation_table_for_input, coding_system_require_warning)
(eol_mnemonic_dos, eol_mnemonic_mac, eol_mnemonic_undecided)
(eol_mnemonic_unix, inherit_process_coding_system)
(inhibit_eol_conversion, inhibit_iso_escape_detection)
(inhibit_null_byte_detection): Remove.
* cmds.c (syms_of_cmds): Update.
(Vpost_self_insert_hook): Remove.
* charset.c (syms_of_charset): Update.
(Vcharset_list, Vcharset_map_path, Vcurrent_iso639_language)
(inhibit_load_charset_map): Remove.
* character.c (syms_of_character): Update.
(Vauto_fill_chars, Vchar_direction_table, Vchar_script_table)
(Vchar_width_table, Vprintable_chars)
(Vscript_representative_chars, Vtranslation_table_vector)
(Vunicode_category_table): Remove.
* ccl.c (syms_of_ccl): Update.
(Vcode_conversion_map_vector, Vfont_ccl_encoder_alist)
(Vtranslation_hash_table_vector): Remove.
* category.c (syms_of_category): Update.
(Vword_combining_categories, Vword_separating_categories): Remove.
* callproc.c (syms_of_callproc): Update.
(Vconfigure_info_directory, Vdata_directory, Vdoc_directory)
(Vexec_directory, Vexec_path, Vexec_suffixes)
(Vinitial_environment, Vprocess_environment)
(Vshared_game_score_directory, Vshell_file_name): Remove.
* callint.c (syms_of_callint): Update.
(Vcommand_debug_status, Vcommand_history, Vcurrent_prefix_arg)
(Vmark_even_if_inactive, Vmouse_leave_buffer_hook): Remove.
* bytecode.c (syms_of_bytecode): Update.
(Vbyte_code_meter, byte_metering_on): Remove.
* buffer.c (syms_of_buffer): Update.
(Vafter_change_functions, Vbefore_change_functions)
(Vchange_major_mode_hook, Vfirst_change_hook)
(Vinhibit_read_only, Vkill_buffer_query_functions)
(Vtransient_mark_mode, inhibit_modification_hooks): Remove.
* alloc.c (syms_of_alloc): Update.
(Vgc_cons_percentage, Vgc_elapsed, Vmemory_full)
(Vmemory_signal_data, Vpost_gc_hook, Vpurify_flag)
(cons_cells_consed, floats_consed, garbage_collection_messages)
(gc_cons_threshold, gcs_done, intervals_consed)
(misc_objects_consed, pure_bytes_used, string_chars_consed)
(strings_consed, symbols_consed, vector_cells_consed): Remove.
* lisp.h (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL)
(DEFVAR_INT): Assume global is in `globals'.
* alloc.c (globals): Define.
author | Tom Tromey <tromey@redhat.com> |
---|---|
date | Tue, 18 Jan 2011 13:45:37 -0700 |
parents | 56d3e9c28eb0 |
children | 9de5a68b57e1 |
rev | line source |
---|---|
297 | 1 /* Record indices of function doc strings stored in a file. |
64770
a0d1312ede66
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64084
diff
changeset
|
2 Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
109923
diff
changeset
|
3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
79759 | 4 Free Software Foundation, Inc. |
297 | 5 |
6 This file is part of GNU Emacs. | |
7 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91607
diff
changeset
|
8 GNU Emacs is free software: you can redistribute it and/or modify |
297 | 9 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91607
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91607
diff
changeset
|
11 (at your option) any later version. |
297 | 12 |
13 GNU Emacs is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91607
diff
changeset
|
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
297 | 20 |
21 | |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
3999
diff
changeset
|
22 #include <config.h> |
297 | 23 |
24 #include <sys/types.h> | |
96303 | 25 #include <sys/file.h> /* Must be after sys/types.h for USG*/ |
58087 | 26 #include <ctype.h> |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104918
diff
changeset
|
27 #include <setjmp.h> |
297 | 28 #include <fcntl.h> |
6862
653504b6b5dd
[HAVE_UNISTD_H]: Include unistd.h.
Richard M. Stallman <rms@gnu.org>
parents:
6030
diff
changeset
|
29 #include <unistd.h> |
653504b6b5dd
[HAVE_UNISTD_H]: Include unistd.h.
Richard M. Stallman <rms@gnu.org>
parents:
6030
diff
changeset
|
30 |
297 | 31 #include "lisp.h" |
32 #include "buffer.h" | |
1511
ff88f962a982
* doc.c: #include keyboard.h.
Jim Blandy <jimb@redhat.com>
parents:
1116
diff
changeset
|
33 #include "keyboard.h" |
88351
aac41b50c875
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43155
diff
changeset
|
34 #include "character.h" |
39697
0b986bb45526
Include keymap.h.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39675
diff
changeset
|
35 #include "keymap.h" |
104619
90578b9cc2d2
* Makefile.in (buildobj.h): New target.
Ken Raeburn <raeburn@raeburn.org>
parents:
100951
diff
changeset
|
36 #include "buildobj.h" |
297 | 37 |
28334
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
38 Lisp_Object Qfunction_documentation; |
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
39 |
14648
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
40 /* Buffer used for reading from documentation file. */ |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
41 static char *get_doc_string_buffer; |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
42 static int get_doc_string_buffer_size; |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
43 |
22690
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
44 static unsigned char *read_bytecode_pointer; |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
108161
diff
changeset
|
45 Lisp_Object Fsnarf_documentation (Lisp_Object); |
22690
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
46 |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
47 /* readchar in lread.c calls back here to fetch the next byte. |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
48 If UNREADFLAG is 1, we unread a byte. */ |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
49 |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
50 int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
51 read_bytecode_char (int unreadflag) |
22690
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
52 { |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
53 if (unreadflag) |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
54 { |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
55 read_bytecode_pointer--; |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
56 return 0; |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
57 } |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
58 return *read_bytecode_pointer++; |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
59 } |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
60 |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
61 /* Extract a doc string from a file. FILEPOS says where to get it. |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
62 If it is an integer, use that position in the standard DOC-... file. |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
63 If it is (FILE . INTEGER), use FILE as the file name |
11252
f610f9d7e3ca
(get_doc_string): In (STRING . INTEGER), if INTEGER
Richard M. Stallman <rms@gnu.org>
parents:
10345
diff
changeset
|
64 and INTEGER as the position in that file. |
f610f9d7e3ca
(get_doc_string): In (STRING . INTEGER), if INTEGER
Richard M. Stallman <rms@gnu.org>
parents:
10345
diff
changeset
|
65 But if INTEGER is negative, make it positive. |
f610f9d7e3ca
(get_doc_string): In (STRING . INTEGER), if INTEGER
Richard M. Stallman <rms@gnu.org>
parents:
10345
diff
changeset
|
66 (A negative integer is used for user variables, so we can distinguish |
22043
10a9f355a346
(get_doc_string): New arg UNIBYTE
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
67 them without actually fetching the doc string.) |
10a9f355a346
(get_doc_string): New arg UNIBYTE
Richard M. Stallman <rms@gnu.org>
parents:
21514
diff
changeset
|
68 |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
69 If the location does not point to the beginning of a docstring |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
70 (e.g. because the file has been modified and the location is stale), |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
71 return nil. |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
72 |
22602
9c6b3b9c3c8f
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22562
diff
changeset
|
73 If UNIBYTE is nonzero, always make a unibyte string. |
9c6b3b9c3c8f
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22562
diff
changeset
|
74 |
22562
ddb3fd464b77
(get_doc_string): 2nd arg is now DEFINITION;
Richard M. Stallman <rms@gnu.org>
parents:
22268
diff
changeset
|
75 If DEFINITION is nonzero, assume this is for reading |
ddb3fd464b77
(get_doc_string): 2nd arg is now DEFINITION;
Richard M. Stallman <rms@gnu.org>
parents:
22268
diff
changeset
|
76 a dynamic function definition; convert the bytestring |
ddb3fd464b77
(get_doc_string): 2nd arg is now DEFINITION;
Richard M. Stallman <rms@gnu.org>
parents:
22268
diff
changeset
|
77 and the constants vector with appropriate byte handling, |
ddb3fd464b77
(get_doc_string): 2nd arg is now DEFINITION;
Richard M. Stallman <rms@gnu.org>
parents:
22268
diff
changeset
|
78 and return a cons cell. */ |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
79 |
22268
9308a15aa8f8
(get_doc_string): Make non-static.
Richard M. Stallman <rms@gnu.org>
parents:
22043
diff
changeset
|
80 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
81 get_doc_string (Lisp_Object filepos, int unibyte, int definition) |
9087
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
82 { |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
83 char *from, *to; |
9087
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
84 register int fd; |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
85 register char *name; |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
86 register char *p, *p1; |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
87 EMACS_INT minsize; |
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
88 EMACS_INT offset, position; |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
89 Lisp_Object file, tem; |
9087
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
90 |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
91 if (INTEGERP (filepos)) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
92 { |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
93 file = Vdoc_file_name; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
94 position = XINT (filepos); |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
95 } |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
96 else if (CONSP (filepos)) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
97 { |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
24573
diff
changeset
|
98 file = XCAR (filepos); |
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
24573
diff
changeset
|
99 position = XINT (XCDR (filepos)); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
100 } |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
101 else |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
102 return Qnil; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
103 |
41823
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
104 if (position < 0) |
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
105 position = - position; |
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
106 |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
107 if (!STRINGP (Vdoc_directory)) |
9087
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
108 return Qnil; |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
109 |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
110 if (!STRINGP (file)) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
111 return Qnil; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46370
diff
changeset
|
112 |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
113 /* Put the file name in NAME as a C string. |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
114 If it is relative, combine it with Vdoc_directory. */ |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
115 |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
116 tem = Ffile_name_absolute_p (file); |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
117 if (NILP (tem)) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
118 { |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
119 minsize = SCHARS (Vdoc_directory); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
120 /* sizeof ("../etc/") == 8 */ |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
121 if (minsize < 8) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
122 minsize = 8; |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
123 name = (char *) alloca (minsize + SCHARS (file) + 8); |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
124 strcpy (name, SDATA (Vdoc_directory)); |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
125 strcat (name, SDATA (file)); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
126 } |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
127 else |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
128 { |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
129 name = (char *) SDATA (file); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
130 } |
297 | 131 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
132 fd = emacs_open (name, O_RDONLY, 0); |
297 | 133 if (fd < 0) |
9087
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
134 { |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
135 #ifndef CANNOT_DUMP |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
136 if (!NILP (Vpurify_flag)) |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
137 { |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
138 /* Preparing to dump; DOC file is probably not installed. |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
139 So check in ../etc. */ |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
140 strcpy (name, "../etc/"); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
141 strcat (name, SDATA (file)); |
9087
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
142 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
143 fd = emacs_open (name, O_RDONLY, 0); |
9087
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
144 } |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
145 #endif |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
146 if (fd < 0) |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
147 error ("Cannot open doc string file \"%s\"", name); |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
148 } |
e3c272c7f4d2
(get_doc_string): Look in ../etc while dumping.
Richard M. Stallman <rms@gnu.org>
parents:
8823
diff
changeset
|
149 |
14552
e6f31368feeb
(get_doc_string): Always read entire disk blocks.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
150 /* Seek only to beginning of disk block. */ |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
151 /* Make sure we read at least 1024 bytes before `position' |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
152 so we can check the leading text for consistency. */ |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
153 offset = min (position, max (1024, position % (8 * 1024))); |
14552
e6f31368feeb
(get_doc_string): Always read entire disk blocks.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
154 if (0 > lseek (fd, position - offset, 0)) |
297 | 155 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
156 emacs_close (fd); |
297 | 157 error ("Position %ld out of range in doc string file \"%s\"", |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
158 position, name); |
297 | 159 } |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
160 |
14648
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
161 /* Read the doc string into get_doc_string_buffer. |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
162 P points beyond the data just read. */ |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
163 |
14648
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
164 p = get_doc_string_buffer; |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
165 while (1) |
297 | 166 { |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
167 EMACS_INT space_left = (get_doc_string_buffer_size |
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
168 - (p - get_doc_string_buffer)); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
169 int nread; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
170 |
14552
e6f31368feeb
(get_doc_string): Always read entire disk blocks.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
171 /* Allocate or grow the buffer if we need to. */ |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
172 if (space_left == 0) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
173 { |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
174 EMACS_INT in_buffer = p - get_doc_string_buffer; |
14648
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
175 get_doc_string_buffer_size += 16 * 1024; |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
176 get_doc_string_buffer |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
177 = (char *) xrealloc (get_doc_string_buffer, |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
178 get_doc_string_buffer_size + 1); |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
179 p = get_doc_string_buffer + in_buffer; |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
180 space_left = (get_doc_string_buffer_size |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
181 - (p - get_doc_string_buffer)); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
182 } |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
183 |
14552
e6f31368feeb
(get_doc_string): Always read entire disk blocks.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
184 /* Read a disk block at a time. |
e6f31368feeb
(get_doc_string): Always read entire disk blocks.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
185 If we read the same block last time, maybe skip this? */ |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
186 if (space_left > 1024 * 8) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
187 space_left = 1024 * 8; |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
188 nread = emacs_read (fd, p, space_left); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
189 if (nread < 0) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
190 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
191 emacs_close (fd); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
192 error ("Read error on documentation file"); |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
193 } |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
194 p[nread] = 0; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
195 if (!nread) |
297 | 196 break; |
14648
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
197 if (p == get_doc_string_buffer) |
109315
8f3464b85afb
Use strchr, strrchr instead of index, rindex
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
198 p1 = strchr (p + offset, '\037'); |
14552
e6f31368feeb
(get_doc_string): Always read entire disk blocks.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
199 else |
109315
8f3464b85afb
Use strchr, strrchr instead of index, rindex
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
200 p1 = strchr (p, '\037'); |
297 | 201 if (p1) |
202 { | |
203 *p1 = 0; | |
204 p = p1; | |
205 break; | |
206 } | |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
207 p += nread; |
297 | 208 } |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
209 emacs_close (fd); |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
210 |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
211 /* Sanity checking. */ |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
212 if (CONSP (filepos)) |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
213 { |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
214 int test = 1; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
215 if (get_doc_string_buffer[offset - test++] != ' ') |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
216 return Qnil; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
217 while (get_doc_string_buffer[offset - test] >= '0' |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
218 && get_doc_string_buffer[offset - test] <= '9') |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
219 test++; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
220 if (get_doc_string_buffer[offset - test++] != '@' |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
221 || get_doc_string_buffer[offset - test] != '#') |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
222 return Qnil; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
223 } |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
224 else |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
225 { |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
226 int test = 1; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
227 if (get_doc_string_buffer[offset - test++] != '\n') |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
228 return Qnil; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
229 while (get_doc_string_buffer[offset - test] > ' ') |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
230 test++; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
231 if (get_doc_string_buffer[offset - test] != '\037') |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
232 return Qnil; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
233 } |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
234 |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
235 /* Scan the text and perform quoting with ^A (char code 1). |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
236 ^A^A becomes ^A, ^A0 becomes a null char, and ^A_ becomes a ^_. */ |
14648
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
237 from = get_doc_string_buffer + offset; |
45d13c154bb4
(get_doc_string): Move static vars outside the function,
Richard M. Stallman <rms@gnu.org>
parents:
14552
diff
changeset
|
238 to = get_doc_string_buffer + offset; |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
239 while (from != p) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
240 { |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
241 if (*from == 1) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
242 { |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
243 int c; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
244 |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
245 from++; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
246 c = *from++; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
247 if (c == 1) |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
248 *to++ = c; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
249 else if (c == '0') |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
250 *to++ = 0; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
251 else if (c == '_') |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
252 *to++ = 037; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
253 else |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
254 error ("Invalid data in documentation file -- ^A followed by code 0%o", c); |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
255 } |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
256 else |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
257 *to++ = *from++; |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
258 } |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
259 |
22690
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
260 /* If DEFINITION, read from this buffer |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
261 the same way we would read bytes from a file. */ |
22562
ddb3fd464b77
(get_doc_string): 2nd arg is now DEFINITION;
Richard M. Stallman <rms@gnu.org>
parents:
22268
diff
changeset
|
262 if (definition) |
ddb3fd464b77
(get_doc_string): 2nd arg is now DEFINITION;
Richard M. Stallman <rms@gnu.org>
parents:
22268
diff
changeset
|
263 { |
22690
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
264 read_bytecode_pointer = get_doc_string_buffer + offset; |
31bc848c5f18
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22602
diff
changeset
|
265 return Fread (Qlambda); |
22562
ddb3fd464b77
(get_doc_string): 2nd arg is now DEFINITION;
Richard M. Stallman <rms@gnu.org>
parents:
22268
diff
changeset
|
266 } |
ddb3fd464b77
(get_doc_string): 2nd arg is now DEFINITION;
Richard M. Stallman <rms@gnu.org>
parents:
22268
diff
changeset
|
267 |
22602
9c6b3b9c3c8f
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22562
diff
changeset
|
268 if (unibyte) |
9c6b3b9c3c8f
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22562
diff
changeset
|
269 return make_unibyte_string (get_doc_string_buffer + offset, |
9c6b3b9c3c8f
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22562
diff
changeset
|
270 to - (get_doc_string_buffer + offset)); |
9c6b3b9c3c8f
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22562
diff
changeset
|
271 else |
24573
aa24b1cb428a
(get_doc_string): When UNIBYTE and DEFINITION are 0,
Richard M. Stallman <rms@gnu.org>
parents:
23921
diff
changeset
|
272 { |
109956
ce960720ed3f
Make obsolete --unibyte argument do nothing (Bug#6886).
Chong Yidong <cyd@stupidchicken.com>
parents:
109954
diff
changeset
|
273 /* The data determines whether the string is multibyte. */ |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
274 EMACS_INT nchars = multibyte_chars_in_text (get_doc_string_buffer + offset, |
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
275 to - (get_doc_string_buffer + offset)); |
24573
aa24b1cb428a
(get_doc_string): When UNIBYTE and DEFINITION are 0,
Richard M. Stallman <rms@gnu.org>
parents:
23921
diff
changeset
|
276 return make_string_from_bytes (get_doc_string_buffer + offset, |
aa24b1cb428a
(get_doc_string): When UNIBYTE and DEFINITION are 0,
Richard M. Stallman <rms@gnu.org>
parents:
23921
diff
changeset
|
277 nchars, |
aa24b1cb428a
(get_doc_string): When UNIBYTE and DEFINITION are 0,
Richard M. Stallman <rms@gnu.org>
parents:
23921
diff
changeset
|
278 to - (get_doc_string_buffer + offset)); |
aa24b1cb428a
(get_doc_string): When UNIBYTE and DEFINITION are 0,
Richard M. Stallman <rms@gnu.org>
parents:
23921
diff
changeset
|
279 } |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
280 } |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
281 |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
282 /* Get a string from position FILEPOS and pass it through the Lisp reader. |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
283 We use this for fetching the bytecode string and constants vector |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
284 of a compiled function from the .elc file. */ |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
285 |
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
286 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
287 read_doc_string (Lisp_Object filepos) |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
288 { |
22602
9c6b3b9c3c8f
(get_doc_string): Take both UNIBYTE and DEFINITION as args.
Richard M. Stallman <rms@gnu.org>
parents:
22562
diff
changeset
|
289 return get_doc_string (filepos, 0, 1); |
297 | 290 } |
291 | |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
292 static int |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
293 reread_doc_file (Lisp_Object file) |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
294 { |
45368
65ad2c8b301b
(reread_doc_file): Don't ask for confirmation.
Richard M. Stallman <rms@gnu.org>
parents:
44385
diff
changeset
|
295 #if 0 |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
296 Lisp_Object reply, prompt[3]; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
297 struct gcpro gcpro1; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
298 GCPRO1 (file); |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
299 prompt[0] = build_string ("File "); |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
300 prompt[1] = NILP (file) ? Vdoc_file_name : file; |
45368
65ad2c8b301b
(reread_doc_file): Don't ask for confirmation.
Richard M. Stallman <rms@gnu.org>
parents:
44385
diff
changeset
|
301 prompt[2] = build_string (" is out of sync. Reload? "); |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
302 reply = Fy_or_n_p (Fconcat (3, prompt)); |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
303 UNGCPRO; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
304 if (NILP (reply)) |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
305 return 0; |
45368
65ad2c8b301b
(reread_doc_file): Don't ask for confirmation.
Richard M. Stallman <rms@gnu.org>
parents:
44385
diff
changeset
|
306 #endif |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
307 |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
308 if (NILP (file)) |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
309 Fsnarf_documentation (Vdoc_file_name); |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
310 else |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
311 Fload (file, Qt, Qt, Qt, Qnil); |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
312 |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
313 return 1; |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
314 } |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
315 |
570 | 316 DEFUN ("documentation", Fdocumentation, Sdocumentation, 1, 2, 0, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
317 doc: /* Return the documentation string of FUNCTION. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
318 Unless a non-nil second argument RAW is given, the |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
319 string is passed through `substitute-command-keys'. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
320 (Lisp_Object function, Lisp_Object raw) |
297 | 321 { |
322 Lisp_Object fun; | |
323 Lisp_Object funcar; | |
570 | 324 Lisp_Object tem, doc; |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
325 int try_reload = 1; |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
326 |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
327 documentation: |
297 | 328 |
34363
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
329 doc = Qnil; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46370
diff
changeset
|
330 |
28334
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
331 if (SYMBOLP (function) |
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
332 && (tem = Fget (function, Qfunction_documentation), |
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
333 !NILP (tem))) |
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
334 return Fdocumentation_property (function, Qfunction_documentation, raw); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46370
diff
changeset
|
335 |
68758
13c1b7c5f555
* data.c (Findirect_function): Add NOERROR arg. All callers changed
Kim F. Storm <storm@cua.dk>
parents:
68651
diff
changeset
|
336 fun = Findirect_function (function, Qnil); |
10002
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
337 if (SUBRP (fun)) |
297 | 338 { |
28334
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
339 if (XSUBR (fun)->doc == 0) |
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
340 return Qnil; |
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
341 else if ((EMACS_INT) XSUBR (fun)->doc >= 0) |
570 | 342 doc = build_string (XSUBR (fun)->doc); |
297 | 343 else |
41823
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
344 doc = make_number ((EMACS_INT) XSUBR (fun)->doc); |
10002
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
345 } |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
346 else if (COMPILEDP (fun)) |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
347 { |
41823
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
348 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING) |
297 | 349 return Qnil; |
41823
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
350 tem = AREF (fun, COMPILED_DOC_STRING); |
9133
48820d57a24c
(get_doc_string, Fdocumentation, Fdocumentation_property,
Karl Heuer <kwzh@gnu.org>
parents:
9087
diff
changeset
|
351 if (STRINGP (tem)) |
570 | 352 doc = tem; |
10202
4013c083162e
(get_doc_string): Now static. Arg now Lisp_Object.
Richard M. Stallman <rms@gnu.org>
parents:
10002
diff
changeset
|
353 else if (NATNUMP (tem) || CONSP (tem)) |
41823
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
354 doc = tem; |
570 | 355 else |
356 return Qnil; | |
10002
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
357 } |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
358 else if (STRINGP (fun) || VECTORP (fun)) |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
359 { |
297 | 360 return build_string ("Keyboard macro."); |
10002
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
361 } |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
362 else if (CONSP (fun)) |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
363 { |
297 | 364 funcar = Fcar (fun); |
9133
48820d57a24c
(get_doc_string, Fdocumentation, Fdocumentation_property,
Karl Heuer <kwzh@gnu.org>
parents:
9087
diff
changeset
|
365 if (!SYMBOLP (funcar)) |
71974
9208340e9cad
(Fdocumentation): Use xsignal1.
Kim F. Storm <storm@cua.dk>
parents:
68784
diff
changeset
|
366 xsignal1 (Qinvalid_function, fun); |
647 | 367 else if (EQ (funcar, Qkeymap)) |
23921
81a6345fd5e8
(Fdocumentation): Change the doc string for prefix
Andreas Schwab <schwab@suse.de>
parents:
22890
diff
changeset
|
368 return build_string ("Prefix command (definition is a keymap associating keystrokes with commands)."); |
647 | 369 else if (EQ (funcar, Qlambda) |
370 || EQ (funcar, Qautoload)) | |
297 | 371 { |
13521
13e55327ef5e
(Fdocumentation): Reject a file reference
Richard M. Stallman <rms@gnu.org>
parents:
13244
diff
changeset
|
372 Lisp_Object tem1; |
13e55327ef5e
(Fdocumentation): Reject a file reference
Richard M. Stallman <rms@gnu.org>
parents:
13244
diff
changeset
|
373 tem1 = Fcdr (Fcdr (fun)); |
13e55327ef5e
(Fdocumentation): Reject a file reference
Richard M. Stallman <rms@gnu.org>
parents:
13244
diff
changeset
|
374 tem = Fcar (tem1); |
9133
48820d57a24c
(get_doc_string, Fdocumentation, Fdocumentation_property,
Karl Heuer <kwzh@gnu.org>
parents:
9087
diff
changeset
|
375 if (STRINGP (tem)) |
570 | 376 doc = tem; |
13521
13e55327ef5e
(Fdocumentation): Reject a file reference
Richard M. Stallman <rms@gnu.org>
parents:
13244
diff
changeset
|
377 /* Handle a doc reference--but these never come last |
13e55327ef5e
(Fdocumentation): Reject a file reference
Richard M. Stallman <rms@gnu.org>
parents:
13244
diff
changeset
|
378 in the function body, so reject them if they are last. */ |
41823
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
379 else if ((NATNUMP (tem) || (CONSP (tem) && INTEGERP (XCDR (tem)))) |
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
380 && !NILP (XCDR (tem1))) |
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
381 doc = tem; |
570 | 382 else |
383 return Qnil; | |
297 | 384 } |
647 | 385 else if (EQ (funcar, Qmacro)) |
570 | 386 return Fdocumentation (Fcdr (fun), raw); |
10002
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
387 else |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
388 goto oops; |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
389 } |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
390 else |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
391 { |
5b2b7e378772
(Fdocumentation): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
9958
diff
changeset
|
392 oops: |
71974
9208340e9cad
(Fdocumentation): Use xsignal1.
Kim F. Storm <storm@cua.dk>
parents:
68784
diff
changeset
|
393 xsignal1 (Qinvalid_function, fun); |
297 | 394 } |
570 | 395 |
85493
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
396 /* Check for an advised function. Its doc string |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
397 has an `ad-advice-info' text property. */ |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
398 if (STRINGP (doc)) |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
399 { |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
400 Lisp_Object innerfunc; |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
401 innerfunc = Fget_text_property (make_number (0), |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
402 intern ("ad-advice-info"), |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
403 doc); |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
404 if (! NILP (innerfunc)) |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
405 doc = call1 (intern ("ad-make-advised-docstring"), innerfunc); |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
406 } |
97bdce721eef
(Fdocumentation): Check for advice in all cases.
Juanma Barranquero <lekktu@gmail.com>
parents:
85446
diff
changeset
|
407 |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
408 /* If DOC is 0, it's typically because of a dumped file missing |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
409 from the DOC file (bug in src/Makefile.in). */ |
44385
d5cf9afe17d6
(Fdocumentation): More brainos. I need sleep.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44383
diff
changeset
|
410 if (EQ (doc, make_number (0))) |
d5cf9afe17d6
(Fdocumentation): More brainos. I need sleep.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44383
diff
changeset
|
411 doc = Qnil; |
44381
15b5489c78d6
(Fdocumentation, Fdocumentation_property): When the doc
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44355
diff
changeset
|
412 if (INTEGERP (doc) || CONSP (doc)) |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
413 { |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
414 Lisp_Object tem; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
415 tem = get_doc_string (doc, 0, 0); |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
416 if (NILP (tem) && try_reload) |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
417 { |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
418 /* The file is newer, we need to reset the pointers. */ |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
419 struct gcpro gcpro1, gcpro2; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
420 GCPRO2 (function, raw); |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
421 try_reload = reread_doc_file (Fcar_safe (doc)); |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
422 UNGCPRO; |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
423 if (try_reload) |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
424 { |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
425 try_reload = 0; |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
426 goto documentation; |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
427 } |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
428 } |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
429 else |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
430 doc = tem; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
431 } |
41823
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
432 |
577 | 433 if (NILP (raw)) |
26471
b1863c0b8f9c
(Fdocumentation): Remove gcpro here too.
Dave Love <fx@gnu.org>
parents:
26420
diff
changeset
|
434 doc = Fsubstitute_command_keys (doc); |
570 | 435 return doc; |
297 | 436 } |
437 | |
28036
ec8b11f3d3da
(Fdocumentation_property): If value is not a string,
Gerd Moellmann <gerd@gnu.org>
parents:
27560
diff
changeset
|
438 DEFUN ("documentation-property", Fdocumentation_property, |
ec8b11f3d3da
(Fdocumentation_property): If value is not a string,
Gerd Moellmann <gerd@gnu.org>
parents:
27560
diff
changeset
|
439 Sdocumentation_property, 2, 3, 0, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
440 doc: /* Return the documentation string that is SYMBOL's PROP property. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
441 Third argument RAW omitted or nil means pass the result through |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
442 `substitute-command-keys' if it is a string. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
443 |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
444 This differs from `get' in that it can refer to strings stored in the |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
445 `etc/DOC' file; and that it evaluates documentation properties that |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
446 aren't strings. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
447 (Lisp_Object symbol, Lisp_Object prop, Lisp_Object raw) |
297 | 448 { |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
449 int try_reload = 1; |
26076
edbfca66058d
(Fdocumentation_property): Remove register declaration for `tem'.
Dave Love <fx@gnu.org>
parents:
26075
diff
changeset
|
450 Lisp_Object tem; |
297 | 451 |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
452 documentation_property: |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46370
diff
changeset
|
453 |
14069
a45a97ebdf1c
(Fdocumentation, Fdocumentation_property, Fsubstitute_command_keys):
Erik Naggum <erik@naggum.no>
parents:
13521
diff
changeset
|
454 tem = Fget (symbol, prop); |
44383
e44eec58a815
(Fdocumentation): Add missing parentheses.
Juanma Barranquero <lekktu@gmail.com>
parents:
44381
diff
changeset
|
455 if (EQ (tem, make_number (0))) |
44385
d5cf9afe17d6
(Fdocumentation): More brainos. I need sleep.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44383
diff
changeset
|
456 tem = Qnil; |
44381
15b5489c78d6
(Fdocumentation, Fdocumentation_property): When the doc
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44355
diff
changeset
|
457 if (INTEGERP (tem) || (CONSP (tem) && INTEGERP (XCDR (tem)))) |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
458 { |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
459 Lisp_Object doc = tem; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
460 tem = get_doc_string (tem, 0, 0); |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
461 if (NILP (tem) && try_reload) |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
462 { |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
463 /* The file is newer, we need to reset the pointers. */ |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
464 struct gcpro gcpro1, gcpro2, gcpro3; |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
465 GCPRO3 (symbol, prop, raw); |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
466 try_reload = reread_doc_file (Fcar_safe (doc)); |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
467 UNGCPRO; |
44348
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
468 if (try_reload) |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
469 { |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
470 try_reload = 0; |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
471 goto documentation_property; |
80c9e94bec17
(reread_doc_file): Return whether reload was attempted.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44324
diff
changeset
|
472 } |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
473 } |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
474 } |
28036
ec8b11f3d3da
(Fdocumentation_property): If value is not a string,
Gerd Moellmann <gerd@gnu.org>
parents:
27560
diff
changeset
|
475 else if (!STRINGP (tem)) |
ec8b11f3d3da
(Fdocumentation_property): If value is not a string,
Gerd Moellmann <gerd@gnu.org>
parents:
27560
diff
changeset
|
476 /* Feval protects its argument. */ |
ec8b11f3d3da
(Fdocumentation_property): If value is not a string,
Gerd Moellmann <gerd@gnu.org>
parents:
27560
diff
changeset
|
477 tem = Feval (tem); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46370
diff
changeset
|
478 |
9133
48820d57a24c
(get_doc_string, Fdocumentation, Fdocumentation_property,
Karl Heuer <kwzh@gnu.org>
parents:
9087
diff
changeset
|
479 if (NILP (raw) && STRINGP (tem)) |
26420
00b7d6135be4
(Fdocumentation_property): Remove GCPRO because
Gerd Moellmann <gerd@gnu.org>
parents:
26317
diff
changeset
|
480 tem = Fsubstitute_command_keys (tem); |
312
adba7439e87c
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
297
diff
changeset
|
481 return tem; |
297 | 482 } |
483 | |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
484 /* Scanning the DOC files and placing docstring offsets into functions. */ |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
485 |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
486 static void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
487 store_function_docstring (Lisp_Object fun, EMACS_INT offset) |
109131
18f8e88d3829
Fix comments and whitespace.
Juanma Barranquero <lekktu@gmail.com>
parents:
109126
diff
changeset
|
488 /* Use EMACS_INT because we get offset from pointer subtraction. */ |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
489 { |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
490 fun = indirect_function (fun); |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
491 |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
492 /* The type determines where the docstring is stored. */ |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
493 |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
494 /* Lisp_Subrs have a slot for it. */ |
9133
48820d57a24c
(get_doc_string, Fdocumentation, Fdocumentation_property,
Karl Heuer <kwzh@gnu.org>
parents:
9087
diff
changeset
|
495 if (SUBRP (fun)) |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
496 XSUBR (fun)->doc = (char *) - offset; |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
497 |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
498 /* If it's a lisp form, stick it in the form. */ |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
499 else if (CONSP (fun)) |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
500 { |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
501 Lisp_Object tem; |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
502 |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
24573
diff
changeset
|
503 tem = XCAR (fun); |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
504 if (EQ (tem, Qlambda) || EQ (tem, Qautoload)) |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
505 { |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
506 tem = Fcdr (Fcdr (fun)); |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
24573
diff
changeset
|
507 if (CONSP (tem) && INTEGERP (XCAR (tem))) |
108161
514ebf69b289
Fix wrong-docstring problem introduced with hash-consing.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
508 XSETCAR (tem, make_number (offset)); |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
509 } |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
510 else if (EQ (tem, Qmacro)) |
25662
0a7261c1d487
Use XCAR, XCDR, and XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
24573
diff
changeset
|
511 store_function_docstring (XCDR (fun), offset); |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
512 } |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
513 |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
514 /* Bytecode objects sometimes have slots for it. */ |
9133
48820d57a24c
(get_doc_string, Fdocumentation, Fdocumentation_property,
Karl Heuer <kwzh@gnu.org>
parents:
9087
diff
changeset
|
515 else if (COMPILEDP (fun)) |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
516 { |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
517 /* This bytecode object must have a slot for the |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
518 docstring, since we've found a docstring for it. */ |
41823
e192139240f2
(Fsnarf_documentation): Add prototype.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41218
diff
changeset
|
519 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING) |
91607
d1e53221c4aa
* xselect.c (x_handle_dnd_message):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91327
diff
changeset
|
520 ASET (fun, COMPILED_DOC_STRING, make_number (offset)); |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
521 } |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
522 } |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
523 |
104619
90578b9cc2d2
* Makefile.in (buildobj.h): New target.
Ken Raeburn <raeburn@raeburn.org>
parents:
100951
diff
changeset
|
524 static const char buildobj[] = BUILDOBJ; |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
525 |
297 | 526 DEFUN ("Snarf-documentation", Fsnarf_documentation, Ssnarf_documentation, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
527 1, 1, 0, |
41218
ace002127a1c
(Fsnarf_documentation): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41001
diff
changeset
|
528 doc: /* Used during Emacs initialization to scan the `etc/DOC...' file. |
ace002127a1c
(Fsnarf_documentation): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41001
diff
changeset
|
529 This searches the `etc/DOC...' file for doc strings and |
ace002127a1c
(Fsnarf_documentation): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41001
diff
changeset
|
530 records them in function and variable definitions. |
ace002127a1c
(Fsnarf_documentation): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41001
diff
changeset
|
531 The function takes one argument, FILENAME, a string; |
ace002127a1c
(Fsnarf_documentation): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41001
diff
changeset
|
532 it specifies the file name (without a directory) of the DOC file. |
ace002127a1c
(Fsnarf_documentation): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41001
diff
changeset
|
533 That file is found in `../etc' now; later, when the dumped Emacs is run, |
56216
efd6af30bde2
(Fsnarf_documentation): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents:
54927
diff
changeset
|
534 the same file name is found in the `doc-directory'. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
535 (Lisp_Object filename) |
297 | 536 { |
537 int fd; | |
538 char buf[1024 + 1]; | |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
539 register EMACS_INT filled; |
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
540 register EMACS_INT pos; |
297 | 541 register char *p, *end; |
34963
681963400696
(Fsnarf_documentation): Remove unused variables `fun' and
Eli Zaretskii <eliz@gnu.org>
parents:
34363
diff
changeset
|
542 Lisp_Object sym; |
297 | 543 char *name; |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
544 int skip_file = 0; |
297 | 545 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40139
diff
changeset
|
546 CHECK_STRING (filename); |
297 | 547 |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
548 if |
297 | 549 #ifndef CANNOT_DUMP |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
550 (!NILP (Vpurify_flag)) |
297 | 551 #else /* CANNOT_DUMP */ |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
552 (0) |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
553 #endif /* CANNOT_DUMP */ |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
554 { |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
555 name = (char *) alloca (SCHARS (filename) + 14); |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
556 strcpy (name, "../etc/"); |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
557 } |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
558 else |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
559 { |
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
560 CHECK_STRING (Vdoc_directory); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
561 name = (char *) alloca (SCHARS (filename) |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
562 + SCHARS (Vdoc_directory) + 1); |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
563 strcpy (name, SDATA (Vdoc_directory)); |
44324
def57419f6ec
(get_doc_string): Return nil of the location is wrong.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43155
diff
changeset
|
564 } |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
565 strcat (name, SDATA (filename)); /*** Add this line ***/ |
297 | 566 |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
567 /* Vbuild_files is nil when temacs is run, and non-nil after that. */ |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
568 if (NILP (Vbuild_files)) |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
569 { |
104619
90578b9cc2d2
* Makefile.in (buildobj.h): New target.
Ken Raeburn <raeburn@raeburn.org>
parents:
100951
diff
changeset
|
570 const char *beg, *end; |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
571 |
104619
90578b9cc2d2
* Makefile.in (buildobj.h): New target.
Ken Raeburn <raeburn@raeburn.org>
parents:
100951
diff
changeset
|
572 for (beg = buildobj; *beg; beg = end) |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
573 { |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
574 EMACS_INT len; |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
575 |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
576 while (*beg && isspace (*beg)) ++beg; |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
577 |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
578 for (end = beg; *end && ! isspace (*end); ++end) |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
579 if (*end == '/') beg = end+1; /* skip directory part */ |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
580 |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
581 len = end - beg; |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
582 if (len > 4 && end[-4] == '.' && end[-3] == 'o') |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
583 len -= 2; /* Just take .o if it ends in .obj */ |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
584 |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
585 if (len > 0) |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
586 Vbuild_files = Fcons (make_string (beg, len), Vbuild_files); |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
587 } |
105942
5fc80e6b5b7c
* xfns.c (syms_of_xfns): Use make_pure_string instead of build_string.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105877
diff
changeset
|
588 Vbuild_files = Fpurecopy (Vbuild_files); |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
589 } |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
590 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
591 fd = emacs_open (name, O_RDONLY, 0); |
297 | 592 if (fd < 0) |
593 report_file_error ("Opening doc string file", | |
594 Fcons (build_string (name), Qnil)); | |
595 Vdoc_file_name = filename; | |
596 filled = 0; | |
597 pos = 0; | |
598 while (1) | |
599 { | |
600 if (filled < 512) | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
601 filled += emacs_read (fd, &buf[filled], sizeof buf - 1 - filled); |
297 | 602 if (!filled) |
603 break; | |
604 | |
605 buf[filled] = 0; | |
606 p = buf; | |
607 end = buf + (filled < 512 ? filled : filled - 128); | |
608 while (p != end && *p != '\037') p++; | |
109923
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
609 /* p points to ^_Ffunctionname\n or ^_Vvarname\n or ^_Sfilename\n. */ |
297 | 610 if (p != end) |
611 { | |
109315
8f3464b85afb
Use strchr, strrchr instead of index, rindex
Andreas Schwab <schwab@linux-m68k.org>
parents:
109179
diff
changeset
|
612 end = strchr (p, '\n'); |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
613 |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
614 /* See if this is a file name, and if it is a file in build-files. */ |
109923
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
615 if (p[1] == 'S') |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
616 { |
109923
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
617 skip_file = 0; |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
618 if (end - p > 4 && end[-2] == '.' |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
619 && (end[-1] == 'o' || end[-1] == 'c')) |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
620 { |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
621 EMACS_INT len = end - p - 2; |
109923
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
622 char *fromfile = alloca (len + 1); |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
623 strncpy (fromfile, &p[2], len); |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
624 fromfile[len] = 0; |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
625 if (fromfile[len-1] == 'c') |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
626 fromfile[len-1] = 'o'; |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
627 |
109923
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
628 skip_file = NILP (Fmember (build_string (fromfile), |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
629 Vbuild_files)); |
ac121cf6d1fc
* doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
Jan D <jan.h.d@swipnet.se>
parents:
109920
diff
changeset
|
630 } |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
631 } |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
632 |
20619 | 633 sym = oblookup (Vobarray, p + 2, |
634 multibyte_chars_in_text (p + 2, end - p - 2), | |
635 end - p - 2); | |
85324
228a7fde2f4a
(Fsnarf_documentation): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
636 /* Check skip_file so that when a function is defined several |
228a7fde2f4a
(Fsnarf_documentation): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
637 times in different files (typically, once in xterm, once in |
228a7fde2f4a
(Fsnarf_documentation): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
638 w32term, ...), we only pay attention to the one that |
228a7fde2f4a
(Fsnarf_documentation): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82140
diff
changeset
|
639 matters. */ |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
640 if (! skip_file && SYMBOLP (sym)) |
297 | 641 { |
642 /* Attach a docstring to a variable? */ | |
643 if (p[1] == 'V') | |
644 { | |
645 /* Install file-position as variable-documentation property | |
646 and make it negative for a user-variable | |
647 (doc starts with a `*'). */ | |
648 Fput (sym, Qvariable_documentation, | |
649 make_number ((pos + end + 1 - buf) | |
650 * (end[1] == '*' ? -1 : 1))); | |
651 } | |
652 | |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
653 /* Attach a docstring to a function? */ |
297 | 654 else if (p[1] == 'F') |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
655 store_function_docstring (sym, pos + end + 1 - buf); |
297 | 656 |
54745
98cf37e32872
(Fsnarf_documentation): Ignore new file name entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54234
diff
changeset
|
657 else if (p[1] == 'S') |
98cf37e32872
(Fsnarf_documentation): Ignore new file name entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54234
diff
changeset
|
658 ; /* Just a source file name boundary marker. Ignore it. */ |
98cf37e32872
(Fsnarf_documentation): Ignore new file name entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54234
diff
changeset
|
659 |
1651
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
660 else |
ef09501a0a9b
* doc.c (store_function_docstring): New function, made from part
Jim Blandy <jimb@redhat.com>
parents:
1511
diff
changeset
|
661 error ("DOC file invalid at position %d", pos); |
297 | 662 } |
663 } | |
664 pos += end - buf; | |
665 filled -= end - buf; | |
110463
3132ab826fc5
* doc.c (Fsnarf_documentation): Use memmove instead of memcpy as
Andreas Schwab <schwab@linux-m68k.org>
parents:
109956
diff
changeset
|
666 memmove (buf, end, filled); |
297 | 667 } |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26076
diff
changeset
|
668 emacs_close (fd); |
297 | 669 return Qnil; |
670 } | |
671 | |
672 DEFUN ("substitute-command-keys", Fsubstitute_command_keys, | |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
673 Ssubstitute_command_keys, 1, 1, 0, |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
674 doc: /* Substitute key descriptions for command names in STRING. |
66815
b9685771709d
(Fsubstitute_command_keys): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
65391
diff
changeset
|
675 Substrings of the form \\=\\[COMMAND] replaced by either: a keystroke |
b9685771709d
(Fsubstitute_command_keys): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
65391
diff
changeset
|
676 sequence that will invoke COMMAND, or "M-x COMMAND" if COMMAND is not |
b9685771709d
(Fsubstitute_command_keys): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
65391
diff
changeset
|
677 on any keys. |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
678 Substrings of the form \\=\\{MAPVAR} are replaced by summaries |
68784
768bd941cf0d
(Fsubstitute_command_keys): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
68758
diff
changeset
|
679 \(made by `describe-bindings') of the value of MAPVAR, taken as a keymap. |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
680 Substrings of the form \\=\\<MAPVAR> specify to use the value of MAPVAR |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
681 as the keymap for future \\=\\[COMMAND] substrings. |
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
682 \\=\\= quotes the following character and is discarded; |
66815
b9685771709d
(Fsubstitute_command_keys): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
65391
diff
changeset
|
683 thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ into the output. |
b9685771709d
(Fsubstitute_command_keys): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
65391
diff
changeset
|
684 |
75968
88a395ffffbc
(Fsubstitute_command_keys): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
75348
diff
changeset
|
685 Returns original STRING if no substitutions were made. Otherwise, |
66815
b9685771709d
(Fsubstitute_command_keys): Doc fix.
Kim F. Storm <storm@cua.dk>
parents:
65391
diff
changeset
|
686 a new string, without any text properties, is returned. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109165
diff
changeset
|
687 (Lisp_Object string) |
297 | 688 { |
689 unsigned char *buf; | |
690 int changed = 0; | |
691 register unsigned char *strp; | |
692 register unsigned char *bufp; | |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
693 EMACS_INT idx; |
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
694 EMACS_INT bsize; |
1511
ff88f962a982
* doc.c: #include keyboard.h.
Jim Blandy <jimb@redhat.com>
parents:
1116
diff
changeset
|
695 Lisp_Object tem; |
297 | 696 Lisp_Object keymap; |
697 unsigned char *start; | |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
698 EMACS_INT length, length_byte; |
1511
ff88f962a982
* doc.c: #include keyboard.h.
Jim Blandy <jimb@redhat.com>
parents:
1116
diff
changeset
|
699 Lisp_Object name; |
ff88f962a982
* doc.c: #include keyboard.h.
Jim Blandy <jimb@redhat.com>
parents:
1116
diff
changeset
|
700 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
20619 | 701 int multibyte; |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
702 EMACS_INT nchars; |
297 | 703 |
14069
a45a97ebdf1c
(Fdocumentation, Fdocumentation_property, Fsubstitute_command_keys):
Erik Naggum <erik@naggum.no>
parents:
13521
diff
changeset
|
704 if (NILP (string)) |
297 | 705 return Qnil; |
706 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40139
diff
changeset
|
707 CHECK_STRING (string); |
1511
ff88f962a982
* doc.c: #include keyboard.h.
Jim Blandy <jimb@redhat.com>
parents:
1116
diff
changeset
|
708 tem = Qnil; |
ff88f962a982
* doc.c: #include keyboard.h.
Jim Blandy <jimb@redhat.com>
parents:
1116
diff
changeset
|
709 keymap = Qnil; |
ff88f962a982
* doc.c: #include keyboard.h.
Jim Blandy <jimb@redhat.com>
parents:
1116
diff
changeset
|
710 name = Qnil; |
14069
a45a97ebdf1c
(Fdocumentation, Fdocumentation_property, Fsubstitute_command_keys):
Erik Naggum <erik@naggum.no>
parents:
13521
diff
changeset
|
711 GCPRO4 (string, tem, keymap, name); |
297 | 712 |
20619 | 713 multibyte = STRING_MULTIBYTE (string); |
714 nchars = 0; | |
715 | |
5784
9c3be8e0d2ef
(Fsubstitute_command_keys): Pass keymap as that arg
Richard M. Stallman <rms@gnu.org>
parents:
5550
diff
changeset
|
716 /* KEYMAP is either nil (which means search all the active keymaps) |
9c3be8e0d2ef
(Fsubstitute_command_keys): Pass keymap as that arg
Richard M. Stallman <rms@gnu.org>
parents:
5550
diff
changeset
|
717 or a specified local map (which means search just that and the |
9c3be8e0d2ef
(Fsubstitute_command_keys): Pass keymap as that arg
Richard M. Stallman <rms@gnu.org>
parents:
5550
diff
changeset
|
718 global map). If non-nil, it might come from Voverriding_local_map, |
14069
a45a97ebdf1c
(Fdocumentation, Fdocumentation_property, Fsubstitute_command_keys):
Erik Naggum <erik@naggum.no>
parents:
13521
diff
changeset
|
719 or from a \\<mapname> construct in STRING itself.. */ |
12261 | 720 keymap = current_kboard->Voverriding_terminal_local_map; |
721 if (NILP (keymap)) | |
722 keymap = Voverriding_local_map; | |
297 | 723 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
724 bsize = SBYTES (string); |
297 | 725 bufp = buf = (unsigned char *) xmalloc (bsize); |
726 | |
50629
36d13cf0f114
(Fsubstitute_command_keys): Remove spurious casts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49600
diff
changeset
|
727 strp = SDATA (string); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
728 while (strp < SDATA (string) + SBYTES (string)) |
297 | 729 { |
730 if (strp[0] == '\\' && strp[1] == '=') | |
731 { | |
732 /* \= quotes the next character; | |
733 thus, to put in \[ without its special meaning, use \=\[. */ | |
734 changed = 1; | |
20619 | 735 strp += 2; |
736 if (multibyte) | |
737 { | |
738 int len; | |
739 | |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105942
diff
changeset
|
740 STRING_CHAR_AND_LENGTH (strp, len); |
20619 | 741 if (len == 1) |
742 *bufp = *strp; | |
743 else | |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109131
diff
changeset
|
744 memcpy (bufp, strp, len); |
20619 | 745 strp += len; |
746 bufp += len; | |
747 nchars++; | |
748 } | |
749 else | |
750 *bufp++ = *strp++, nchars++; | |
297 | 751 } |
752 else if (strp[0] == '\\' && strp[1] == '[') | |
753 { | |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
754 EMACS_INT start_idx; |
65391
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
755 int follow_remap = 1; |
5248
27d6275810a7
(Fsubstitute_command_keys): Ignore menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
4716
diff
changeset
|
756 |
297 | 757 changed = 1; |
758 strp += 2; /* skip \[ */ | |
759 start = strp; | |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
760 start_idx = start - SDATA (string); |
297 | 761 |
50629
36d13cf0f114
(Fsubstitute_command_keys): Remove spurious casts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49600
diff
changeset
|
762 while ((strp - SDATA (string) |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
763 < SBYTES (string)) |
297 | 764 && *strp != ']') |
765 strp++; | |
20619 | 766 length_byte = strp - start; |
767 | |
297 | 768 strp++; /* skip ] */ |
769 | |
770 /* Save STRP in IDX. */ | |
50629
36d13cf0f114
(Fsubstitute_command_keys): Remove spurious casts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49600
diff
changeset
|
771 idx = strp - SDATA (string); |
57497
0a4c356f307b
(Fsubstitute_command_keys): Fix remap-handling.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57441
diff
changeset
|
772 name = Fintern (make_string (start, length_byte), Qnil); |
30154
f8e2064c56b1
(Fsubstitute_command_keys): Handle case that a GC
Gerd Moellmann <gerd@gnu.org>
parents:
28334
diff
changeset
|
773 |
65391
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
774 do_remap: |
104918
cd8d62c35d57
* keymap.c (where_is_internal_data): Make noindirect a boolean.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104619
diff
changeset
|
775 tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil); |
57441
4c881805ff35
(Fsubstitute_command_keys): Ignore remappings unless there
Kim F. Storm <storm@cua.dk>
parents:
56216
diff
changeset
|
776 |
65391
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
777 if (VECTORP (tem) && XVECTOR (tem)->size > 1 |
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
778 && EQ (AREF (tem, 0), Qremap) && SYMBOLP (AREF (tem, 1)) |
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
779 && follow_remap) |
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
780 { |
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
781 name = AREF (tem, 1); |
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
782 follow_remap = 0; |
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
783 goto do_remap; |
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
784 } |
4a6f5ef57ed1
(Fsubstitute_command_keys): Lookup key binding for
Kim F. Storm <storm@cua.dk>
parents:
64770
diff
changeset
|
785 |
30154
f8e2064c56b1
(Fsubstitute_command_keys): Handle case that a GC
Gerd Moellmann <gerd@gnu.org>
parents:
28334
diff
changeset
|
786 /* Note the Fwhere_is_internal can GC, so we have to take |
f8e2064c56b1
(Fsubstitute_command_keys): Handle case that a GC
Gerd Moellmann <gerd@gnu.org>
parents:
28334
diff
changeset
|
787 relocation of string contents into account. */ |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
788 strp = SDATA (string) + idx; |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
789 start = SDATA (string) + start_idx; |
297 | 790 |
485 | 791 if (NILP (tem)) /* but not on any keys */ |
297 | 792 { |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
793 EMACS_INT offset = bufp - buf; |
34363
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
794 buf = (unsigned char *) xrealloc (buf, bsize += 4); |
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
795 bufp = buf + offset; |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109131
diff
changeset
|
796 memcpy (bufp, "M-x ", 4); |
297 | 797 bufp += 4; |
20619 | 798 nchars += 4; |
799 if (multibyte) | |
800 length = multibyte_chars_in_text (start, length_byte); | |
801 else | |
802 length = length_byte; | |
297 | 803 goto subst; |
804 } | |
805 else | |
806 { /* function is on a key */ | |
54927
7b6b4d9ae726
(Fkey_description): Change callers.
Kim F. Storm <storm@cua.dk>
parents:
54745
diff
changeset
|
807 tem = Fkey_description (tem, Qnil); |
297 | 808 goto subst_string; |
809 } | |
810 } | |
811 /* \{foo} is replaced with a summary of the keymap (symbol-value foo). | |
812 \<foo> just sets the keymap used for \[cmd]. */ | |
813 else if (strp[0] == '\\' && (strp[1] == '{' || strp[1] == '<')) | |
814 { | |
815 struct buffer *oldbuf; | |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
816 EMACS_INT start_idx; |
60065
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
817 /* This is for computing the SHADOWS arg for describe_map_tree. */ |
81609
7e640eac2dcb
* keymaps.texi (Active Keymaps): Document new POSITION argument of
David Kastrup <dak@gnu.org>
parents:
75968
diff
changeset
|
818 Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); |
60065
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
819 Lisp_Object earlier_maps; |
297 | 820 |
821 changed = 1; | |
822 strp += 2; /* skip \{ or \< */ | |
823 start = strp; | |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
824 start_idx = start - SDATA (string); |
297 | 825 |
54234
e1003d782dc6
(Fsubstitute_command_keys): Fix counding bytes.
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
826 while ((strp - SDATA (string) < SBYTES (string)) |
297 | 827 && *strp != '}' && *strp != '>') |
828 strp++; | |
20619 | 829 |
830 length_byte = strp - start; | |
297 | 831 strp++; /* skip } or > */ |
832 | |
833 /* Save STRP in IDX. */ | |
50629
36d13cf0f114
(Fsubstitute_command_keys): Remove spurious casts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49600
diff
changeset
|
834 idx = strp - SDATA (string); |
297 | 835 |
836 /* Get the value of the keymap in TEM, or nil if undefined. | |
837 Do this while still in the user's current buffer | |
838 in case it is a local variable. */ | |
20619 | 839 name = Fintern (make_string (start, length_byte), Qnil); |
297 | 840 tem = Fboundp (name); |
485 | 841 if (! NILP (tem)) |
297 | 842 { |
843 tem = Fsymbol_value (name); | |
485 | 844 if (! NILP (tem)) |
30154
f8e2064c56b1
(Fsubstitute_command_keys): Handle case that a GC
Gerd Moellmann <gerd@gnu.org>
parents:
28334
diff
changeset
|
845 { |
32988
c3435dc00ed7
* lisp.h (KEYMAPP): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31336
diff
changeset
|
846 tem = get_keymap (tem, 0, 1); |
c3435dc00ed7
* lisp.h (KEYMAPP): New macro.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31336
diff
changeset
|
847 /* Note that get_keymap can GC. */ |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
848 strp = SDATA (string) + idx; |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
849 start = SDATA (string) + start_idx; |
30154
f8e2064c56b1
(Fsubstitute_command_keys): Handle case that a GC
Gerd Moellmann <gerd@gnu.org>
parents:
28334
diff
changeset
|
850 } |
297 | 851 } |
852 | |
853 /* Now switch to a temp buffer. */ | |
854 oldbuf = current_buffer; | |
855 set_buffer_internal (XBUFFER (Vprin1_to_string_buffer)); | |
856 | |
485 | 857 if (NILP (tem)) |
297 | 858 { |
859 name = Fsymbol_name (name); | |
860 insert_string ("\nUses keymap \""); | |
20619 | 861 insert_from_string (name, 0, 0, |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
862 SCHARS (name), |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
863 SBYTES (name), 1); |
297 | 864 insert_string ("\", which is not currently defined.\n"); |
865 if (start[-1] == '<') keymap = Qnil; | |
866 } | |
867 else if (start[-1] == '<') | |
868 keymap = tem; | |
869 else | |
60065
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
870 { |
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
871 /* Get the list of active keymaps that precede this one. |
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
872 If this one's not active, get nil. */ |
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
873 earlier_maps = Fcdr (Fmemq (tem, Freverse (active_maps))); |
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
874 describe_map_tree (tem, 1, Fnreverse (earlier_maps), |
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
875 Qnil, (char *)0, 1, 0, 0, 1); |
42e18861b7b8
(Fsubstitute_command_keys): Compute list of shadowing maps
Richard M. Stallman <rms@gnu.org>
parents:
58087
diff
changeset
|
876 } |
297 | 877 tem = Fbuffer_string (); |
878 Ferase_buffer (); | |
879 set_buffer_internal (oldbuf); | |
880 | |
881 subst_string: | |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
882 start = SDATA (tem); |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
883 length = SCHARS (tem); |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
884 length_byte = SBYTES (tem); |
297 | 885 subst: |
34363
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
886 { |
110513
43adca79c8fd
Clean up EMACS_INT/int usage in doc.c and doprnt.c.
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
110463
diff
changeset
|
887 EMACS_INT offset = bufp - buf; |
34363
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
888 buf = (unsigned char *) xrealloc (buf, bsize += length_byte); |
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
889 bufp = buf + offset; |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109131
diff
changeset
|
890 memcpy (bufp, start, length_byte); |
34363
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
891 bufp += length_byte; |
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
892 nchars += length; |
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
893 /* Check STRING again in case gc relocated it. */ |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
45368
diff
changeset
|
894 strp = (unsigned char *) SDATA (string) + idx; |
34363
62a349fc3d3c
(Fsubstitute_command_keys): Change the way buffers
Gerd Moellmann <gerd@gnu.org>
parents:
32988
diff
changeset
|
895 } |
297 | 896 } |
20619 | 897 else if (! multibyte) /* just copy other chars */ |
898 *bufp++ = *strp++, nchars++; | |
899 else | |
900 { | |
901 int len; | |
902 | |
106185
f2cea199b0c4
* character.h (STRING_CHAR, STRING_CHAR_AND_LENGTH): Remove
Andreas Schwab <schwab@linux-m68k.org>
parents:
105942
diff
changeset
|
903 STRING_CHAR_AND_LENGTH (strp, len); |
20619 | 904 if (len == 1) |
905 *bufp = *strp; | |
906 else | |
109165
750db9f3e6d8
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
Andreas Schwab <schwab@linux-m68k.org>
parents:
109131
diff
changeset
|
907 memcpy (bufp, strp, len); |
20619 | 908 strp += len; |
909 bufp += len; | |
910 nchars++; | |
911 } | |
297 | 912 } |
913 | |
914 if (changed) /* don't bother if nothing substituted */ | |
21252
fce0c8c246d1
(Fsubstitute_command_keys): Use make_string_from_bytes.
Richard M. Stallman <rms@gnu.org>
parents:
21244
diff
changeset
|
915 tem = make_string_from_bytes (buf, nchars, bufp - buf); |
297 | 916 else |
14069
a45a97ebdf1c
(Fdocumentation, Fdocumentation_property, Fsubstitute_command_keys):
Erik Naggum <erik@naggum.no>
parents:
13521
diff
changeset
|
917 tem = string; |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
1651
diff
changeset
|
918 xfree (buf); |
1511
ff88f962a982
* doc.c: #include keyboard.h.
Jim Blandy <jimb@redhat.com>
parents:
1116
diff
changeset
|
919 RETURN_UNGCPRO (tem); |
297 | 920 } |
921 | |
21514 | 922 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
923 syms_of_doc (void) |
297 | 924 { |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
925 Qfunction_documentation = intern_c_string ("function-documentation"); |
28334
f9cb3463ee2a
(Qfunction_documentation): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28036
diff
changeset
|
926 staticpro (&Qfunction_documentation); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46370
diff
changeset
|
927 |
112364
42e22c4f06b7
Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents:
112330
diff
changeset
|
928 DEFVAR_LISP ("internal-doc-file-name", Vdoc_file_name, |
41001
a17c8b15ef1b
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
40702
diff
changeset
|
929 doc: /* Name of file containing documentation strings of built-in symbols. */); |
297 | 930 Vdoc_file_name = Qnil; |
931 | |
112364
42e22c4f06b7
Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents:
112330
diff
changeset
|
932 DEFVAR_LISP ("build-files", Vbuild_files, |
58068
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
933 doc: /* A list of files used to build this Emacs binary. */); |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
934 Vbuild_files = Qnil; |
df00cdb75fc6
* doc.c: New variable Vbuild_files.
Jan Djärv <jan.h.d@swipnet.se>
parents:
57497
diff
changeset
|
935 |
297 | 936 defsubr (&Sdocumentation); |
937 defsubr (&Sdocumentation_property); | |
938 defsubr (&Ssnarf_documentation); | |
939 defsubr (&Ssubstitute_command_keys); | |
940 } | |
52401 | 941 |