annotate lisp/info.el @ 4981:4aebb0131297

Cleanups/renaming of EXTERNAL_TO_C_STRING and friends -------------------- ChangeLog entries follow: -------------------- modules/ChangeLog addition: 2010-02-05 Ben Wing <ben@xemacs.org> * postgresql/postgresql.c: * postgresql/postgresql.c (CHECK_LIVE_CONNECTION): * postgresql/postgresql.c (Fpq_connectdb): * postgresql/postgresql.c (Fpq_connect_start): * postgresql/postgresql.c (Fpq_lo_import): * postgresql/postgresql.c (Fpq_lo_export): * ldap/eldap.c (Fldap_open): * ldap/eldap.c (Fldap_search_basic): * ldap/eldap.c (Fldap_add): * ldap/eldap.c (Fldap_modify): * ldap/eldap.c (Fldap_delete): * canna/canna_api.c (Fcanna_initialize): * canna/canna_api.c (Fcanna_store_yomi): * canna/canna_api.c (Fcanna_parse): * canna/canna_api.c (Fcanna_henkan_begin): EXTERNAL_TO_C_STRING returns its argument instead of storing it in a parameter, and is renamed to EXTERNAL_TO_ITEXT. Similar things happen to related macros. See entry in src/ChangeLog. More Mule-izing of postgresql.c. Extract out common code between `pq-connectdb' and `pq-connect-start'. Fix places that signal an error string using a formatted string to instead follow the standard and have a fixed reason followed by the particular error message stored as one of the frobs. src/ChangeLog addition: 2010-02-05 Ben Wing <ben@xemacs.org> * console-msw.c (write_string_to_mswindows_debugging_output): * console-msw.c (Fmswindows_message_box): * console-x.c (x_perhaps_init_unseen_key_defaults): * console.c: * database.c (dbm_get): * database.c (dbm_put): * database.c (dbm_remove): * database.c (berkdb_get): * database.c (berkdb_put): * database.c (berkdb_remove): * database.c (Fopen_database): * device-gtk.c (gtk_init_device): * device-msw.c (msprinter_init_device_internal): * device-msw.c (msprinter_default_printer): * device-msw.c (msprinter_init_device): * device-msw.c (sync_printer_with_devmode): * device-msw.c (Fmsprinter_select_settings): * device-x.c (sanity_check_geometry_resource): * device-x.c (Dynarr_add_validified_lisp_string): * device-x.c (x_init_device): * device-x.c (Fx_put_resource): * device-x.c (Fx_valid_keysym_name_p): * device-x.c (Fx_set_font_path): * dialog-msw.c (push_lisp_string_as_unicode): * dialog-msw.c (handle_directory_dialog_box): * dialog-msw.c (handle_file_dialog_box): * dialog-x.c (dbox_descriptor_to_widget_value): * editfns.c (Fformat_time_string): * editfns.c (Fencode_time): * editfns.c (Fset_time_zone_rule): * emacs.c (make_argc_argv): * emacs.c (Fdump_emacs): * emodules.c (emodules_load): * eval.c: * eval.c (maybe_signal_error_1): * event-msw.c (Fdde_alloc_advise_item): * event-msw.c (mswindows_dde_callback): * event-msw.c (mswindows_wnd_proc): * fileio.c (report_error_with_errno): * fileio.c (Fsysnetunam): * fileio.c (Fdo_auto_save): * font-mgr.c (extract_fcapi_string): * font-mgr.c (Ffc_config_app_font_add_file): * font-mgr.c (Ffc_config_app_font_add_dir): * font-mgr.c (Ffc_config_filename): * frame-gtk.c (gtk_set_frame_text_value): * frame-gtk.c (gtk_create_widgets): * frame-msw.c (mswindows_init_frame_1): * frame-msw.c (mswindows_set_title_from_ibyte): * frame-msw.c (msprinter_init_frame_3): * frame-x.c (x_set_frame_text_value): * frame-x.c (x_set_frame_properties): * frame-x.c (start_drag_internal_1): * frame-x.c (x_cde_transfer_callback): * frame-x.c (x_create_widgets): * glyphs-eimage.c (my_jpeg_output_message): * glyphs-eimage.c (jpeg_instantiate): * glyphs-eimage.c (gif_instantiate): * glyphs-eimage.c (png_instantiate): * glyphs-eimage.c (tiff_instantiate): * glyphs-gtk.c (xbm_instantiate_1): * glyphs-gtk.c (gtk_xbm_instantiate): * glyphs-gtk.c (gtk_xpm_instantiate): * glyphs-gtk.c (gtk_xface_instantiate): * glyphs-gtk.c (cursor_font_instantiate): * glyphs-gtk.c (gtk_redisplay_widget): * glyphs-gtk.c (gtk_widget_instantiate_1): * glyphs-gtk.c (gtk_add_tab_item): * glyphs-msw.c (mswindows_xpm_instantiate): * glyphs-msw.c (bmp_instantiate): * glyphs-msw.c (mswindows_resource_instantiate): * glyphs-msw.c (xbm_instantiate_1): * glyphs-msw.c (mswindows_xbm_instantiate): * glyphs-msw.c (mswindows_xface_instantiate): * glyphs-msw.c (mswindows_redisplay_widget): * glyphs-msw.c (mswindows_widget_instantiate): * glyphs-msw.c (add_tree_item): * glyphs-msw.c (add_tab_item): * glyphs-msw.c (mswindows_combo_box_instantiate): * glyphs-msw.c (mswindows_widget_query_string_geometry): * glyphs-x.c (x_locate_pixmap_file): * glyphs-x.c (xbm_instantiate_1): * glyphs-x.c (x_xbm_instantiate): * glyphs-x.c (extract_xpm_color_names): * glyphs-x.c (x_xpm_instantiate): * glyphs-x.c (x_xface_instantiate): * glyphs-x.c (autodetect_instantiate): * glyphs-x.c (safe_XLoadFont): * glyphs-x.c (cursor_font_instantiate): * glyphs-x.c (x_redisplay_widget): * glyphs-x.c (Fchange_subwindow_property): * glyphs-x.c (x_widget_instantiate): * glyphs-x.c (x_tab_control_redisplay): * glyphs.c (pixmap_to_lisp_data): * gui-x.c (menu_separator_style_and_to_external): * gui-x.c (add_accel_and_to_external): * gui-x.c (button_item_to_widget_value): * hpplay.c (player_error_internal): * hpplay.c (play_sound_file): * hpplay.c (play_sound_data): * intl.c (Fset_current_locale): * lisp.h: * menubar-gtk.c (gtk_xemacs_set_accel_keys): * menubar-msw.c (populate_menu_add_item): * menubar-msw.c (populate_or_checksum_helper): * menubar-x.c (menu_item_descriptor_to_widget_value_1): * nt.c (init_user_info): * nt.c (get_long_basename): * nt.c (nt_get_resource): * nt.c (init_mswindows_environment): * nt.c (get_cached_volume_information): * nt.c (mswindows_readdir): * nt.c (read_unc_volume): * nt.c (mswindows_stat): * nt.c (mswindows_getdcwd): * nt.c (mswindows_executable_type): * nt.c (Fmswindows_short_file_name): * ntplay.c (nt_play_sound_file): * objects-gtk.c: * objects-gtk.c (gtk_valid_color_name_p): * objects-gtk.c (gtk_initialize_font_instance): * objects-gtk.c (gtk_font_list): * objects-msw.c (font_enum_callback_2): * objects-msw.c (parse_font_spec): * objects-x.c (x_parse_nearest_color): * objects-x.c (x_valid_color_name_p): * objects-x.c (x_initialize_font_instance): * objects-x.c (x_font_instance_truename): * objects-x.c (x_font_list): * objects-xlike-inc.c (XFUN): * objects-xlike-inc.c (xft_find_charset_font): * process-nt.c (mswindows_report_winsock_error): * process-nt.c (nt_create_process): * process-nt.c (get_internet_address): * process-nt.c (nt_open_network_stream): * process-unix.c: * process-unix.c (allocate_pty): * process-unix.c (get_internet_address): * process-unix.c (unix_canonicalize_host_name): * process-unix.c (unix_open_network_stream): * realpath.c: * select-common.h (lisp_data_to_selection_data): * select-gtk.c (symbol_to_gtk_atom): * select-gtk.c (atom_to_symbol): * select-msw.c (symbol_to_ms_cf): * select-msw.c (mswindows_register_selection_data_type): * select-x.c (symbol_to_x_atom): * select-x.c (x_atom_to_symbol): * select-x.c (hack_motif_clipboard_selection): * select-x.c (Fx_store_cutbuffer_internal): * sound.c (Fplay_sound_file): * sound.c (Fplay_sound): * sound.h (sound_perror): * sysdep.c: * sysdep.c (qxe_allocating_getcwd): * sysdep.c (qxe_execve): * sysdep.c (copy_in_passwd): * sysdep.c (qxe_getpwnam): * sysdep.c (qxe_ctime): * sysdll.c (dll_open): * sysdll.c (dll_function): * sysdll.c (dll_variable): * sysdll.c (search_linked_libs): * sysdll.c (dll_error): * sysfile.h: * sysfile.h (PATHNAME_CONVERT_OUT_TSTR): * sysfile.h (PATHNAME_CONVERT_OUT_UTF_8): * sysfile.h (PATHNAME_CONVERT_OUT): * sysfile.h (LISP_PATHNAME_CONVERT_OUT): * syswindows.h (ITEXT_TO_TSTR): * syswindows.h (LOCAL_FILE_FORMAT_TO_TSTR): * syswindows.h (TSTR_TO_LOCAL_FILE_FORMAT): * syswindows.h (LOCAL_FILE_FORMAT_TO_INTERNAL_MSWIN): * syswindows.h (LISP_LOCAL_FILE_FORMAT_MAYBE_URL_TO_TSTR): * text.h: * text.h (eicpy_ext_len): * text.h (enum new_dfc_src_type): * text.h (EXTERNAL_TO_ITEXT): * text.h (GET_STRERROR): * tooltalk.c (check_status): * tooltalk.c (Fadd_tooltalk_message_arg): * tooltalk.c (Fadd_tooltalk_pattern_attribute): * tooltalk.c (Fadd_tooltalk_pattern_arg): * win32.c (tstr_to_local_file_format): * win32.c (mswindows_lisp_error_1): * win32.c (mswindows_report_process_error): * win32.c (Fmswindows_shell_execute): * win32.c (mswindows_read_link_1): Changes involving external/internal format conversion, mostly code cleanup and renaming. 1. Eliminate the previous macros like LISP_STRING_TO_EXTERNAL that stored its result in a parameter. The new version of LISP_STRING_TO_EXTERNAL returns its result through the return value, same as the previous NEW_LISP_STRING_TO_EXTERNAL. Use the new-style macros throughout the code. 2. Rename C_STRING_TO_EXTERNAL and friends to ITEXT_TO_EXTERNAL, in keeping with overall naming rationalization involving Itext and related types. Macros involved in previous two: EXTERNAL_TO_C_STRING -> EXTERNAL_TO_ITEXT EXTERNAL_TO_C_STRING_MALLOC -> EXTERNAL_TO_ITEXT_MALLOC SIZED_EXTERNAL_TO_C_STRING -> SIZED_EXTERNAL_TO_ITEXT SIZED_EXTERNAL_TO_C_STRING_MALLOC -> SIZED_EXTERNAL_TO_ITEXT_MALLOC C_STRING_TO_EXTERNAL -> ITEXT_TO_EXTERNAL C_STRING_TO_EXTERNAL_MALLOC -> ITEXT_TO_EXTERNAL_MALLOC LISP_STRING_TO_EXTERNAL LISP_STRING_TO_EXTERNAL_MALLOC LISP_STRING_TO_TSTR C_STRING_TO_TSTR -> ITEXT_TO_TSTR TSTR_TO_C_STRING -> TSTR_TO_ITEXT The following four still return their values through parameters, since they have more than one value to return: C_STRING_TO_SIZED_EXTERNAL -> ITEXT_TO_SIZED_EXTERNAL LISP_STRING_TO_SIZED_EXTERNAL C_STRING_TO_SIZED_EXTERNAL_MALLOC -> ITEXT_TO_SIZED_EXTERNAL_MALLOC LISP_STRING_TO_SIZED_EXTERNAL_MALLOC Sometimes additional casts had to be inserted, since the old macros played strange games and completely defeated the type system of the store params. 3. Rewrite many places where direct calls to TO_EXTERNAL_FORMAT occurred with calls to one of the convenience macros listed above, or to make_extstring(). 4. Eliminate SIZED_C_STRING macros (they were hardly used, anyway) and use a direct call to TO_EXTERNAL_FORMAT or TO_INTERNAL_FORMAT. 4. Use LISP_PATHNAME_CONVERT_OUT in many places instead of something like LISP_STRING_TO_EXTERNAL(..., Qfile_name). 5. Eliminate some temporary variables that are no longer necessary now that we return a value rather than storing it into a variable. 6. Some Mule-izing in database.c. 7. Error functions: -- A bit of code cleanup in maybe_signal_error_1. -- Eliminate report_file_type_error; it's just an alias for signal_error_2 with params in a different order. -- Fix some places in the hostname-handling code that directly inserted externally-retrieved error strings into the supposed ASCII "reason" param instead of doing the right thing and sticking text descriptive of what was going on in "reason" and putting the external message in a frob. 8. Use Ascbyte instead of CIbyte in process-unix.c and maybe one or two other places. 9. Some code cleanup in copy_in_passwd() in sysdep.c. 10. Fix a real bug due to accidental variable shadowing in tstr_to_local_file_format() in win32.c.
author Ben Wing <ben@xemacs.org>
date Fri, 05 Feb 2010 11:02:24 -0600
parents 3ff01259c4a2
children 3acaa0fc09be
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; info.el --- info package for Emacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 ;; Keywords: help
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (C) 1985, 1986, 1993, 1997 Free Software Foundation, Inc.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
5 ;; Copyright (C) 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Author: Dave Gillespie <daveg@synaptics.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Richard Stallman <rms@gnu.ai.mit.edu>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Maintainer: Dave Gillespie <daveg@synaptics.com>
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
10 ;; Version: diverged at version 1.07 of 7/22/93
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; Keywords: docs, help
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
26 ;; along with XEmacs; see the file COPYING. If not, write to the
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
30 ;;; Synched up with: Not synched with FSF. Highly divergent, and with
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
31 ;;; many new features added for XEmacs.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 ;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 ;; This is based on an early Emacs 19 info.el file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 ;; Note that Info-directory has been replaced by Info-directory-list,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 ;; a search path of directories in which to find Info files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 ;; Also, Info tries adding ".info" to a file name if the name itself
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;; is not found.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;;
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
42 ;; See the partial change log below for further details, and look into
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
43 ;; ChangeLog for the rest.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 ;; LCD Archive Entry:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 ;; info-dg|Dave Gillespie|daveg@synaptics.com
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 ;; |Info reader with many enhancements; replaces standard info.el.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 ;; |93-07-22|1.07|~/modes/info.el
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 ;; Also available from anonymous FTP on csvax.cs.caltech.edu.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 ;; Change Log:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 ;; Modified 3/7/1991 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 ;; (Author's address: daveg@synaptics.com or daveg@csvax.cs.caltech.edu)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 ;; Added keys: i, t, <, >, [, ], {, }, 6, 7, 8, 9, 0.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 ;; Look at help for info-mode (type ? in Info) for descriptions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 ;; If Info-directory-list is undefined and there is no INFOPATH
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 ;; in the environment, use value of Info-directory for compatibility
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ;; with Emacs 18.57.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 ;; All files named "localdir" found in the path are appended to "dir",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 ;; the Info directory. For this to work, "dir" should contain only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ;; one node (Top), and each "localdir" should contain no ^_ or ^L
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 ;; characters. Generally they will contain only one or several
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 ;; additional lines for the top-level menu. Note that "dir" is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 ;; modified in memory each time it is loaded, but not on disk.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 ;; If "dir" contains a line of the form: "* Locals:"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 ;; then the "localdir"s are inserted there instead of at the end.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 ;; Modified 4/3/1991 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 ;; Added Info-mode-hook (suggested by Sebastian Kremer).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 ;; Also added epoch-info-startup/select-hooks from Simon Spero's info.el.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 ;; Added automatic decoding of compressed Info files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 ;; See documentation for the variable Info-suffix-list. Default is to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 ;; run "uncompress" on ".Z" files and "unyabba" on ".Y" files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 ;; (See comp.sources.unix v24i073-076 for yabba/unyabba, a free software
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 ;; alternative to compress/uncompress.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 ;; Note: "dir" and "localdir" files should not be compressed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ;; Changed variables like Info-enable-edit to be settable by M-x set-variable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 ;; Added Info-auto-advance variable. If t, SPC and DEL will act like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 ;; } and {, i.e., they advance to the next/previous node if at the end
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 ;; of the buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 ;; Changed `u' to restore point to most recent location in that node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 ;; Added `=' to do this manually at any time. (Suggested by David Fox).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 ;; Changed `m' and `0-9' to try interpreting menu name as a file name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 ;; if not found as a node name. This allows (dir) menus of the form,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 ;; Emacs:: Cool text editor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 ;; as a shorthand for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 ;; Emacs:(emacs). Cool text editor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 ;; Enhanced `i' to use line-number information in the index.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 ;; Added `,' to move among all matches to a previous `i' command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 ;; Added `a' (Info-annotate) for adding personal notes to any Info node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 ;; Notes are not stored in the actual Info files, but in the user's own
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 ;; ~/.infonotes file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 ;; Added Info-footnote-tag, made default be "Ref" instead of "Note".
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 ;; Got mouse-click stuff to work under Emacs version 18. Check it out!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 ;; Left and right clicks scroll the Info window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 ;; Middle click goes to clicked-on node, e.g., "Next:", a menu, or a note.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 ;; Modified 6/29/1991 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 ;; Renamed epoch-info-startup/select-hooks to Info-startup/select-hook.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 ;; Made Info-select-node into a command on the `!' key.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 ;; Added Info-mouse-support user option.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 ;; Cleaned up the implementation of some routines.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 ;; Added special treatment of quoted words in annotations: The `g'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 ;; command for a nonexistent node name scans for an annotation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 ;; (in any node of any file) containing that name in quotes: g foo RET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 ;; looks for an annotation containing: "foo" or: <<foo>>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 ;; If found, it goes to that file and node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 ;; Added a call to set up Info-directory-list in Info-find-node to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 ;; work around a bug in GNUS where it calls Info-goto-node before info.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 ;; Added completion for `g' command (inspired by Richard Kim's infox.el).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 ;; Completion knows all node names for the current file, and all annotation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 ;; tags (see above). It does not complete file names or node names in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 ;; other files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 ;; Added `k' (Info-emacs-key) and `*' (Info-elisp-ref) commands. You may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 ;; wish to bind these to global keys outside of Info mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 ;; Allowed localdir files to be full dir-like files; only the menu part
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 ;; of each localdir is copied. Also, redundant menu items are omitted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 ;; Changed Info-history to hold only one entry at a time for each node,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 ;; and to be circular so that multiple `l's come back again to the most
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 ;; recent node. Note that the format of Info-history entries has changed,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 ;; which may interfere with external programs that try to operate on it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 ;; (Also inspired by Kim's infox.el).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 ;; Changed `n', `]', `l', etc. to accept prefix arguments to move several
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 ;; steps at once. Most accept negative arguments to move oppositely.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 ;; Changed `?' to bury *Help* buffer afterwards to keep it out of the way.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 ;; Rearranged `?' key's display to be a little better for new users.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 ;; Changed `a' to save whole window configuration and restore on C-c C-c.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 ;; Fixed the bug reported by Bill Reynolds on gnu.emacs.bugs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 ;; Changed Info-last to restore window-start as well as cursor position.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 ;; Changed middle mouse button in space after end of node to do Info-last
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 ;; if we got here by following a cross reference, else do Info-global-next.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 ;; Added some new mouse bindings: shift-left = Info-global-next,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 ;; shift-right = Info-global-prev, shift-middle = Info-last.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 ;; Fixed Info-follow-reference not to make assumptions about length
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 ;; of Info-footnote-tag [Linus Tolke].
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 ;; Changed default for Info-auto-advance mode to be press-twice-for-next-node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 ;; Modified x-mouse-ignore to preserve last-command variable, so that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 ;; press-twice Info-auto-advance mode works with the mouse.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 ;; Modified 3/4/1992 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 ;; Added an "autoload" command to help autoload.el.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 ;; Changed `*' command to look for file `elisp' as well as for `lispref'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 ;; Fixed a bug involving footnote names containing regexp special characters.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 ;; Fixed a bug in completion during `f' (or `r') command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 ;; Added TAB (Info-next-reference), M-TAB, and RET keys to Info mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 ;; Added new bindings, `C-h C-k' for Info-emacs-key and `C-h C-f' for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 ;; Info-elisp-ref. These bindings are made when info.el is loaded, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 ;; only if those key sequences were previously unbound. These bindings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 ;; work at any time, not just when Info is already running.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 ;; Modified 3/8/1992 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 ;; Fixed some long lines that were causing trouble with mailers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 ;; Modified 3/9/1992 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 ;; Added `C-h C-i' (Info-query).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 ;; Added Info-novice mode, warns if the user attempts to switch to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 ;; a different Info file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 ;; Fixed a bug that caused problems using compressed Info files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 ;; and Info-directory-list at the same time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 ;; Disabled Info-mouse-support by default if Epoch or Hyperbole is in use.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 ;; Added an expand-file-name call to Info-find-node to fix a small bug.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 ;; Modified 5/22/1992 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 ;; Added "standalone" operation: "emacs -f info" runs Emacs specifically
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 ;; for use as an Info browser. In this mode, the `q' key quits Emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 ;; itself. Also, "emacs -f info arg" starts in Info file "arg" instead
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 ;; of "dir".
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 ;; Changed to prefer "foo.info" over "foo". If both exist, "foo" is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 ;; probably a directory or executable program!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 ;; Made control-mouse act like regular-mouse does in other buffers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 ;; (In most systems, this will be set-cursor for left-mouse, x-cut
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 ;; for right-mouse, and x-paste, which will be an error, for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 ;; middle-mouse.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 ;; Improved prompting and searching for `,' key.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 ;; Fixed a bug where some "* Menu:" lines disappeared when "dir"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 ;; contained several nodes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 ;; Modified 9/10/1992 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 ;; Mixed in support for XEmacs. Mouse works the same as in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 ;; the other Emacs versions by default; added Info-lucid-mouse-style
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 ;; variable, which enables mouse operation similar to XEmacs's default.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 ;; Fixed a bug where RET couldn't understand "* Foo::" if "Foo" was a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 ;; file name instead of a node name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 ;; Added `x' (Info-bookmark), a simple interface to the annotation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 ;; tags feature. Added `j' (Info-goto-bookmark), like `g' but only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 ;; completes bookmarks.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 ;; Added `<<tag>>' as alternate to `"tag"' in annotations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 ;; Added `v' (Info-visit-file), like Info-goto-node but specialized
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 ;; for going to a new Info file (with file name completion).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 ;; Added recognition of gzip'd ".z" files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 ;; Modified 5/9/1993 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 ;; Merged in various things from FSF's latest Emacs 19 info.el.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 ;; Modified 6/2/1993 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 ;; Changed to use new suffix ".gz" for gzip files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 ;; Modified 7/22/1993 by Dave Gillespie:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 ;; Changed Info-footnote-tag to "See" instead of "Ref".
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 ;; Extended Info-fontify-node to work with FSF version of Emacs 19.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 ;; Modified 7/30/1993 by Jamie Zawinski:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 ;; Commented out the tty and fsf19 mouse support, because why bother.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 ;; Commented out the politically incorrect version of XEmacs mouse support.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 ;; Commented out mouse scrolling bindings because the party line on that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 ;; is "scrollbars are coming soon."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 ;; Commented out munging of help-for-help's doc; put it in help.el.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 ;; Did Info-edit-map the modern XEmacs way.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 ;; Pruned extra cruft from fontification and mouse handling code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 ;; Fixed ASCII-centric bogosity in unreading of events.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 ;; Modified 8/11/95 by Chuck Thompson:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 ;; Removed any pretense of ever referencing Info-directory since it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 ;; wasn't working anyhow.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 ;; Modified 4/5/97 by Tomasz J. Cholewo:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 ;; Modified Info-search to use with-caps-disable-folding
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 ;; Modified 6/21/97 by Hrvoje Niksic
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 ;; Fixed up Info-next-reference to work sanely when n < 0.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 ;; Added S-tab binding.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 ;; Modified 1997-07-10 by Karl M. Hegbloom
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 ;; Added `Info-minibuffer-history'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 ;; (also added to defaults in "lisp/utils/savehist.el")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 ;; Other changes in main ChangeLog.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 ;; Modified 1998-03-29 by Oscar Figueiredo
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 ;; Added automatic dir/localdir (re)building capability for directories that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 ;; contain none or when it has become older than info files in the same
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 ;; directory.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
314 ;; Modified 1998-09-23 by Didier Verna <didier@xemacs.org>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 ;; Use the new macro `with-search-caps-disable-folding'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 ;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 (eval-when-compile
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 (condition-case nil (require 'browse-url) (error nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 (defgroup info nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 "The info package for Emacs."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 :group 'help
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 :group 'docs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 (defgroup info-faces nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 "The faces used by info browser."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 :group 'info
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 :group 'faces)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 (defcustom Info-inhibit-toolbar nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 "*Non-nil means don't use the specialized Info toolbar."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 (defcustom Info-novice nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 "*Non-nil means to ask for confirmation before switching Info files."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 (defvar Info-history nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 "List of info nodes user has visited.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 Each element of list is a list (\"(FILENAME)NODENAME\" BUFPOS WINSTART).")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 (defvar Info-keeping-history t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 "Non-nil if Info-find-node should modify Info-history.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 This is for use only by certain internal Info routines.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 (defvar Info-minibuffer-history nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 "Minibuffer history for Info.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 (defcustom Info-enable-edit nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 "*Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 can edit the current node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 This is convenient if you want to write info files by hand.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 However, we recommend that you not do this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 It is better to write a Texinfo file and generate the Info file from that,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 because that gives you a printed manual as well."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 (defcustom Info-enable-active-nodes t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 "*Non-nil allows Info to execute Lisp code associated with nodes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 The Lisp code is executed when the node is selected."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 (defcustom Info-restoring-point t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 "*Non-nil means to restore the cursor position when re-entering a node."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 (defcustom Info-auto-advance 'twice
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 "*Control what SPC and DEL do when they can't scroll any further.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 If nil, they beep and remain in the current node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 If t, they move to the next node (like Info-global-next/prev).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 If anything else, they must be pressed twice to move to the next node."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 :type '(choice (const :tag "off" nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 (const :tag "advance" t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 (const :tag "confirm" twice))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 (defcustom Info-fontify t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 "*Non-nil enables font features in XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 This variable is ignored unless running under XEmacs."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 (defcustom Info-additional-search-directory-list nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 "*List of additional directories to search for Info documentation
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 files. These directories are not searched for merging the `dir'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 file. An example might be something like:
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 1870
diff changeset
395 \"/usr/local/lib/xemacs/xemacs-packages/lisp/calc/\""
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 :type '(repeat directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398
723
a65ddffa00a5 [xemacs-hg @ 2002-01-04 19:53:32 by adrian]
adrian
parents: 548
diff changeset
399 (defcustom Info-auto-generate-directory 'if-outdated
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 "*When to auto generate an info directory listing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 Possible values are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 nil or `never' never auto-generate a directory listing,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 use any existing `dir' or `localdir' file and ignore info
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 directories containing none
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 `always' auto-generate a directory listing ignoring existing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 `dir' and `localdir' files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 `if-missing', the default, auto-generates a directory listing
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
408 if no `dir' or `localdir' file is present. Otherwise the
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 contents of any of these files is used instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 `if-outdated' auto-generates a directory listing if the `dir'
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
411 and `localdir' are either inexistent or outdated (touched
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 less recently than an info file in the same directory)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 :type '(choice (const :tag "never" never)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 (const :tag "always" always)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 (const :tag "if-missing" if-missing)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 (const :tag "if-outdated" if-outdated))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
419 (defcustom Info-save-auto-generated-dir 'never
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 "*Whether an auto-generated info directory listing should be saved.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 Possible values are:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
422 nil or `never', the default, auto-generated info directory
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 information will never be saved.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 `always', auto-generated info directory information will be saved to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 a `dir' file in the same directory overwriting it if it exists
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 `conservative', auto-generated info directory information will be saved
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
427 to a `dir' file in the same directory but the user is asked before
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 overwriting any existing file."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 :type '(choice (const :tag "never" never)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 (const :tag "always" always)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 (const :tag "conservative" conservative))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
434 (defconst Info-emacs-info-file-name "xemacs.info"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
435 "The filename of the XEmacs info for `Info-goto-emacs-command-node'
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
436 (`\\<help-mode-map>\\[Info-goto-emacs-command-node]')")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 (defvar Info-directory-list nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 "List of directories to search for Info documentation files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 The first directory in this list, the \"dir\" file there will become
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
443 the (dir)Top node of the Info documentation tree.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
444
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
445 Note: DO NOT use the `customize' interface to change the value of this
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
446 variable. Its value is created dynamically on each startup, depending
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
447 on XEmacs packages installed on the system. If you want to change the
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
448 search path, make the needed modifications on the variable's value
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
449 from .emacs. For instance:
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
450
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
451 (setq Info-directory-list (cons \"~/info\" Info-directory-list))")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
453 ;; This could as well be hard-coded since ${srcdir}/info/dir is in CVS --dv
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
454 (defconst Info-localdir-heading-regexp "^Local Packages:$"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 "The menu part of localdir files will be inserted below this topic
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
456 heading.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 (defface info-node '((t (:bold t :italic t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 "Face used for node links in info."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 :group 'info-faces)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 (defface info-xref '((t (:bold t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 "Face used for cross-references in info."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 :group 'info-faces)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
466 ;; This list is based on Karl Berry-s advice about extensions `info' itself
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
467 ;; might encounter. --dv
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
468 (defcustom Info-suffix-list '(("" . nil)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
469 (".info" . nil)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
470 (".gz" . "gzip -dc %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
471 (".info.gz" . "gzip -dc %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
472 (".z" . "gzip -dc %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
473 (".info.z" . "gzip -dc %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
474 (".bz2" . "bzip2 -dc %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
475 (".info.bz2" . "bzip2 -dc %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
476 (".Z" . "uncompress -c %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
477 (".info.Z" . "uncompress -c %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
478 (".zip" . "unzip -c %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
479 (".info.zip" . "unzip -c %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
480 (".y" . "cat %s | unyabba")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
481 ("info.y" . "cat %s | unyabba")
4409
3ff01259c4a2 Support LZMA compression in info.el.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3693
diff changeset
482 ;; Mandriva Linux uses lzma.
3ff01259c4a2 Support LZMA compression in info.el.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3693
diff changeset
483 (".lzma" . "unlzma --stdout %s")
3ff01259c4a2 Support LZMA compression in info.el.
Aidan Kehoe <kehoea@parhasard.net>
parents: 3693
diff changeset
484 (".info.lzma" . "unlzma --stdout %s")
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
485 ;; These ones are for MS-DOS filenames.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
486 (".inf" . nil)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
487 (".igz" . "gzip -dc %s")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
488 (".inz" . "gzip -c %s"))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
489 "*List of file name suffixes and associated decoding commands.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 Each entry should be (SUFFIX . STRING); if STRING contains %s, that is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 changed to name of the file to decode, otherwise the file is given to
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
492 the command as standard input. If STRING is nil, no decoding is done."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
493 :type '(repeat (cons (string :tag "suffix")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
494 (choice :tag "command"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
495 (const :tag "none" :value nil)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
496 (string :tag ""))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
497 :group 'info)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
499 (defcustom Info-footnote-tag "Note"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 "*Symbol that identifies a footnote or cross-reference.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
501 All \"*Note\" references will be changed to use this word instead."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
502 :type 'string
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
503 :group 'info)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 (defvar Info-current-file nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 "Info file that Info is now looking at, or nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 This is the name that was specified in Info, not the actual file name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 It doesn't contain directory names or file name extensions added by Info.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 (defvar Info-current-subfile nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 "Info subfile that is actually in the *info* buffer now,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 or nil if current info file is not split into subfiles.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 (defvar Info-current-node nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 "Name of node that Info is now looking at, or nil.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
517 (defvar Info-tag-table-marker nil
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 "Marker pointing at beginning of current Info file's tag table.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 Marker points nowhere if file has no tag table.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
521 (defvar Info-tag-table-buffer nil)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
522
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 (defvar Info-current-file-completions nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 "Cached completion list for current Info file.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 (defvar Info-current-annotation-completions nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 "Cached completion list for current annotation files.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 (defvar Info-index-alternatives nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 "List of possible matches for last Info-index command.")
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
531
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 (defvar Info-index-first-alternative nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 (defcustom Info-annotations-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 (list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 (paths-construct-path (list user-init-directory "info.notes"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 (paths-construct-path '("~" ".infonotes"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 (paths-construct-path '("usr" "lib" "info.notes")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 (char-to-string directory-sep-char)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 "*Names of files that contain annotations for different Info nodes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 By convention, the first one should reside in your personal directory.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 The last should be a world-writable \"public\" annotations file."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 :type '(repeat file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 (defcustom Info-button1-follows-hyperlink nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 "*Non-nil means mouse button1 click will follow hyperlink."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 :group 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 (defvar Info-standalone nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 "Non-nil if Emacs was started solely as an Info browser.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 (defvar Info-in-cross-reference nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 (defvar Info-window-configuration nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 (defvar Info-dir-prologue "-*- Text -*-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 This is the file .../info/dir, which contains the topmost node of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 Info hierarchy. The first time you invoke Info you start off
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 looking at that node, which is (dir)Top.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 File: dir Node: Top This is the top of the INFO tree
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
563 This (the Directory node) gives a menu of major topics.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 * Menu: The list of major topics begins on the next line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
569 (defcustom Info-no-description-string "[No description available]"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
570 "*Description string for info files that have none"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
571 :type 'string
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
572 :group 'info)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 (defun info (&optional file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 "Enter Info, the documentation browser.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 Optional argument FILE specifies the file to examine;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 the default is the top-level directory of Info.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579
1425
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
580 Called from a program, FILE may specify an Info node of the form
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
581 `(FILENAME)NODENAME'.
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
582
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 In interactive use, a prefix argument directs this command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 to read a file name from the minibuffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 (interactive (if current-prefix-arg
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 (list (read-file-name "Info file name: " nil nil t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 (let ((p command-line-args))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 (while p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 (and (string-match "^-[fe]" (car p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 (equal (nth 1 p) "info")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 (not Info-standalone)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 (setq Info-standalone t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 (= (length p) 3)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 (not (string-match "^-" (nth 2 p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 (setq file (nth 2 p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 (setq command-line-args-left nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 (setq p (cdr p))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 ; (Info-setup-x) ??? What was this going to be? Can anyone tell karlheg?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 (if file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 (unwind-protect
1425
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
601 (progn
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
602 (pop-to-buffer "*info*")
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
603 ;; If argument already contains parentheses, don't add another set
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
604 ;; since the argument will then be parsed improperly. This also
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
605 ;; has the added benefit of allowing node names to be included
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
606 ;; following the parenthesized filename.
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
607 (if (and (stringp file) (string-match "(.*)" file))
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
608 (Info-goto-node file)
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1232
diff changeset
609 (Info-goto-node (concat "(" file ")"))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 (and Info-standalone (info)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 (if (get-buffer "*info*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 (switch-to-buffer "*info*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 (Info-directory))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 (defun Info-query (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 "Enter Info, the documentation browser. Prompt for name of Info file."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618 (interactive "sInfo topic (default = menu): ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 (info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 (if (equal file "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 (Info-goto-node "(dir)")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 (Info-goto-node (concat "(" file ")"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 (defun Info-setup-initial ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 (let ((f Info-annotations-path))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 (while f
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 (if (and (file-exists-p (car f)) (not (get-file-buffer (car f))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 (bury-buffer (find-file-noselect (car f))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 (setq f (cdr f)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
631 ;;;###autoload
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 (defun Info-find-node (filename &optional nodename no-going-back tryfile line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 "Go to an info node specified as separate FILENAME and NODENAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 Look for a plausible filename, or if not found then look for URL's and
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
635 dispatch to the appropriate fn. NO-GOING-BACK is non-nil if recovering
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
636 from an error in this function; it says do not attempt further (recursive)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
637 error recovery. TRYFILE indicates that NODENAME might actually be a
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
638 filename, so if we can't find a node of this name, try going to the `Top'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
639 node of a file of this name."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 (Info-setup-initial)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 ;; empty filename is simple case
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 ((null filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 (Info-find-file-node nil nodename no-going-back tryfile line))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 ;; Convert filename to lower case if not found as specified.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 ;; Expand it, look harder...
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
649 ((let ((fname (substitute-in-file-name filename))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
650 temp found)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 (let ((dirs (cond
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
652 ;; If specified name starts with `./', then just try
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
653 ;; current directory. No point in searching for an absolute
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
654 ;; file name
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
655 ((string-match "^\\./" fname)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
656 (list default-directory))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 ((file-name-absolute-p fname)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
658 '(nil))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 (Info-additional-search-directory-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 (append Info-directory-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 Info-additional-search-directory-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 (t Info-directory-list))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 ;; Search the directory list for file FNAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 (while (and dirs (not found))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 (setq temp (expand-file-name fname (car dirs)))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
666 (setq found (Info-suffixed-file temp))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 (setq dirs (cdr dirs)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
668 (if found
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 (progn (setq filename (expand-file-name found))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 (Info-find-file-node filename nodename no-going-back tryfile line))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 ;; Look for a URL. This pattern is stolen from w3.el to prevent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 ;; loading it if we won't need it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 ((string-match (concat "^\\(wais\\|solo\\|x-exec\\|newspost\\|www\\|"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 "mailto\\|news\\|tn3270\\|ftp\\|http\\|file\\|"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 "telnet\\|gopher\\):")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 filename)
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
678 (if-fboundp 'browse-url
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 (browse-url filename)
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
680 (error 'unimplemented "no `browse-url' package; Cannot follow URLs in this XEmacs")))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 (error "Info file %s does not exist" filename))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 (defun Info-find-file-node (filename nodename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 &optional no-going-back tryfile line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 ;; This is the guts of what was Info-find-node. Whoever wrote this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 ;; should be locked up where they can't do any more harm.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 ;; Go into info buffer.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
690 (or (eq major-mode 'Info-mode)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
691 (switch-to-buffer "*info*"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 (buffer-disable-undo (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 (run-hooks 'Info-startup-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 (or (eq major-mode 'Info-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 (Info-mode))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 (or (null filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 (equal Info-current-file filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 (not Info-novice)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 (string= "dir" (file-name-nondirectory Info-current-file))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
700 (if (y-or-n-p
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 (format "Leave Info file `%s'? "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 (file-name-nondirectory Info-current-file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 (message "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 (keyboard-quit)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 ;; Record the node we are leaving.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 (if (and Info-current-file (not no-going-back))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 (Info-history-add Info-current-file Info-current-node (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 (widen)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 (setq Info-current-node nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 Info-in-cross-reference nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 ;; Switch files if necessary
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 (or (null filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 (equal Info-current-file filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 (let ((buffer-read-only nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 (setq Info-current-file nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 Info-current-subfile nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 Info-current-file-completions nil
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
720 ;; Nooooooooooo! Info-index can extend across more
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
721 ;; than one file (e.g. XEmacs, Lispref)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
722 ;; Info-index-alternatives nil
3693
3b847cba6d71 [xemacs-hg @ 2006-11-22 02:20:20 by stephent]
stephent
parents: 3625
diff changeset
723 buffer-file-name nil
3b847cba6d71 [xemacs-hg @ 2006-11-22 02:20:20 by stephent]
stephent
parents: 3625
diff changeset
724 buffer-file-truename nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 (if (string= "dir" (file-name-nondirectory filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 (Info-insert-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 (Info-insert-file-contents filename t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 (setq default-directory (file-name-directory filename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 ;; See whether file has a tag table. Record the location if yes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 (set-marker Info-tag-table-marker nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 (forward-line -8)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 (or (equal nodename "*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 (not (search-forward "\^_\nEnd tag table\n" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 (let (pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 ;; We have a tag table. Find its beginning.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 ;; Is this an indirect file?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 (search-backward "\nTag table:\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 (setq pos (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 (if (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 (forward-line 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 (looking-at "(Indirect)\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 ;; It is indirect. Copy it to another buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 ;; and record that the tag table is in that buffer.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
747 (let ((buf (current-buffer))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
748 (m Info-tag-table-marker))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
749 (or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
750 Info-tag-table-buffer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
751 (setq
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
752 Info-tag-table-buffer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
753 (generate-new-buffer " *info tag table*")))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
754 (save-excursion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
755 (set-buffer Info-tag-table-buffer)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
756 (buffer-disable-undo (current-buffer))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
757 (setq case-fold-search t)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
758 (erase-buffer)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
759 (insert-buffer-substring buf)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
760 (set-marker m (match-end 0))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 (set-marker Info-tag-table-marker pos))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 (setq Info-current-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 (file-name-sans-versions buffer-file-name))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 (if (equal nodename "*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 (progn (setq Info-current-node nodename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 (Info-set-mode-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 (goto-char (point-min)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 ;; Search file for a suitable node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 (let* ((qnode (regexp-quote nodename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 (regexp (concat "Node: *" qnode " *[,\t\n\177]"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 (guesspos (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 (found t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 ;; First get advice from tag table if file has one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 ;; Also, if this is an indirect info file,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 ;; read the proper subfile into this buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 (if (marker-position Info-tag-table-marker)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
777 (let (foun found-mode (m Info-tag-table-marker))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
778 (save-excursion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
779 (set-buffer (marker-buffer Info-tag-table-marker))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
780 (goto-char m)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
781 (setq foun (re-search-forward regexp nil t))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
782 (if foun
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
783 (setq guesspos (read (current-buffer))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
784 (setq found-mode major-mode))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
785 (if foun
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
786 ;; If this is an indirect file,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
787 ;; determine which file really holds this node
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
788 ;; and read it in.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
789 (if (not (eq major-mode found-mode))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
790 (setq guesspos
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
791 (Info-read-subfile guesspos))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 (goto-char (max (point-min) (- guesspos 1000)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 ;; Now search from our advised position (or from beg of buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 ;; to find the actual node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 (catch 'foo
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 (while (search-forward "\n\^_" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 (let ((beg (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 (if (re-search-backward regexp beg t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 (throw 'foo t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 (setq found nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 (let ((bufs (delq nil (mapcar 'get-file-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 Info-annotations-path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 (pattern (if (string-match "\\`<<.*>>\\'" qnode) qnode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 (format "\"%s\"\\|<<%s>>" qnode qnode)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 (pat2 (concat "------ *File: *\\([^ ].*[^ ]\\) *Node: "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 "*\\([^ ].*[^ ]\\) *Line: *\\([0-9]+\\)"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 (afile nil) anode aline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 (while (and bufs (not anode))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 (set-buffer (car bufs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 (if (re-search-forward pattern nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 (if (re-search-backward pat2 nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 (setq afile (buffer-substring (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 anode (buffer-substring (match-beginning 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 (match-end 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 aline (string-to-int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 (buffer-substring (match-beginning 3)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 (match-end 3)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 (setq bufs (cdr bufs)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 (if anode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 (Info-find-node afile anode t nil aline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 (if tryfile
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 (condition-case nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 (Info-find-node nodename "Top" t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 (error nil)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 (or Info-current-node
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 (error "No such node: %s" nodename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 (if found
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 (Info-select-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 (if line (forward-line line)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 ;; If we did not finish finding the specified node,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 ;; go back to the previous one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 (or Info-current-node no-going-back
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 (let ((hist (car Info-history)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 ;; The following is no longer safe with new Info-history system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 ;; (setq Info-history (cdr Info-history))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 (Info-goto-node (car hist) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 (goto-char (+ (point-min) (nth 1 hist)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 ;; Cache the contents of the (virtual) dir file, once we have merged
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 ;; it for the first time, so we can save time subsequently.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 (defvar Info-dir-contents nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 ;; Cache for the directory we decided to use for the default-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 ;; of the merged dir text.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 (defvar Info-dir-contents-directory nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 ;; Record the file attributes of all the files from which we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 ;; constructed Info-dir-contents.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 (defvar Info-dir-file-attributes nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 (defun Info-insert-dir ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 "Construct the Info directory node by merging the files named
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
860 \"dir\" or \"localdir\" from the directories in `Info-directory-list'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 The \"dir\" files will take precedence in cases where both exist. It
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 sets the *info* buffer's `default-directory' to the first directory we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 actually get any text from."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 (if (and Info-dir-contents Info-dir-file-attributes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 ;; Verify that none of the files we used has changed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 ;; since we used it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 (eval (cons 'and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 (mapcar #'(lambda (elt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 (let ((curr (file-attributes (car elt))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 ;; Don't compare the access time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 (if curr (setcar (nthcdr 4 curr) 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 (setcar (nthcdr 4 (cdr elt)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 (equal (cdr elt) curr)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 Info-dir-file-attributes))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 (insert Info-dir-contents)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 (let ((dirs (reverse Info-directory-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 buffers lbuffers buffer others nodes dirs-done)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 (setq Info-dir-file-attributes nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 ;; Search the directory list for the directory file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 (while dirs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 (let ((truename (file-truename (expand-file-name (car dirs)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 (or (member truename dirs-done)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 (member (directory-file-name truename) dirs-done)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
886 ;; Karl Berry recently added the ability all possibilities for
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
887 ;; extension as for normal info files. This code however is
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
888 ;; still unsatisfactory: if one day, we find a compressed dir
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
889 ;; file (which looks possible), we should be able to handle it
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
890 ;; (which means decompress and read it, update it, save and
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
891 ;; recompress it). --dv
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
892 (let ((trials '("dir" "DIR"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
893 "dir.info" "DIR.INFO"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
894 "dir.inf" "DIR.INF"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
895 "localdir" "LOCALDIR"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
896 "localdir.info" "LOCALDIR.INFO"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
897 "localdir.inf" "LOCALDIR.INF"))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
898 buf file attrs)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
899 (catch 'found
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
900 (while (setq file (pop trials))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
901 (setq file (expand-file-name file truename))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
902 (and (setq attrs (file-attributes file))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
903 (throw 'found t))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
904 (unless file
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
905 (setq file (expand-file-name "dir" truename)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 (setq dirs-done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 (cons truename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 (cons (directory-file-name truename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 dirs-done)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 (Info-maybe-update-dir file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 (setq attrs (file-attributes file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 (if (or (setq buf (find-buffer-visiting file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 attrs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 (or buffers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 (message "Composing main Info directory..."))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 (set-buffer (or buf
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 (generate-new-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 (if (string-match "localdir" file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 "localdir"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 "info dir"))))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
922 (if (not buf)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 (insert-file-contents file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 (if (string-match "localdir" (buffer-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 (setq lbuffers (cons (current-buffer) lbuffers))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 (setq buffers (cons (current-buffer) buffers)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 (if attrs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 (setq Info-dir-file-attributes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 (cons (cons file attrs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 Info-dir-file-attributes)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 (or (cdr dirs) (setq Info-dir-contents-directory (car dirs)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 (setq dirs (cdr dirs))))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
933
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 ;; ensure that the localdir files are inserted last, and reverse
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 ;; the list of them so that when they get pushed in, they appear
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 ;; in the same order they got specified in the path, from top to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 ;; bottom.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 (nconc buffers (reverse lbuffers))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
939
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 (or buffers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 (error "Can't find the Info directory node"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 ;; Distinguish the dir file that comes with Emacs from all the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 ;; others. Yes, that is really what this is supposed to do.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 ;; If it doesn't work, fix it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 (setq buffer (car buffers)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 ;; reverse it since they are pushed down from the top. the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 ;; `Info-directory-list can be specified in natural order
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 ;; this way.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 others (reverse (cdr buffers)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 ;; Insert the entire original dir file as a start; note that we've
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 ;; already saved its default directory to use as the default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 ;; directory for the whole concatenation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 (insert-buffer buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 ;; Look at each of the other buffers one by one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 (while others
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 (let ((other (car others))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 (info-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 (if (string-match "localdir" (buffer-name other))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962 (set-buffer info-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 ((re-search-backward "^ *\\* *Locals *: *$" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 (delete-region (match-beginning 0) (match-end 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 ;; look for a line like |Local XEmacs packages:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 ;; or mismatch on some text ...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 ((re-search-backward Info-localdir-heading-regexp nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 ;; This is for people who underline topic headings with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 ;; equal signs or dashes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 (when (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 (looking-at "^[ \t]*[-=*]+"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 (forward-line 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 (beginning-of-line))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 (t (search-backward "\^L" nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 ;; Insert menu part of the file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 (let* ((pt (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 (len (length (buffer-string nil nil other))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 (insert (buffer-string nil nil other))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 (goto-char (+ pt len))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 (goto-char pt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 (if (search-forward "* Menu:" (+ pt len) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 (delete-region pt (point)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 ;; In each, find all the menus.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 (set-buffer other)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 ;; Find each menu, and add an elt to NODES for it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 (while (re-search-forward "^\\* Menu:" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 (let (beg nodename end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 (setq beg (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 (search-backward "\n\^_")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 (search-forward "Node: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 (setq nodename (Info-following-node-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 (search-forward "\n\^_" nil 'move)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 (setq end (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 (setq nodes (cons (list nodename other beg end) nodes))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 (setq others (cdr others))))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1008
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 ;; Add to the main menu a menu item for each other node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 (re-search-forward "^\\* Menu:" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 (let ((menu-items '("top"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 (nodes nodes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 (case-fold-search t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 (end (save-excursion (search-forward "\^_" nil t) (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 (while nodes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 (let ((nodename (car (car nodes))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 (or (member (downcase nodename) menu-items)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 (re-search-forward (concat "^\\* "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 (regexp-quote nodename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 "::")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 end t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 (insert "* " nodename "::" "\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 (setq menu-items (cons nodename menu-items))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 (setq nodes (cdr nodes))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 ;; Now take each node of each of the other buffers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 ;; and merge it into the main buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 (while nodes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 (let ((nodename (car (car nodes))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 ;; Find the like-named node in the main buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 (if (re-search-forward (concat "\n\^_.*\n.*Node: "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 (regexp-quote nodename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 "[,\n\t]")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 (search-forward "\n\^_" nil 'move)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 (insert "\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 ;; If none exists, add one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 (insert "\^_\nFile: dir\tNode: " nodename "\n\n* Menu:\n\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 ;; Merge the text from the other buffer's menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 ;; into the menu in the like-named node in the main buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 (apply 'insert-buffer-substring (cdr (car nodes))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 (setq nodes (cdr nodes)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 ;; Kill all the buffers we just made.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 (while buffers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 (kill-buffer (car buffers))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 (setq buffers (cdr buffers)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 (while lbuffers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 (kill-buffer (car lbuffers))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 (setq lbuffers (cdr lbuffers)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 (message "Composing main Info directory...done"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 (setq Info-dir-contents (buffer-string)))
1232
c08a6fa181d1 [xemacs-hg @ 2003-01-23 11:38:56 by stephent]
stephent
parents: 830
diff changeset
1058 (setq default-directory (file-name-as-directory Info-dir-contents-directory))
3693
3b847cba6d71 [xemacs-hg @ 2006-11-22 02:20:20 by stephent]
stephent
parents: 3625
diff changeset
1059 (setq buffer-file-name (caar Info-dir-file-attributes)
3b847cba6d71 [xemacs-hg @ 2006-11-22 02:20:20 by stephent]
stephent
parents: 3625
diff changeset
1060 buffer-file-truename (file-truename buffer-file-name)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1062 (defmacro Info-directory-files (dir-file &optional all full nosort files-only)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1063 "Return a list of Info files living in the same directory as DIR-FILE.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1064 This list actually contains the files living in this directory, except for
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1065 the dir file itself and the secondary info files (foo-1 foo-2 etc).
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1066
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1067 If the optional argument ALL is non nil, the secondary info files are also
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1068 included in the list.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1069
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1070 Please refer to the function `directory-files' for the meaning of the other
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1071 optional arguments."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1072 `(let* ((dir (file-name-directory ,dir-file))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1073 (all-files (remove ,dir-file (directory-files dir ',full nil ',nosort
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1074 ',files-only))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1075 (setq all-files
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1076 (if ,full
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1077 (remove (concat dir ".")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1078 (remove (concat dir "..") all-files))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1079 (remove "."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1080 (remove ".." all-files))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1081 (if ,all
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1082 all-files
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1083 (let ((suff-match
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1084 (concat "-[0-9]+\\("
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1085 ;; Extract all known compression suffixes from
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1086 ;; Info-suffix-list. These suffixes can typically be
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1087 ;; found in entries of the form `.info.something'.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1088 (let ((suff-list Info-suffix-list)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1089 suff regexp)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1090 (while (setq suff (pop suff-list))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1091 (and (string-match "^\\.info" (car suff))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1092 (setq regexp (concat regexp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1093 (regexp-quote
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1094 (substring
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1095 (car suff) 5))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1096 (and suff-list "\\|")))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1097 regexp)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1098 "\\)?$"))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1099 info-files file)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1100 (while (setq file (pop all-files))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1101 (or (string-match suff-match file)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1102 (push file info-files)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1103 (reverse info-files)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1104 ))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1105 ))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1106
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 (defun Info-maybe-update-dir (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 "Rebuild dir or localdir according to `Info-auto-generate-directory'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 (unless (or (not (file-exists-p (file-name-directory file)))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1110 (null (Info-directory-files file 'all)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 (if (not (find-buffer-visiting file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 (if (not (file-exists-p file))
747
9f953fdc1394 [xemacs-hg @ 2002-02-11 12:43:21 by michaels]
michaels
parents: 723
diff changeset
1113 (if (or (memq Info-auto-generate-directory
9f953fdc1394 [xemacs-hg @ 2002-02-11 12:43:21 by michaels]
michaels
parents: 723
diff changeset
1114 '(always if-missing if-outdated)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 (Info-build-dir-anew (file-name-directory file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 (if (or (eq Info-auto-generate-directory 'always)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 (and (eq Info-auto-generate-directory 'if-outdated)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 (Info-dir-outdated-p file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 (Info-rebuild-dir file))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 ;; Record which *.info files are newer than the dir file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 (defvar Info-dir-newer-info-files nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 (defun Info-dir-outdated-p (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 "Return non-nil if dir or localdir is outdated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 dir or localdir are outdated when an info file in the same
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 directory has been modified more recently."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 (let ((dir-mod-time (nth 5 (file-attributes file)))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1129 f-mod-time newer)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 (setq Info-dir-newer-info-files nil)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1131 (mapcar
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 #'(lambda (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 (prog2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 (setq f-mod-time (nth 5 (file-attributes f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 (setq newer (or (> (car f-mod-time) (car dir-mod-time))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 (and (= (car f-mod-time) (car dir-mod-time))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1137 (> (car (cdr f-mod-time))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1138 (car (cdr dir-mod-time))))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1139 (if (and (file-readable-p f) newer)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1140 (setq Info-dir-newer-info-files
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 (cons f Info-dir-newer-info-files)))))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1142 (Info-directory-files file nil 'fullname 'nosort t))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 Info-dir-newer-info-files))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 (defun Info-extract-dir-entry-from (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 "Extract the dir entry from the info FILE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 The dir entry is delimited by the markers `START-INFO-DIR-ENTRY'
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1148 and `END-INFO-DIR-ENTRY'."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 (set-buffer (get-buffer-create " *Info-tmp*"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 (when (file-readable-p file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 (insert-file-contents file nil nil nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 (let (beg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 (unless (null (re-search-forward "^START-INFO-DIR-ENTRY" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 (setq beg (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 (unless (null (re-search-forward "^END-INFO-DIR-ENTRY" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 (goto-char (match-beginning 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 (car (Info-parse-dir-entries beg (point)))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1162 ;; Parse dir entries contained between START and END into a list of the form
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 ;; (filename topic node (description-line-1 description-line-2 ...))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1164 (defun Info-parse-dir-entries (start end)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 (let (entry entries)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 (save-restriction
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1168 (narrow-to-region start end)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1169 (goto-char start)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1170 (while (re-search-forward
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1171 "^\\* \\([^:]+\\):\\([ \t]*(\\([^)]*\\))\\w*\\.\\|:\\)" nil t)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 (setq entry (list (match-string 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 (match-string 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 (downcase (or (match-string 3)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 (match-string 1)))))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1176 (setq entry
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1177 (cons (nreverse
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1178 (cdr
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1179 (nreverse
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1180 (split-string
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1181 (buffer-substring
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 (re-search-forward "[ \t]*" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 (or (and (re-search-forward "^[^ \t]" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 (goto-char (match-beginning 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185 (point-max)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 "[ \t]*\n[ \t]*"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 entry))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 (setq entries (cons (nreverse entry) entries)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 (nreverse entries)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 (defun Info-dump-dir-entries (entries)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 (let ((tab-width 8)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 (description-col 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 len)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 (mapcar #'(lambda (e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 (setq e (cdr e)) ; Drop filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 (setq len (length (concat (car e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 (car (cdr e)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 (if (> len description-col)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 (setq description-col len)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201 entries)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1202 (setq description-col (+ 5 description-col))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 (mapcar #'(lambda (e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204 (setq e (cdr e)) ; Drop filename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 (insert "* " (car e) ":" (car (cdr e)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 (setq e (car (cdr (cdr e))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 (while e
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 (indent-to-column description-col)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 (insert (car e) "\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 (setq e (cdr e))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 entries)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 (insert "\n")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 (defun Info-build-dir-anew (directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 "Build info directory information for DIRECTORY.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1217 The generated directory listing may be saved to a `dir' according
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1218 to the value of `Info-save-auto-generated-dir'."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 (let* ((dirfile (expand-file-name "dir" directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 (to-temp (or (null Info-save-auto-generated-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 (eq Info-save-auto-generated-dir 'never)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 (and (not (file-writable-p dirfile))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1224 (message "File not writable %s. Using temporary."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1225 dirfile))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1226 (info-files (Info-directory-files dirfile nil 'fullname nil t)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 (if to-temp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 (message "Creating temporary dir in %s..." directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 (message "Creating %s..." dirfile))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 (set-buffer (find-file-noselect dirfile t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231 (setq buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 (erase-buffer)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1233 (insert Info-dir-prologue "Info files in " directory ":\n\n")
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1234 (Info-dump-dir-entries
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1235 (mapcar
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 #'(lambda (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237 (or (Info-extract-dir-entry-from f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238 (list 'dummy
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1239 (progn (string-match "\\([^.]*\\)\\(\\..*\\)?$"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1240 (file-name-nondirectory f))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1241 (capitalize
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1242 (match-string 1 (file-name-nondirectory f))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 ":"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 (list Info-no-description-string))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245 info-files))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 (if to-temp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 (save-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249 (if to-temp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 (message "Creating temporary dir in %s...done" directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 (message "Creating %s...done" dirfile)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 (defun Info-rebuild-dir (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 "Build info directory information in the directory of dir FILE.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1256 Description of info files are merged from the info files in the
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257 directory and the contents of FILE with the description in info files
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1258 taking precedence over descriptions in FILE.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1259 The generated directory listing may be saved to a `dir' according to
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1260 the value of `Info-save-auto-generated-dir'."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 (save-restriction
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263 (let (dir-section-contents dir-full-contents
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 dir-entry
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 file-dir-entry
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 mark next-section
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267 not-first-section
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1268 (to-temp
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269 (or (null Info-save-auto-generated-dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270 (eq Info-save-auto-generated-dir 'never)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1271 (and (eq Info-save-auto-generated-dir 'always)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 (not (file-writable-p file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1273 (message "File not writable %s. Using temporary." file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 (and (eq Info-save-auto-generated-dir 'conservative)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275 (or (and (not (file-writable-p file))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1276 (message
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1277 "File not writable %s. Using temporary." file))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1278 (not (y-or-n-p
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1279 (message "%s is outdated. Overwrite ? "
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 file))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 (set-buffer (find-file-noselect file t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 (setq buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 (if to-temp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 (message "Rebuilding temporary %s..." file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 (message "Rebuilding %s..." file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286 (catch 'done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 (setq buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289 (unless (and (search-forward "\^_")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 (re-search-forward "^\\* Menu:.*$" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291 (setq mark (and (re-search-forward "^\\* " nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 (match-beginning 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 (throw 'done nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294 (setq dir-full-contents (Info-parse-dir-entries mark (point-max)))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1295 (setq next-section (or (and (re-search-forward "^[^* \t].*:[ \t]*$"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1296 nil t)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 (match-beginning 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 (point-max)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 (while next-section
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 (narrow-to-region mark next-section)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1301 (setq dir-section-contents (nreverse (Info-parse-dir-entries
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1302 (point-min) (point-max))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 (mapcar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 #'(lambda (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 (setq dir-entry (assoc (downcase
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306 (file-name-sans-extension
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307 (file-name-nondirectory file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 dir-section-contents)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309 file-dir-entry (Info-extract-dir-entry-from file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 (if dir-entry
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 (if file-dir-entry
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1312 ;; A dir entry in the info file takes precedence over
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1313 ;; an existing entry in the dir file
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 (setcdr dir-entry (cdr file-dir-entry)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315 (unless (or not-first-section
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 (assoc (downcase
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317 (file-name-sans-extension
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 (file-name-nondirectory file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 dir-full-contents))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 (if file-dir-entry
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1321 (setq dir-section-contents
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1322 (cons file-dir-entry dir-section-contents))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1323 (setq dir-section-contents
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 (cons (list 'dummy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325 (capitalize (file-name-sans-extension
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1326 (file-name-nondirectory
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1327 file)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328 ":"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1329 (list Info-no-description-string))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 dir-section-contents))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 Info-dir-newer-info-files)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 (delete-region (point-min) (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333 (Info-dump-dir-entries (nreverse dir-section-contents))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 (widen)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335 (if (= next-section (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 (setq next-section nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 (or (setq mark (and (re-search-forward "^\\* " nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338 (match-beginning 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 (throw 'done nil))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1340 (setq next-section (or (and (re-search-forward
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1341 "^[^* \t].*:[ \t]*$" nil t)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 (match-beginning 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 (point-max))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 (setq not-first-section t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 (if to-temp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 (message "Rebuilding temporary %s...done" file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 (save-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 (message "Rebuilding %s...done" file))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1352 ;;;###autoload
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 (defun Info-batch-rebuild-dir ()
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1354 "(Re)build `dir' files in the directories remaining on the command line.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1355 Use this from the command line, with `-batch', it won't work in an
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1356 interactive XEmacs.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1357
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1358 Each file is processed even if an error occurred previously. For example,
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1359 invoke \"xemacs -batch -f Info-batch-rebuild-dir /usr/local/info\"."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 ;; command-line-args-left is what is left of the command line (from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 ;; startup.el)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 (defvar command-line-args-left) ; Avoid 'free variable' warning
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 (if (not noninteractive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 (error "`Info-batch-rebuild-dir' is to be used only with -batch"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365 (let ((Info-save-auto-generated-dir 'always)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 dir localdir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 (while command-line-args-left
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 (if (not (file-directory-p (car command-line-args-left)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369 (message "Warning: Skipped %s. Not a directory."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 (car command-line-args-left))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 (setq dir (expand-file-name "dir" (car command-line-args-left)))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1372 (setq localdir (expand-file-name "localdir"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1373 (car command-line-args-left)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1374 (cond
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 ((file-exists-p dir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 (Info-rebuild-dir dir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 ((file-exists-p localdir)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 (Info-rebuild-dir localdir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 (Info-build-dir-anew (car command-line-args-left)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 (setq command-line-args-left (cdr command-line-args-left)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 (message "Done")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 (kill-emacs 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 (defun Info-history-add (file node point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386 (if Info-keeping-history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 (let* ((name (format "(%s)%s" (Info-file-name-only file) node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 (found (assoc name Info-history)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 (if found
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390 (setq Info-history (delq found Info-history)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 (setq Info-history (cons (list name (- point (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1392 (and (eq (window-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 (- (window-start) (point-min))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 Info-history)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 (defun Info-file-name-only (file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 (let ((dir (file-name-directory file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 (p Info-directory-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400 (while (and p (not (equal (car p) dir)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401 (setq p (cdr p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1402 (if p (file-name-nondirectory file) file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 (defun Info-read-subfile (nodepos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405 (let (lastfilepos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406 lastfilename)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1407 (save-excursion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1408 (set-buffer (marker-buffer Info-tag-table-marker))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1409 (goto-char (point-min))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1410 (search-forward "\n\^_")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1411 (forward-line 2)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1412 (catch 'foo
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1413 (while (not (looking-at "\^_"))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1414 (if (not (eolp))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1415 (let ((start (point))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1416 thisfilepos thisfilename)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1417 (search-forward ": ")
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1418 (setq thisfilename (buffer-substring start (- (point) 2)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1419 (setq thisfilepos (read (current-buffer)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1420 ;; read in version 19 stops at the end of number.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1421 ;; Advance to the next line.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1422 (if (eolp)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1423 (forward-line 1))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1424 (if (> thisfilepos nodepos)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1425 (throw 'foo t))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1426 (setq lastfilename thisfilename)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1427 (setq lastfilepos thisfilepos))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1428 (throw 'foo t)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 (or (equal Info-current-subfile lastfilename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 (let ((buffer-read-only nil))
3693
3b847cba6d71 [xemacs-hg @ 2006-11-22 02:20:20 by stephent]
stephent
parents: 3625
diff changeset
1431 (setq buffer-file-name nil
3b847cba6d71 [xemacs-hg @ 2006-11-22 02:20:20 by stephent]
stephent
parents: 3625
diff changeset
1432 buffer-file-truename nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433 (widen)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435 (Info-insert-file-contents (Info-suffixed-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1436 (expand-file-name lastfilename
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437 (file-name-directory
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1438 Info-current-file))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1439 'exact)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440 t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 (setq Info-current-subfile lastfilename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 (search-forward "\n\^_")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 (+ (- nodepos lastfilepos) (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1447 (defun Info-all-case-regexp (str)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1448 (let ((regexp "")
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1449 (len (length str))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1450 (i 0)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1451 c)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1452 (while (< i len)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1453 (setq c (aref str i))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1454 (cond ((or (and (>= c ?A) (<= c ?Z))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1455 (and (>= c ?a) (<= c ?z)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1456 (setq regexp (concat regexp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1457 "["
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1458 (char-to-string (downcase c))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1459 "\\|"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1460 (char-to-string (upcase c))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1461 "]")))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1462 (t
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1463 (setq regexp (concat regexp (char-to-string c)))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1464 (setq i (1+ i)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1465 regexp))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1466
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1467 (defun Info-suffixed-file (name &optional exact)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1468 "Look for an info file named NAME. This function tries to be smart in
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1469 finding the file corresponding to NAME: if it doesn't exist, several
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1470 variants are looked for, notably by appending suffixes from
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1471 `Info-suffix-list' and by trying to change the characters case in NAME.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1472
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1473 The optional argument EXACT prevents this function from trying different case
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1474 versions of NAME. Only the suffixes are tried."
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1475 (catch 'found
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1476 ;; First, try NAME alone:
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1477 (and (file-regular-p name) (throw 'found name))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1478 ;; Then, try different variants
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1479 (let ((suff-match (concat "\\("
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1480 (let ((suff-list Info-suffix-list)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1481 suff regexp)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1482 (while (setq suff (pop suff-list))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1483 (setq regexp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1484 (concat regexp
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1485 (regexp-quote (car suff))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1486 (and suff-list "\\|"))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1487 regexp)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1488 "\\)?$"))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1489 (dir (file-name-directory name))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1490 file files)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1491 (setq name (file-name-nondirectory name))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1492 (setq files
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1493 (with-trapping-errors ;; protect against invalid directory
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1494 :operation (format "directory `%s'" dir)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1495 :class 'info
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1496 :error-form nil
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1497 :no-backtrace t
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1498 ;; First, try NAME[.<suffix>]
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1499 (append
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1500 (directory-files dir 'fullname
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1501 (concat "^" (regexp-quote name) suff-match)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1502 nil t)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1503 (if exact
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1504 nil
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1505 ;; Then, try to match the name independantly of the
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1506 ;; characters case.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1507 (directory-files dir 'fullname
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1508 (Info-all-case-regexp
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1509 (concat "^"
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1510 (regexp-quote name)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1511 suff-match))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 776
diff changeset
1512 nil t)))))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1513 (while (setq file (pop files))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1514 (and (file-regular-p file)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1515 (throw 'found file)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1516 )))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 (defun Info-insert-file-contents (file &optional visit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519 (setq file (expand-file-name file default-directory))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1520 (let ((suff Info-suffix-list)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1521 len)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1522 (while (and suff
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1523 (setq len (length (car (car suff))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1524 (or (<= (length file) len)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1525 (not (or
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1526 (equal (substring file (- len))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1527 (car (car suff)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1528 (equal (substring file (- len))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1529 (upcase (car (car suff)))))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1530 )))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 (setq suff (cdr suff)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 (if (stringp (cdr (car suff)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533 (let ((command (if (string-match "%s" (cdr (car suff)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534 (format (cdr (car suff)) file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 (concat (cdr (car suff)) " < " file))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 (message "%s..." command)
1870
375ec21c9374 [xemacs-hg @ 2004-01-21 09:54:25 by stephent]
stephent
parents: 1425
diff changeset
1537 (call-process shell-file-name nil t nil shell-command-switch command)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 (message "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 (when visit
3693
3b847cba6d71 [xemacs-hg @ 2006-11-22 02:20:20 by stephent]
stephent
parents: 3625
diff changeset
1540 (setq buffer-file-name file
3b847cba6d71 [xemacs-hg @ 2006-11-22 02:20:20 by stephent]
stephent
parents: 3625
diff changeset
1541 buffer-file-truename (file-truename buffer-file-name))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 (clear-visited-file-modtime)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 (insert-file-contents file visit))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 (defun Info-select-node ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 "Select the node that point is in, after using `g *' to select whole file."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 (widen)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 ;; Find beginning of node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 (search-backward "\n\^_")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553 (forward-line 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 ;; Get nodename spelled as it is in the node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 (re-search-forward "Node:[ \t]*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 (setq Info-current-node
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 (buffer-substring (point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 (skip-chars-forward "^,\t\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560 (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 (Info-set-mode-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 ;; Find the end of it, and narrow.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 (let (active-expression)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 (narrow-to-region (point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566 (if (re-search-forward "\n[\^_\f]" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1567 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1568 (1- (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1569 (if (looking-at "[\n\^_\f]*execute: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1570 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571 (goto-char (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 (setq active-expression
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 (read (current-buffer))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574 (point-max)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575 (or (equal Info-footnote-tag "Note")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 (let ((buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 (bufmod (buffer-modified-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 (case-fold-search t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 (while (re-search-forward "\\*[Nn]ote\\([ \n]\\)" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 (replace-match (concat "*" Info-footnote-tag "\ ")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 (set-buffer-modified-p bufmod))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 (Info-reannotate-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585 ;; XEmacs: remove v19 test
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 (and Info-fontify
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 (Info-fontify-node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 (run-hooks 'Info-select-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 (if Info-enable-active-nodes (eval active-expression)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 (defun Info-set-mode-line ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 (setq modeline-buffer-identification
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593 (list (cons modeline-buffer-id-left-extent "Info: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 (cons modeline-buffer-id-right-extent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 (concat
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 "("
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597 (if Info-current-file
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1598 (let ((name (file-name-nondirectory
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1599 Info-current-file)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1600 (if (string-match "^\\([^.]*\\)\\..*$" name)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1601 (match-string 1 name)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1602 name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 ")"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 (or Info-current-node ""))))))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
1606
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608 ;; Go to an info node specified with a filename-and-nodename string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609 ;; of the sort that is found in pointers in nodes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1610
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 (defun Info-goto-node (nodename &optional no-going-back tryfile)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613 "Go to info node named NAME. Give just NODENAME or (FILENAME)NODENAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 Actually, the following interpretations of NAME are tried in order:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615 (FILENAME)NODENAME
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616 (FILENAME) (using Top node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 NODENAME (in current file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 TAGNAME (see below)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 FILENAME (using Top node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1620 where TAGNAME is a string that appears in quotes: \"TAGNAME\", in an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621 annotation for any node of any file. (See `a' and `x' commands.)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622 (interactive (list (Info-read-node-name "Goto node, file or tag: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1623 nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 (let (filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1625 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1626 nodename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627 (setq filename (if (= (match-beginning 1) (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 ""
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 (substring nodename (match-beginning 2) (match-end 2)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630 nodename (substring nodename (match-beginning 3) (match-end 3)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1631 (let ((trim (string-match "\\s *\\'" filename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1632 (if trim (setq filename (substring filename 0 trim))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1633 (let ((trim (string-match "\\s *\\'" nodename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1634 (if trim (setq nodename (substring nodename 0 trim))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1635 (Info-find-node (if (equal filename "") nil filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636 (if (equal nodename "") "Top" nodename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1637 no-going-back (and tryfile (equal filename "")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 (defun Info-goto-bookmark ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 (let ((completion-ignore-case nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 (tag (completing-read "Goto tag: "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 (Info-build-annotation-completions)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644 nil t nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 'Info-minibuffer-history)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646 (or (equal tag "") (Info-find-node nil (format "<<%s>>" tag)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1647
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648 ;;;###autoload
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1649 (defun Info-visit-file (file)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 "Directly visit an info file."
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1651 (interactive "fVisit Info file: ")
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1652 (Info-find-node (expand-file-name file) "Top"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654 (defun Info-restore-point (&optional always)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655 "Restore point to same location it had last time we were in this node."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1656 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1657 (if (or Info-restoring-point always)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 (let* ((name (format "(%s)%s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1659 (Info-file-name-only Info-current-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1660 Info-current-node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 (p (assoc name Info-history)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662 (if p (Info-restore-history-entry p)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1664 (defun Info-restore-history-entry (entry)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1665 (goto-char (+ (nth 1 entry) (point-min)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1666 (and (nth 2 entry)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1667 (get-buffer-window (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1668 (set-window-start (get-buffer-window (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 (+ (nth 2 entry) (point-min)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1671 (defvar Info-read-node-completion-table)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1672
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1673 ;; This function is used as the "completion table" while reading a node name.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1674 ;; It does completion using the alist in Info-read-node-completion-table
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1675 ;; unless STRING starts with an open-paren.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1676 (defun Info-read-node-name-1 (string predicate code)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1677 (let ((no-completion (and (> (length string) 0) (eq (aref string 0) ?\())))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1678 (cond ((eq code nil)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1679 (if no-completion
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1680 string
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1681 (try-completion string Info-read-node-completion-table
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1682 predicate)))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1683 ((eq code t)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1684 (if no-completion
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1685 nil
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1686 (all-completions string Info-read-node-completion-table
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1687 predicate)))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1688 ((eq code 'lambda)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1689 (if no-completion
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1690 t
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1691 (assoc string Info-read-node-completion-table))))))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1692
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1693 (defun Info-read-node-name (prompt &optional default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1694 (Info-setup-initial)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1695 (let* ((completion-ignore-case t)
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1696 (Info-read-node-completion-table (Info-build-node-completions))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1697 (nodename (completing-read prompt 'Info-read-node-name-1
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1698 nil t nil 'Info-minibuffer-history
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1699 default)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1700 (if (equal nodename "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1701 (or default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1702 (Info-read-node-name prompt))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1703 nodename)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705 (defun Info-build-annotation-completions ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 (or Info-current-annotation-completions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708 (let ((bufs (delq nil (mapcar 'get-file-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709 Info-annotations-path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710 (compl nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 (while bufs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1712 (set-buffer (car bufs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 (while (re-search-forward "<<\\(.*\\)>>" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715 (setq compl (cons (list (buffer-substring (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716 (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717 compl)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 (setq bufs (cdr bufs)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1719 (setq Info-current-annotation-completions compl)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721 (defun Info-build-node-completions ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 (or Info-current-file-completions
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1723 (let ((m Info-tag-table-marker)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1724 (compl (Info-build-annotation-completions)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1726 (save-restriction
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 (widen)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 (if (marker-buffer Info-tag-table-marker)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730 (set-buffer (marker-buffer Info-tag-table-marker))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1731 (goto-char m)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 (while (re-search-forward "\nNode: \\(.*\\)\177" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 (setq compl
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734 (cons (list (buffer-substring (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1735 (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1736 compl))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1737 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1738 (while (search-forward "\n\^_" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 (forward-line 1)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1740 (let ((start (point)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742 (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]"
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1743 start t)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1744 (setq compl
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1745 (cons (list (buffer-substring (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746 (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1747 compl))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748 (setq Info-current-file-completions compl))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1750 (defvar Info-last-search nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1751 "Default regexp for \\<Info-mode-map>\\[Info-search] command to search for.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1754 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 (defun Info-search (regexp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1756 "Search for REGEXP, starting from point, and select node it's found in."
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1757 (interactive (list
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1758 (read-from-minibuffer
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1759 (if Info-last-search
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1760 (format "Search (regexp, default %s): "
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1761 Info-last-search)
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1762 "Search (regexp): ")
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1763 nil nil nil nil nil Info-last-search)))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1764 (setq Info-last-search regexp)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1765 (with-search-caps-disable-folding regexp t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1766 (let ((found ())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1767 (onode Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1768 (ofile Info-current-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1769 (opoint (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1770 (osubfile Info-current-subfile))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 (save-restriction
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773 (widen)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1774 (if (null Info-current-subfile)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775 (progn (re-search-forward regexp) (setq found (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1776 (condition-case nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777 (progn (re-search-forward regexp) (setq found (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778 (search-failed nil)))))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1779 (if (not found)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1780 ;; can only happen in subfile case -- else would have erred
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1782 (let ((list ()))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1783 (save-excursion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1784 (set-buffer (marker-buffer Info-tag-table-marker))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1785 (goto-char (point-min))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1786 (search-forward "\n\^_\nIndirect:")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1787 (save-restriction
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1788 (narrow-to-region (point)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1789 (progn (search-forward "\n\^_")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1790 (1- (point))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1791 (goto-char (point-min))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1792 (search-forward (concat "\n" osubfile ": "))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1793 (beginning-of-line)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1794 (while (not (eobp))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1795 (re-search-forward "\\(^.*\\): [0-9]+$")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1796 (goto-char (+ (match-end 1) 2))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1797 (setq list (cons (cons (read (current-buffer))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1798 (buffer-substring
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1799 (match-beginning 1)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1800 (match-end 1)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1801 list))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1802 (goto-char (1+ (match-end 0))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1803 (setq list (nreverse list)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1804 list (cdr list))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1805 (while list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1806 (message "Searching subfile %s..." (cdr (car list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 (Info-read-subfile (car (car list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 (setq list (cdr list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1810 (if (re-search-forward regexp nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1811 (setq found (point) list ())))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1812 (if found
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813 (message "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1814 (signal 'search-failed (list regexp))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1815 (if (not found)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1816 (progn (Info-read-subfile opoint)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1817 (goto-char opoint)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1818 (Info-select-node)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1819 (widen)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1820 (goto-char found)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821 (Info-select-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822 (or (and (equal onode Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1823 (equal ofile Info-current-file))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1824 (Info-history-add ofile onode opoint))))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1825 (message "Found \"%s\" in %s. Press `z' to continue search."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1826 regexp Info-current-node)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1827 )
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1828
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1829 (defun Info-search-next ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1830 "Repeat search starting from point with last regexp used in `Info-search'."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1831 (interactive)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1832 (Info-search Info-last-search))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
1833
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1834
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835 ;; Extract the value of the node-pointer named NAME.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1836 ;; If there is none, use ERRORNAME in the error message;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 ;; if ERRORNAME is nil, just return nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 (defun Info-extract-pointer (name &optional errorname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841 (forward-line 4)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 (let ((case-fold-search t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1843 (if (re-search-backward (concat name ":") nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1844 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 (goto-char (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 (Info-following-node-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847 (if (eq errorname t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849 (error (concat "Node has no " (capitalize (or errorname name)))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1850
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1851 ;; Return the node name in the buffer following point.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 ;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1853 ;; saying which chars may appear in the node name.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 (defun Info-following-node-name (&optional allowedchars)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 (skip-chars-forward " \t")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856 (buffer-substring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857 (point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 (while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860 (skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1861 (if (looking-at "(")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1862 (skip-chars-forward "^)")))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1863 (skip-chars-backward " .")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 (defun Info-next (&optional n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 "Go to the next node of this node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 A positive or negative prefix argument moves by multiple nodes."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870 (or n (setq n 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1871 (if (< n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1872 (Info-prev (- n))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 (while (>= (setq n (1- n)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1874 (Info-goto-node (Info-extract-pointer "next")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1875
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876 (defun Info-prev (&optional n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877 "Go to the previous node of this node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878 A positive or negative prefix argument moves by multiple nodes."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1879 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1880 (or n (setq n 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1881 (if (< n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1882 (Info-next (- n))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 (while (>= (setq n (1- n)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1884 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1885
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1886 (defun Info-up (&optional n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887 "Go to the superior node of this node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1888 A positive prefix argument moves up several times."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1889 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890 (or n (setq n 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891 (while (>= (setq n (1- n)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1892 (Info-goto-node (Info-extract-pointer "up")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1893 (if (interactive-p) (Info-restore-point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 (defun Info-last (&optional n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896 "Go back to the last node visited.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897 With a prefix argument, go to Nth most recently visited node. History is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898 circular; after oldest node, history comes back around to most recent one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1899 Argument can be negative to go through the circle in the other direction.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900 \(In other words, `l' is like \"undo\" and `C-u - l' is like \"redo\".)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 (or n (setq n 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1903 (or Info-history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 (error "This is the first Info node you looked at"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 (let ((len (1+ (length Info-history))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 (setq n (% (+ n (* len 100)) len)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 (if (> n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 (let ((entry (nth (1- n) Info-history)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909 (Info-history-add Info-current-file Info-current-node (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910 (while (>= (setq n (1- n)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 (setq Info-history (nconc (cdr Info-history)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912 (list (car Info-history)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 (setq Info-history (cdr Info-history))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914 (let ((Info-keeping-history nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 (Info-goto-node (car entry)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916 (Info-restore-history-entry entry))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1917
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1918 (defun Info-directory ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 "Go to the Info directory node."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921 (Info-find-node "dir" "top"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1922
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 (defun Info-follow-reference (footnotename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924 "Follow cross reference named NAME to the node it refers to.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 NAME may be an abbreviation of the reference name."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 (interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927 (let ((completion-ignore-case t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928 completions default (start-point (point)) str i)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931 (while (re-search-forward (format "\\*%s[ \n\t]*\\([^:]*\\):"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 Info-footnote-tag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934 (setq str (buffer-substring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936 (1- (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 ;; See if this one should be the default.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938 (and (null default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939 (< (match-beginning 0) start-point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 (<= start-point (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 (setq default t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 (setq i 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943 (while (setq i (string-match "[ \n\t]+" str i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 (setq str (concat (substring str 0 i) " "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945 (substring str (match-end 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946 (setq i (1+ i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 ;; Record as a completion and perhaps as default.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 (if (eq default t) (setq default str))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949 (setq completions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1950 (cons (cons str nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1951 completions))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1952 (if completions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1953 (let ((item (completing-read (if default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1954 (concat "Follow reference named: ("
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1955 default ") ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1956 "Follow reference named: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1957 completions nil t nil
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1958 'Info-minibuffer-history
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1959 default)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 (if (and (string= item "") default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1961 (list default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1962 (list item)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1963 (error "No cross-references in this node"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1964 (let (target i (str (concat "\\*" Info-footnote-tag " "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1965 (regexp-quote footnotename))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1966 (while (setq i (string-match " " str i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967 (setq str (concat (substring str 0 i) "\\([ \t\n]+\\)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 (substring str (1+ i))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 (setq i (+ i 10)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 (or (re-search-forward str nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973 (error "No cross-reference named %s" footnotename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974 (goto-char (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975 (setq target
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 (Info-extract-menu-node-name "Bad format cross reference" t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977 (while (setq i (string-match "[ \t\n]+" target i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1978 (setq target (concat (substring target 0 i) " "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1979 (substring target (match-end 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980 (setq i (+ i 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 (Info-goto-node target)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 (setq Info-in-cross-reference t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1984 (defun Info-next-reference (n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1986 (let ((pat (format "\\*%s[ \n\t]*\\([^:]*\\):\\|^\\* .*:\\|<<.*>>"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987 Info-footnote-tag))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988 (old-pt (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 wrapped found-nomenu)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1990 (while (< n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 (unless (re-search-backward pat nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992 ;; Don't wrap more than once in a buffer where only the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993 ;; menu references are found.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994 (when (and wrapped (not found-nomenu))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 (goto-char old-pt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996 (error "No cross references in this node"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 (setq wrapped t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1998 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 (unless (re-search-backward pat nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 (goto-char old-pt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001 (error "No cross references in this node")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 (unless (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2003 (goto-char (match-beginning 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2004 (when (looking-at "\\* Menu:")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2005 (decf n)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006 (setq found-nomenu t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007 (incf n))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2008 (while (> n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2009 (or (eobp) (forward-char 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010 (unless (re-search-forward pat nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011 (when (and wrapped (not found-nomenu))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2012 (goto-char old-pt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2013 (error "No cross references in this node"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 (setq wrapped t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2016 (unless (re-search-forward pat nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2017 (goto-char old-pt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2018 (error "No cross references in this node")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2019 (unless (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2020 (goto-char (match-beginning 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2021 (when (looking-at "\\* Menu:")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2022 (incf n)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023 (setq found-nomenu t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024 (decf n))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2025 (when (looking-at "\\* Menu:")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2026 (error "No cross references in this node"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027 (goto-char (match-beginning 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2028
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2029 (defun Info-prev-reference (n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2030 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 (Info-next-reference (- n)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2032
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2033 (defun Info-extract-menu-node-name (&optional errmessage multi-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2034 (skip-chars-forward " \t\n")
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2035 (let ((start (point))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2036 str i)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2037 (skip-chars-forward "^:")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2038 (forward-char 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2039 (setq str
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2040 (if (looking-at ":")
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2041 (buffer-substring start (1- (point)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2042 (skip-chars-forward " \t\n")
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2043 ;; Kludge.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2044 ;; Allow dots in node name not followed by whitespace.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2045 (re-search-forward
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
2046 (concat "\\(([^)]+)[^.,"
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2047 (if multi-line "" "\n")
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2048 "]*\\|\\([^.,\t"
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2049 (if multi-line "" "\n")
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2050 ;; We consider dots followed by newline as
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2051 ;; end of nodename even if multil-line.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2052 ;; Also stops at .). It is generated by @pxref.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2053 ;; Skips sequential dots.
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2054 "]\\|\\.+[^ \t\n)]\\)+\\)"))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2055 (match-string 1)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2056 (while (setq i (string-match "\n" str i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2057 (aset str i ?\ ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2058 str))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2059
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2060 (defun Info-menu (menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2061 "Go to node for menu item named (or abbreviated) NAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2062 Completion is allowed, and the menu item point is on is the default."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2063 (interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2064 (let ((completions '())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2065 ;; If point is within a menu item, use that item as the default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2066 (default nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2067 (p (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2068 (last nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2069 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2070 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2071 (let ((case-fold-search t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2072 (if (not (search-forward "\n* menu:" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2073 (error "No menu in this node")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2074 (while (re-search-forward
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2075 "\n\\* \\([^:\t\n]*\\):" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2076 (if (and (null default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2077 (prog1 (if last (< last p) nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2078 (setq last (match-beginning 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2079 (<= p last))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2080 (setq default (car (car completions))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2081 (setq completions (cons (cons (buffer-substring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2082 (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2083 (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2084 (match-beginning 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2085 completions)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2086 (if (and (null default) last
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2087 (< last p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2088 (<= p (progn (end-of-line) (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2089 (setq default (car (car completions)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2090 (let ((item nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2091 (while (null item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2092 (setq item (let ((completion-ignore-case t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2093 (completing-read (if default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2094 (format "Menu item (default %s): "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2095 default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2096 "Menu item: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2097 completions nil t nil
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2098 'Info-minibuffer-history
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
2099 default)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2100 ;; we rely on the fact that completing-read accepts an input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2101 ;; of "" even when the require-match argument is true and ""
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2102 ;; is not a valid possibility
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2103 (if (string= item "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2104 (if default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2105 (setq item default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2106 ;; ask again
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2107 (setq item nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2108 (list item))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2109 ;; there is a problem here in that if several menu items have the same
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2110 ;; name you can only go to the node of the first with this command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2111 (Info-goto-node (Info-extract-menu-item menu-item) nil t))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2112
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2113 (defun Info-extract-menu-item (menu-item &optional noerror)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2114 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2115 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2116 (if (let ((case-fold-search t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2117 (search-forward "\n* menu:" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2118 (if (or (search-forward (concat "\n* " menu-item ":") nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2119 (search-forward (concat "\n* " menu-item) nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2120 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2121 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2122 (forward-char 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2123 (Info-extract-menu-node-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2124 (and (not noerror) (error "No such item in menu")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2125 (and (not noerror) (error "No menu in this node")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2127 ;; If COUNT is nil, use the last item in the menu.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2128 (defun Info-extract-menu-counting (count &optional noerror noindex)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2129 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2130 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2131 (if (let ((case-fold-search t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2132 (and (search-forward "\n* menu:" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2133 (or (not noindex)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2134 (not (string-match "\\<Index\\>" Info-current-node)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2135 (if (search-forward "\n* " nil t count)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2136 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2137 (or count
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2138 (while (search-forward "\n* " nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2139 (Info-extract-menu-node-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2140 (and (not noerror) (error "Too few items in menu")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2141 (and (not noerror) (error "No menu in this node")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2143 (defun Info-nth-menu-item (n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2144 "Go to the node of the Nth menu item."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2145 (interactive "P")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2146 (or n (setq n (- last-command-char ?0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2147 (if (< n 1) (error "Index must be at least 1"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2148 (Info-goto-node (Info-extract-menu-counting n) nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2150 (defun Info-last-menu-item ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2151 "Go to the node of the tenth menu item."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2152 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2153 (Info-goto-node (Info-extract-menu-counting nil) nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2155 (defun Info-top ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2156 "Go to the Top node of this file."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2157 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2158 (Info-goto-node "Top"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2159
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2160 (defun Info-end ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2161 "Go to the final node in this file."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2162 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2163 (Info-top)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2164 (let ((Info-keeping-history nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2165 node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2166 (Info-last-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2167 (while (setq node (or (Info-extract-pointer "next" t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2168 (Info-extract-menu-counting nil t t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2169 (Info-goto-node node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2170 (or (equal (Info-extract-pointer "up" t) "Top")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2171 (let ((executing-kbd-macro "")) ; suppress messages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2172 (condition-case nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2173 (Info-global-next 10000)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2174 (error nil))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2175
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2176 (defun Info-global-next (&optional n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2177 "Go to the next node in this file, traversing node structure as necessary.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2178 This works only if the Info file is structured as a hierarchy of nodes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2179 A positive or negative prefix argument moves by multiple nodes."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2180 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2181 (or n (setq n 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2182 (if (< n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2183 (Info-global-prev (- n))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2184 (while (>= (setq n (1- n)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2185 (let (node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2186 (cond ((and (string-match "^Top$" Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2187 (setq node (Info-extract-pointer "next" t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2188 (Info-extract-menu-item node t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2189 (Info-goto-node node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2190 ((setq node (Info-extract-menu-counting 1 t t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2191 (message "Going down...")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2192 (Info-goto-node node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2193 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2194 (let ((Info-keeping-history Info-keeping-history)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2195 (orignode Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2196 (ups ""))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2197 (while (not (Info-extract-pointer "next" t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2198 (if (and (setq node (Info-extract-pointer "up" t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2199 (not (equal node "Top")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2200 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2201 (message "Going%s..." (setq ups (concat ups " up")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2202 (Info-goto-node node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2203 (setq Info-keeping-history nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2204 (if orignode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2205 (let ((Info-keeping-history nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2206 (Info-goto-node orignode)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2207 (error "Last node in file")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2208 (Info-next))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2209
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2210 (defun Info-page-next (&optional n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2211 "Scroll forward one screenful, or go to next global node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2212 A positive or negative prefix argument moves by multiple screenfuls."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2213 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2214 (or n (setq n 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2215 (if (< n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2216 (Info-page-prev (- n))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2217 (while (>= (setq n (1- n)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2218 (if (pos-visible-in-window-p (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2219 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2220 (Info-global-next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2221 (message "Node: %s" Info-current-node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2222 (scroll-up)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2223
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2224 (defun Info-scroll-next (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2225 (interactive "P")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2226 (if Info-auto-advance
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2227 (if (and (pos-visible-in-window-p (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2228 (not (eq Info-auto-advance t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2229 (not (eq last-command this-command)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2230 (message "Hit %s again to go to next node"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2231 (if (= last-command-char 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2232 "mouse button"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2233 (key-description (char-to-string last-command-char))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2234 (Info-page-next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2235 (setq this-command 'Info))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2236 (scroll-up arg)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2237
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2238 (defun Info-global-prev (&optional n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2239 "Go to the previous node in this file, traversing structure as necessary.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2240 This works only if the Info file is structured as a hierarchy of nodes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2241 A positive or negative prefix argument moves by multiple nodes."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2242 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2243 (or n (setq n 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2244 (if (< n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2245 (Info-global-next (- n))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2246 (while (>= (setq n (1- n)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2247 (let ((upnode (Info-extract-pointer "up" t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2248 (prevnode (Info-extract-pointer "prev[ious]*" t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2249 (if (or (not prevnode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2250 (equal prevnode upnode))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2251 (if (string-match "^Top$" Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2252 (error "First node in file")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2253 (message "Going up...")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2254 (Info-up))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2255 (Info-goto-node prevnode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2256 (let ((downs "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2257 (Info-keeping-history nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2258 node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2259 (while (setq node (Info-extract-menu-counting nil t t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2260 (message "Going%s..." (setq downs (concat downs " down")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2261 (Info-goto-node node))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2262
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2263 (defun Info-page-prev (&optional n)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2264 "Scroll backward one screenful, or go to previous global node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2265 A positive or negative prefix argument moves by multiple screenfuls."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2266 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2267 (or n (setq n 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2268 (if (< n 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2269 (Info-page-next (- n))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2270 (while (>= (setq n (1- n)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2271 (if (pos-visible-in-window-p (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2272 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2273 (Info-global-prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2274 (message "Node: %s" Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2275 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2276 (recenter -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2277 (move-to-window-line 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2278 (scroll-down)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2280 (defun Info-scroll-prev (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2281 (interactive "P")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2282 (if Info-auto-advance
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2283 (if (and (pos-visible-in-window-p (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2284 (not (eq Info-auto-advance t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2285 (not (eq last-command this-command)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2286 (message "Hit %s again to go to previous node"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2287 (if (mouse-event-p last-command-event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2288 "mouse button"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2289 (key-description (event-key last-command-event))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2290 (Info-page-prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2291 (setq this-command 'Info))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2292 (scroll-down arg)))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2293
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2294
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2295 (defun Info-find-index-alternatives (topic)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2296 (let ((pattern (format "\n\\* \\([^\n:]*%s[^\n:]*\\):[ \t]*%s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2297 (regexp-quote topic)
830
20baef34a0b0 [xemacs-hg @ 2002-05-07 16:13:59 by stephent]
stephent
parents: 793
diff changeset
2298 "\\(.*\\)\\.[ \t]*\\([0-9]*\\)$"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2299 node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2300 (message "Searching index for `%s'..." topic)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2301 (Info-goto-node "Top")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2302 (let ((case-fold-search t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2303 (or (search-forward "\n* menu:" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2304 (error "No index"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2305 (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2306 (error "No index")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2307 (goto-char (match-beginning 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2308 (let ((Info-keeping-history nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2309 (Info-fontify (and Info-fontify (equal topic ""))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2310 (Info-goto-node (Info-extract-menu-node-name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2311 (or (equal topic "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2312 (let ((matches nil)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2313 (Info-keeping-history nil))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2314 (while
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2315 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2316 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2317 (while (re-search-forward pattern nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2318 (setq matches
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2319 (cons (list (buffer-substring (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2320 (match-end 1))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
2321 (format "(%s)%s" Info-current-file
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
2322 (buffer-substring
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
2323 (match-beginning 2)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 747
diff changeset
2324 (match-end 2)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2325 Info-current-node
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2326 (string-to-int (concat "0"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2327 (buffer-substring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2328 (match-beginning 3)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2329 (match-end 3)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2330 matches)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2331 (and (setq node (Info-extract-pointer "next" t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2332 (string-match "\\<Index\\>" node)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2333 (let ((Info-fontify nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2334 (Info-goto-node node)))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2335 (nreverse matches)))))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2336
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2337 (defun Info-index (topic &optional starting-nodes)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2338 "Look up a string in the index for this file.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2339 The index is defined as the first node in the top-level menu whose
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2340 name contains the word \"Index\", plus any immediately following
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2341 nodes whose names also contain the word \"Index\".
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2342 If there are no exact matches to the specified topic, this chooses
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2343 the first match which is a case-insensitive substring of a topic.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2344 Use the `,' command to see the other matches.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2345 Give a blank topic name to go to the Index node itself.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2346
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2347 If STARTING-NODES is given, it should be a list of nodes specifying
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2348 files in which the indices will be searched. The results will be
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2349 combined together."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2350 (interactive "sIndex topic: ")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2351 (let ((matches (if starting-nodes
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2352 (mapcan #'(lambda (node)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2353 (Info-goto-node node)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2354 (Info-find-index-alternatives topic))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2355 starting-nodes)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2356 (Info-find-index-alternatives topic)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2357 exact found)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2358 (or matches
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2359 (progn
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2360 (if (or (not starting-nodes) (< (length starting-nodes) 2))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2361 (Info-last))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2362 (error "No \"%s\" in index" topic)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2363 ;; Here it is a feature that assoc is case-sensitive.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2364 (while (setq found (assoc topic matches))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2365 (setq exact (cons found exact)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2366 matches (delq found matches)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2367 (setq Info-index-alternatives (nconc exact matches)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2368 Info-index-first-alternative (car Info-index-alternatives))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2369 (Info-index-next 0)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2371 (defun Info-index-next (num)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2372 "Go to the next matching index item from the last `i' command."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2373 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2374 (or Info-index-alternatives
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2375 (error "No previous `i' command in this file"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2376 (while (< num 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2377 (setq num (+ num (length Info-index-alternatives))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2378 (while (> num 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2379 (setq Info-index-alternatives
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2380 (nconc (cdr Info-index-alternatives)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2381 (list (car Info-index-alternatives)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2382 num (1- num)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2383 (Info-goto-node (nth 1 (car Info-index-alternatives)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2384 (if (> (nth 3 (car Info-index-alternatives)) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2385 (forward-line (nth 3 (car Info-index-alternatives)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2386 (forward-line 3) ; don't search in headers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2387 (let ((name (car (car Info-index-alternatives))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2388 (if (or (re-search-forward (format
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2389 "\\(Function\\|Command\\): %s\\( \\|$\\)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2390 (regexp-quote name)) nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2391 (re-search-forward (format "^`%s[ ']" (regexp-quote name)) nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2392 (search-forward (format "`%s'" name) nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2393 (and (string-match "\\`.*\\( (.*)\\)\\'" name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2394 (search-forward
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2395 (format "`%s'" (substring name 0 (match-beginning 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2396 nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2397 (search-forward name nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2398 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2399 (goto-char (point-min)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2400 (message "Found \"%s\" in %s. %s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2401 (car (car Info-index-alternatives))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2402 (nth 2 (car Info-index-alternatives))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2403 (if (cdr Info-index-alternatives)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2404 (if (eq (car (cdr Info-index-alternatives))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2405 Info-index-first-alternative)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2406 "(Press `,' to repeat)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2407 (format "(Press `,' for %d more)"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2408 (- (1- (length Info-index-alternatives))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2409 (length (memq Info-index-first-alternative
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2410 (cdr Info-index-alternatives))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2411 "(Only match)")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2412
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2413
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2414 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2415 (defun Info-emacs-command (command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2416 "Look up an Emacs command in the Emacs manual in the Info system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2417 This command is designed to be used whether you are already in Info or not."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2418 (interactive "CLook up command in Emacs manual: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2419 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2420 (info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2421 (Info-find-node Info-emacs-info-file-name "Top")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2422 (Info-index (symbol-name command)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2423 (pop-to-buffer "*info*"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2424
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2425
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2426 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2427 (defun Info-goto-emacs-command-node (key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2428 "Look up an Emacs command in the Emacs manual in the Info system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2429 This command is designed to be used whether you are already in Info or not."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2430 (interactive "CLook up command in Emacs manual: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2431 (Info-emacs-command key))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2433 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2434 (defun Info-goto-emacs-key-command-node (key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2435 "Look up an Emacs key sequence in the Emacs manual in the Info system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2436 This command is designed to be used whether you are already in Info or not."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2437 (interactive "kLook up key in Emacs manual: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2438 (let ((command (key-binding key)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2439 (cond ((eq command 'keyboard-quit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2440 (keyboard-quit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2441 ((null command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2442 (error "%s is undefined" (key-description key)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2443 ((and (interactive-p) (eq command 'execute-extended-command))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2444 (call-interactively 'Info-goto-emacs-command-node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2445 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2446 (Info-goto-emacs-command-node command)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2447
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2448 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2449 (defun Info-emacs-key (key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2450 "Look up an Emacs key sequence in the Emacs manual in the Info system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2451 This command is designed to be used whether you are already in Info or not."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2452 (interactive "kLook up key in Emacs manual: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2453 (cond ((eq (key-binding key) 'keyboard-quit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2454 (keyboard-quit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2455 ((and (interactive-p) (eq (key-binding key) 'execute-extended-command))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2456 (call-interactively 'Info-goto-emacs-command-node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2457 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2458 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2459 (info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2460 (Info-find-node Info-emacs-info-file-name "Top")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2461 (setq key (key-description key))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2462 (let (p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2463 (if (setq p (string-match "[@{}]" key))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2464 (setq key (concat (substring key 0 p) "@" (substring key p))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2465 (if (string-match "^ESC " key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2466 (setq key (concat "M-" (substring key 4))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2467 (if (string-match "^M-C-" key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2468 (setq key (concat "C-M-" (substring key 4)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2469 (Info-index key))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2470 (pop-to-buffer "*info*"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2471
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2472 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2473 (defun Info-elisp-ref (func)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2474 "Look up an Emacs Lisp function in the Elisp manual in the Info system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2475 This command is designed to be used whether you are already in Info or not."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2476 (interactive (let ((fn (function-at-point))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2477 (enable-recursive-minibuffers t)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2478 val)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2479 (setq val (completing-read
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2480 (format "Look up Emacs Lisp function%s: "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2481 (if fn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2482 (format " (default %s)" fn)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2483 ""))
456
e7ef97881643 Import from CVS: tag r21-2-43
cvs
parents: 446
diff changeset
2484 obarray 'fboundp t
e7ef97881643 Import from CVS: tag r21-2-43
cvs
parents: 446
diff changeset
2485 nil nil (and fn (symbol-name fn))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2486 (list (if (equal val "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2487 fn (intern val)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2488 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2489 (info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2490 (condition-case nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2491 (Info-find-node "lispref" "Top")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2492 (error (Info-find-node "elisp" "Top")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2493 (Info-index (symbol-name func)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2494 (pop-to-buffer "*info*"))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2495
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2496 (defun Info-read-search-text-regexp ()
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2497 (read-from-minibuffer
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2498 (if (and (boundp 'Info-last-search) Info-last-search)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2499 (format "Search (regexp, default %s): "
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2500 Info-last-search)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2501 "Search (regexp): ")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2502 nil nil nil nil nil (and (boundp 'Info-last-search) Info-last-search)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2503
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2504 ;;;###autoload
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2505 (defun Info-search-text-in-lispref (regexp)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2506 "Search for REGEXP in Lispref text and select node it's found in."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2507 (interactive (list (Info-read-search-text-regexp)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2508 (Info-goto-node "(Lispref)")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2509 (Info-search regexp))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2510
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2511 ;;;###autoload
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2512 (defun Info-search-text-in-xemacs (regexp)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2513 "Search for REGEXP in User's Manual text and select node it's found in."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2514 (interactive (list (Info-read-search-text-regexp)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2515 (Info-goto-node "(XEmacs)")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2516 (Info-search regexp))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2517
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2518 ;;;###autoload
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2519 (defun Info-search-index-in-lispref (regexp)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2520 "Search for REGEXP in Lispref index and select node it's found in."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2521 (interactive "sIndex topic: ")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2522 (Info-goto-node "(Lispref)")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2523 (Info-index regexp))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2524
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2525 ;;;###autoload
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2526 (defun Info-search-index-in-xemacs-and-lispref (regexp)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2527 "Search for REGEXP in both User's Manual and Lispref indices.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2528 Select node it's found in."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2529 (interactive "sIndex topic: ")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2530 (Info-index regexp '("(XEmacs)" "(Lispref)")))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2531
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2533 (defun Info-reannotate-node ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2534 (let ((bufs (delq nil (mapcar 'get-file-buffer Info-annotations-path))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2535 (if bufs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2536 (let ((ibuf (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2537 (file (concat "\\(" (regexp-quote
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2538 (file-name-nondirectory Info-current-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2539 "\\|" (regexp-quote Info-current-file) "\\)"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2540 (node (regexp-quote Info-current-node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2541 (savept (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2542 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2543 (if (search-forward "\n------ NOTE:\n" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2544 (let ((buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2545 (bufmod (buffer-modified-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2546 top)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2547 (setq savept (copy-marker savept))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2548 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2549 (while (search-forward "\n------ NOTE:" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2550 (setq top (1+ (match-beginning 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2551 (if (search-forward "\n------\n" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2552 (delete-region top (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2553 (backward-char 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2554 (set-buffer-modified-p bufmod)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2555 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2556 (while bufs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2557 (set-buffer (car bufs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2558 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2559 (while (re-search-forward
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2560 (format
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2561 "------ *File: *%s *Node: *%s *Line: *\\([0-9]+\\) *\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2562 file node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2563 nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2564 (let ((line (string-to-int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2565 (buffer-substring (match-beginning 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2566 (match-end 2))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2567 (top (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2568 bot)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2569 (search-forward "\n------\n" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2570 (setq bot (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2571 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2572 (set-buffer ibuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2573 (if (integerp savept) (setq savept (copy-marker savept)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2574 (if (= line 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2575 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2576 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2577 (forward-line line))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2578 (let ((buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2579 (bufmod (buffer-modified-p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2580 (insert "------ NOTE:\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2581 (insert-buffer-substring (car bufs) top bot)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2582 (set-buffer-modified-p bufmod)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2583 (setq bufs (cdr bufs))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2584 (goto-char savept)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2585
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2586 (defvar Info-annotate-map nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2587 "Local keymap used within `a' command of Info.")
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2588
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2589 (if Info-annotate-map
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2590 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2591 ;; (setq Info-annotate-map (nconc (make-sparse-keymap) text-mode-map))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2592 (setq Info-annotate-map (copy-keymap text-mode-map))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2593 (define-key Info-annotate-map "\C-c\C-c" 'Info-cease-annotate))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2594
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2595 (defun Info-annotate-mode ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2596 "Major mode for adding an annotation to an Info node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2597 Like text mode with the addition of Info-cease-annotate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2598 which returns to Info mode for browsing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2599 \\{Info-annotate-map}")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2600
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2601 (defun Info-annotate (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2602 "Add a personal annotation to the current Info node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2603 Only you will be able to see this annotation. Annotations are stored
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2604 in the file \"~/.xemacs/info.notes\" by default. If point is inside
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2605 an existing annotation, edit that annotation. A prefix argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2606 specifies which annotations file (from `Info-annotations-path') is to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2607 be edited; default is 1."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2608 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2609 (setq arg (1- arg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2610 (if (or (< arg 0) (not (nth arg Info-annotations-path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2611 (if (= arg 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2612 (setq Info-annotations-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2613 (list (read-file-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2614 "Annotations file: " "~/" "~/.infonotes")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2615 (error "File number must be in the range from 1 to %d"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2616 (length Info-annotations-path))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2617 (let ((which nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2618 (file (file-name-nondirectory Info-current-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2619 (d Info-directory-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2620 where pt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2621 (while (and d (not (equal (expand-file-name file (car d))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2622 Info-current-file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2623 (setq d (cdr d)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2624 (or d (setq file Info-current-file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2625 (if (and (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2626 (goto-char (min (point-max) (+ (point) 13)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2627 (and (search-backward "------ NOTE:\n" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2628 (setq pt (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2629 (search-forward "\n------\n" nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2630 (< (point) (match-end 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2631 (setq which (format "File: *%s *Node: *%s *Line:.*\n%s"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2632 (regexp-quote file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2633 (regexp-quote Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2634 (regexp-quote
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2635 (buffer-substring pt (match-beginning 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2636 where (max (- (point) pt) 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2637 (let ((node Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2638 (line (if (looking-at "[ \n]*\\'") 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2639 (count-lines (point-min) (point)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2640 (or which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2641 (let ((buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2642 (bufmod (buffer-modified-p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2643 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2644 (if (bobp) (goto-char (point-max)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2645 (insert "------ NOTE:\n------\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2646 (backward-char 20)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2647 (set-buffer-modified-p bufmod)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2648 ;; (setq Info-window-start (window-start))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2649 (setq Info-window-configuration (current-window-configuration))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2650 (pop-to-buffer (find-file-noselect (nth arg Info-annotations-path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2651 (use-local-map Info-annotate-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2652 (setq major-mode 'Info-annotate-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2653 (setq mode-name "Info Annotate")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2654 (if which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2655 (if (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2656 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2657 (re-search-forward which nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2658 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2659 (goto-char (match-beginning 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2660 (forward-line 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2661 (forward-char where)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2662 (let ((bufmod (buffer-modified-p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2663 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2664 (insert (format "\n------ File: %s Node: %s Line: %d\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2665 file node line))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2666 (setq pt (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2667 (insert "\n------\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2668 "\nPress C-c C-c to save and return to Info.\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2669 (goto-char pt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2670 (set-buffer-modified-p bufmod))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2671
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2672 (defun Info-cease-annotate ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2673 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2674 (let ((bufmod (buffer-modified-p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2675 (while (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2676 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2677 (re-search-forward "\n\n?Press .* to save and return to Info.\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2678 nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2679 (delete-region (1+ (match-beginning 0)) (match-end 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2680 (while (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2681 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2682 (re-search-forward "\n------ File:.*Node:.*Line:.*\n+------\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2683 nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2684 (delete-region (match-beginning 0) (match-end 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2685 (set-buffer-modified-p bufmod))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2686 (save-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2687 (fundamental-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2688 (bury-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2689 (or (one-window-p) (delete-window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2690 (info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2691 (setq Info-current-annotation-completions nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2692 (set-window-configuration Info-window-configuration)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2693 (Info-reannotate-node))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2694
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2695 (defun Info-bookmark (arg tag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2696 (interactive "p\nsBookmark name: ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2697 (Info-annotate arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2698 (if (or (string-match "^\"\\(.*\\)\"$" tag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2699 (string-match "^<<\\(.*\\)>>$" tag))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2700 (setq tag (substring tag (match-beginning 1) (match-end 1))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2701 (let ((pt (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2702 (search-forward "\n------\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2703 (let ((end (- (point) 8)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2704 (goto-char pt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2705 (if (re-search-forward "<<[^>\n]*>>" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2706 (delete-region (match-beginning 0) (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2707 (goto-char end))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2708 (or (equal tag "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2709 (insert "<<" tag ">>"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2710 (Info-cease-annotate))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2711
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2712 (defun Info-exit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2713 "Exit Info by selecting some other buffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2714 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2715 (if Info-standalone
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2716 (save-buffers-kill-emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2717 (bury-buffer (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2718 (if (and (featurep 'toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2719 (boundp 'toolbar-info-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2720 (eq toolbar-info-frame (selected-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2721 (condition-case ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2722 (delete-frame toolbar-info-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2723 (error (bury-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2724 (switch-to-buffer (other-buffer (current-buffer))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2725
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2726 (defun Info-undefined ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2727 "Make command be undefined in Info."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2728 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2729 (ding))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2730
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2731 (defun Info-help ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2732 "Enter the Info tutorial."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2733 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2734 (delete-other-windows)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2735 (Info-find-node "info"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2736 (if (< (window-height) 23)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2737 "Help-Small-Screen"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2738 "Help")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2739
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2740 (defun Info-summary ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2741 "Display a brief summary of all Info commands."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2742 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2743 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2744 (switch-to-buffer "*Help*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2745 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2746 (insert (documentation 'Info-mode))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2747 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2748 (let (flag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2749 (while (progn (setq flag (not (pos-visible-in-window-p (point-max))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2750 (message (if flag "Type Space to see more"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2751 "Type Space to return to Info"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2752 (let ((e (next-command-event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2753 (if (/= ?\ (event-to-character e))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2754 (progn (setq unread-command-event e) nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2755 flag)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2756 (scroll-up)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2757 (message "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2758 (bury-buffer "*Help*")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2759
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2760 (defun Info-get-token (pos start all &optional errorstring)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2761 "Return the token around POS,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2762 POS must be somewhere inside the token
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2763 START is a regular expression which will match the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2764 beginning of the tokens delimited string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2765 ALL is a regular expression with a single
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2766 parenthized subpattern which is the token to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2767 returned. E.g. '{\(.*\)}' would return any string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2768 enclosed in braces around POS.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2769 SIG optional fourth argument, controls action on no match
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2770 nil: return nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2771 t: beep
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2772 a string: signal an error, using that string."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2773 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2774 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2775 (re-search-backward "\\`") ; Bug fix due to Nicholas J. Foskett.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2776 (goto-char pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2777 (re-search-backward start (max (point-min) (- pos 200)) 'yes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2778 (let (found)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2779 (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2780 (not (setq found (and (<= (match-beginning 0) pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2781 (> (match-end 0) pos))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2782 (if (and found (<= (match-beginning 0) pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2783 (> (match-end 0) pos))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2784 (buffer-substring (match-beginning 1) (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2785 (cond ((null errorstring)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2786 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2787 ((eq errorstring t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2788 (beep)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2789 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2790 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2791 (error "No %s around position %d" errorstring pos)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2792
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2793 (defun Info-follow-clicked-node (event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2794 "Follow a node reference near clicked point. Like M, F, N, P or U command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2795 At end of the node's text, moves to the next node."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2796 (interactive "@e")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2797 (or (and (event-point event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2798 (Info-follow-nearest-node
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2799 (max (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2800 (select-window (event-window event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2801 (event-point event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2802 (1+ (point-min)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2803 (error "click on a cross-reference to follow")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2804
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2805 (defun Info-maybe-follow-clicked-node (event &optional click-count)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2806 "Follow a node reference (if any) near clicked point.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2807 Like M, F, N, P or U command. At end of the node's text, moves to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2808 next node. No error is given if there is no node to follow."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2809 (interactive "@e")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2810 (and Info-button1-follows-hyperlink
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2811 (event-point event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2812 (Info-follow-nearest-node
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2813 (max (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2814 (select-window (event-window event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2815 (event-point event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2816 (1+ (point-min))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2817
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2818 (defun Info-find-nearest-node (point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2819 (let (node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2820 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2821 ((= point (point-min)) nil) ; don't trigger on accidental RET.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2822 ((setq node (Info-get-token point
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2823 (format "\\*%s[ \n]" Info-footnote-tag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2824 (format "\\*%s[ \n]\\([^:]*\\):"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2825 Info-footnote-tag)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2826 (list "Following cross-reference %s..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2827 (list 'Info-follow-reference node)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2828 ((setq node (Info-get-token point "\\* " "\\* \\([^:]*\\)::"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2829 (list "Selecting menu item %s..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2830 (list 'Info-goto-node node nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2831 ((setq node (Info-get-token point "\\* " "\\* \\([^:]*\\):"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2832 (list "Selecting menu item %s..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2833 (list 'Info-menu node)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2834 ((setq node (Info-get-token point "Up: " "Up: \\([^,\n\t]*\\)"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2835 (list "Going up..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2836 (list 'Info-goto-node node)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2837 ((setq node (Info-get-token point "Next: " "Next: \\([^,\n\t]*\\)"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2838 (list "Next node..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2839 (list 'Info-goto-node node)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2840 ((setq node (Info-get-token point "File: " "File: \\([^,\n\t]*\\)"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2841 (list "Top node..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2842 (list 'Info-goto-node "Top")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2843 ((setq node (Info-get-token point "Prev[ious]*: "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2844 "Prev[ious]*: \\([^,\n\t]*\\)"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2845 (list "Previous node..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2846 (list 'Info-goto-node node)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2847 ((setq node (Info-get-token point "Node: " "Node: \\([^,\n\t]*\\)"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2848 (list "Reselecting %s..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2849 (list 'Info-goto-node node)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2850 ((save-excursion (goto-char point) (looking-at "[ \n]*\\'"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2851 (if Info-in-cross-reference
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2852 (list "Back to last node..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2853 '(Info-last))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2854 (list "Next node..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2855 '(Info-global-next)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2856 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2857
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2858 (defun Info-follow-nearest-node (point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2859 "Follow a node reference near point. Like M, F, N, P or U command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2860 At end of the node's text, moves to the next node."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2861 (interactive "d")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2862 (let ((data (Info-find-nearest-node point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2863 (if (null data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2864 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2865 (let ((msg (format (car data) (nth 1 (nth 1 data)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2866 (message "%s" msg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2867 (eval (nth 1 data))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2868 (message "%sdone" msg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2869 t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2870
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2871 (defun Info-indicated-node (event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2872 (condition-case ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2873 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2874 (cond ((eventp event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2875 (set-buffer (event-buffer event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2876 (setq event (event-point event))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2877 (let* ((data (Info-find-nearest-node event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2878 (name (nth 1 (nth 1 data))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2879 (and name (nth 1 data))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2880 (error nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2881
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2882 (defun Info-mouse-track-double-click-hook (event click-count)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2883 "Handle double-clicks by turning pages, like the `gv' ghostscript viewer"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2884 (if (/= click-count 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2885 ;; Return nil so any other hooks are performed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2886 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2887 (let* ((fw (face-width 'default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2888 (fh (face-height 'default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2889 (x (/ (event-x-pixel event) fw))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2890 (y (/ (event-y-pixel event) fw))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2891 (w (/ (window-pixel-width (event-window event)) fw))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2892 (h (/ (window-pixel-height (event-window event)) fh))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2893 (bx 3)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2894 (by 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2895 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2896 ((<= y by) (Info-up) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2897 ((>= y (- h by)) (Info-nth-menu-item 1) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2898 ((<= x bx) (Info-prev) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2899 ((>= x (- w bx)) (Info-next) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2900 (t nil)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2901
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2902 (defvar Info-mode-map nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2903 "Keymap containing Info commands.")
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2904
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2905 (if Info-mode-map
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2906 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2907 (setq Info-mode-map (make-sparse-keymap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2908 (suppress-keymap Info-mode-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2909 (define-key Info-mode-map "." 'beginning-of-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2910 (define-key Info-mode-map " " 'Info-scroll-next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2911 (define-key Info-mode-map "1" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2912 (define-key Info-mode-map "2" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2913 (define-key Info-mode-map "3" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2914 (define-key Info-mode-map "4" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2915 (define-key Info-mode-map "5" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2916 (define-key Info-mode-map "6" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2917 (define-key Info-mode-map "7" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2918 (define-key Info-mode-map "8" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2919 (define-key Info-mode-map "9" 'Info-nth-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2920 (define-key Info-mode-map "0" 'Info-last-menu-item)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2921 (define-key Info-mode-map "?" 'Info-summary)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2922 (define-key Info-mode-map "a" 'Info-annotate)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2923 (define-key Info-mode-map "b" 'beginning-of-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2924 (define-key Info-mode-map "d" 'Info-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2925 (define-key Info-mode-map "e" 'Info-edit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2926 (define-key Info-mode-map "f" 'Info-follow-reference)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2927 (define-key Info-mode-map "g" 'Info-goto-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2928 (define-key Info-mode-map "h" 'Info-help)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2929 (define-key Info-mode-map "i" 'Info-index)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2930 (define-key Info-mode-map "j" 'Info-goto-bookmark)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2931 (define-key Info-mode-map "k" 'Info-emacs-key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2932 (define-key Info-mode-map "l" 'Info-last)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2933 (define-key Info-mode-map "m" 'Info-menu)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2934 (define-key Info-mode-map "n" 'Info-next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2935 (define-key Info-mode-map "p" 'Info-prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2936 (define-key Info-mode-map "q" 'Info-exit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2937 (define-key Info-mode-map "r" 'Info-follow-reference)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2938 (define-key Info-mode-map "s" 'Info-search)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2939 (define-key Info-mode-map "t" 'Info-top)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2940 (define-key Info-mode-map "u" 'Info-up)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2941 (define-key Info-mode-map "v" 'Info-visit-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2942 (define-key Info-mode-map "x" 'Info-bookmark)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 456
diff changeset
2943 (define-key Info-mode-map "z" 'Info-search-next)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2944 (define-key Info-mode-map "<" 'Info-top)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2945 (define-key Info-mode-map ">" 'Info-end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2946 (define-key Info-mode-map "[" 'Info-global-prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2947 (define-key Info-mode-map "]" 'Info-global-next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2948 (define-key Info-mode-map "{" 'Info-page-prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2949 (define-key Info-mode-map "}" 'Info-page-next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2950 (define-key Info-mode-map "=" 'Info-restore-point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2951 (define-key Info-mode-map "!" 'Info-select-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2952 (define-key Info-mode-map "@" 'Info-follow-nearest-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2953 (define-key Info-mode-map "," 'Info-index-next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2954 (define-key Info-mode-map "*" 'Info-elisp-ref)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2955 (define-key Info-mode-map [tab] 'Info-next-reference)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2956 (define-key Info-mode-map [(meta tab)] 'Info-prev-reference)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2957 (define-key Info-mode-map [(shift tab)] 'Info-prev-reference)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2958 (define-key Info-mode-map "\r" 'Info-follow-nearest-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2959 ;; XEmacs addition
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2960 (define-key Info-mode-map 'backspace 'Info-scroll-prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2961 (define-key Info-mode-map 'delete 'Info-scroll-prev)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2962 (define-key Info-mode-map 'button2 'Info-follow-clicked-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2963 (define-key Info-mode-map 'button3 'Info-select-node-menu))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2964
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2965
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2966 ;; Info mode is suitable only for specially formatted data.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2967 (put 'info-mode 'mode-class 'special)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2968
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2969 (defun Info-mode ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2970 "Info mode is for browsing through the Info documentation tree.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2971 Documentation in Info is divided into \"nodes\", each of which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2972 discusses one topic and contains references to other nodes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2973 which discuss related topics. Info has commands to follow
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2974 the references and show you other nodes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2975
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2976 h Invoke the Info tutorial.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2977 q Quit Info: return to the previously selected file or buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2978
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2979 Selecting other nodes:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2980 n Move to the \"next\" node of this node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2981 p Move to the \"previous\" node of this node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2982 m Pick menu item specified by name (or abbreviation).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2983 1-9, 0 Pick first..ninth, last item in node's menu.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2984 Menu items select nodes that are \"subsections\" of this node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2985 u Move \"up\" from this node (i.e., from a subsection to a section).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2986 f or r Follow a cross reference by name (or abbrev). Type `l' to get back.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2987 RET Follow cross reference or menu item indicated by cursor.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2988 i Look up a topic in this file's Index and move to that node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2989 , (comma) Move to the next match from a previous `i' command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2990 l (letter L) Move back to the last node you were in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2991
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2992 Moving within a node:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2993 Space Scroll forward a full screen. DEL Scroll backward.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2994 b Go to beginning of node. Meta-> Go to end of node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2995 TAB Go to next cross-reference. Meta-TAB Go to previous ref.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2996
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2997 Mouse commands:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2998 Left Button Set point (usual text-mode functionality)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2999 Middle Button Click on a highlighted node reference to go to it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3000 Right Button Pop up a menu of applicable Info commands.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3001
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3002 Left Button Double Click in window edges:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3003 Top edge: Go up to the parent node, like `u'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3004 Left edge: Go to the previous node, like `p'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3005 Right edge: Go to the next node, like `n'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3006 Bottom edge: Follow first menu item, like `1'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3007
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3008 Advanced commands:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3009 g Move to node, file, or annotation tag specified by name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3010 Examples: `g Rectangles' `g (Emacs)Rectangles' `g Emacs'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3011 v Move to file, with filename completion.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3012 k Look up a key sequence in Emacs manual (also C-h C-k at any time).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3013 * Look up a function name in Emacs Lisp manual (also C-h C-f).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3014 d Go to the main directory of Info files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3015 < or t Go to Top (first) node of this file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3016 > Go to last node in this file.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3017 \[ Go to previous node, treating file as one linear document.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3018 \] Go to next node, treating file as one linear document.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3019 { Scroll backward, or go to previous node if at top.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3020 } Scroll forward, or go to next node if at bottom.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3021 = Restore cursor position from last time in this node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3022 a Add a private note (annotation) to the current node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3023 x, j Add, jump to a bookmark (annotation tag).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3024 s Search this Info file for a node containing the specified regexp.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3025 e Edit the contents of the current node."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3026 (kill-all-local-variables)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3027 (setq major-mode 'Info-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3028 (setq mode-name "Info")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3029 (use-local-map Info-mode-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3030 (set-syntax-table text-mode-syntax-table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3031 (setq local-abbrev-table text-mode-abbrev-table)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3032 (setq case-fold-search t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3033 (setq buffer-read-only t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3034 ; (setq buffer-mouse-map Info-mode-mouse-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3035 (make-local-variable 'Info-current-file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3036 (make-local-variable 'Info-current-subfile)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3037 (make-local-variable 'Info-current-node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3038 (make-local-variable 'Info-tag-table-marker)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3039 (setq Info-tag-table-marker (make-marker))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3040 (make-local-variable 'Info-tag-table-buffer)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3041 (setq Info-tag-table-buffer nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3042 (make-local-variable 'Info-current-file-completions)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3043 (make-local-variable 'Info-current-annotation-completions)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3044 (make-local-variable 'Info-index-alternatives)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3045 (make-local-variable 'Info-history)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3046 ;; Faces are now defined by `defface'...
548
0f4bdbb07414 [xemacs-hg @ 2001-05-20 21:36:06 by adrian]
adrian
parents: 502
diff changeset
3047 (make-local-hook 'mouse-track-click-hook)
0f4bdbb07414 [xemacs-hg @ 2001-05-20 21:36:06 by adrian]
adrian
parents: 502
diff changeset
3048 (add-hook 'mouse-track-click-hook 'Info-maybe-follow-clicked-node t t)
0f4bdbb07414 [xemacs-hg @ 2001-05-20 21:36:06 by adrian]
adrian
parents: 502
diff changeset
3049 (add-hook 'mouse-track-click-hook 'Info-mouse-track-double-click-hook t t)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3050 ;; #### The console-on-window-system-p check is to allow this to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3051 ;; work on tty's. The real problem here is that featurep really
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3052 ;; needs to have some device/console domain knowledge added to it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3053 (defvar info::toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3054 (if (and (featurep 'toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3055 (console-on-window-system-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3056 (not Info-inhibit-toolbar))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3057 (set-specifier default-toolbar (cons (current-buffer) info::toolbar)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3058 (if (featurep 'menubar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3059 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3060 ;; make a local copy of the menubar, so our modes don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3061 ;; change the global menubar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3062 (easy-menu-add '("Info" :filter Info-menu-filter))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3063 (run-hooks 'Info-mode-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3064 (Info-set-mode-line))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3065
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3066 (defvar Info-edit-map nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3067 "Local keymap used within `e' command of Info.")
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
3068
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3069 (if Info-edit-map
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3070 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3071 ;; XEmacs: remove FSF stuff
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3072 (setq Info-edit-map (make-sparse-keymap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3073 (set-keymap-name Info-edit-map 'Info-edit-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3074 (set-keymap-parents Info-edit-map (list text-mode-map))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3075 (define-key Info-edit-map "\C-c\C-c" 'Info-cease-edit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3076
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3077 ;; Info-edit mode is suitable only for specially formatted data.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3078 (put 'info-edit-mode 'mode-class 'special)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3079
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3080 (defun Info-edit-mode ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3081 "Major mode for editing the contents of an Info node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3082 Like text mode with the addition of `Info-cease-edit'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3083 which returns to Info mode for browsing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3084 \\{Info-edit-map}"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3085 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3086
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3087 (defun Info-edit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3088 "Edit the contents of this Info node.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3089 Allowed only if variable `Info-enable-edit' is non-nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3090 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3091 (or Info-enable-edit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3092 (error "Editing info nodes is not enabled"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3093 (use-local-map Info-edit-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3094 (setq major-mode 'Info-edit-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3095 (setq mode-name "Info Edit")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3096 (kill-local-variable 'modeline-buffer-identification)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3097 (setq buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3098 ;; Make mode line update.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3099 (set-buffer-modified-p (buffer-modified-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3100 (message (substitute-command-keys
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3101 "Editing: Type \\[Info-cease-edit] to return to info")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3103 (defun Info-cease-edit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3104 "Finish editing Info node; switch back to Info proper."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3105 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3106 ;; Do this first, so nothing has changed if user C-g's at query.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3107 (and (buffer-modified-p)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3108 (y-or-n-p "Save the file? ")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3109 (save-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3110 (use-local-map Info-mode-map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3111 (setq major-mode 'Info-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3112 (setq mode-name "Info")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3113 (Info-set-mode-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3114 (setq buffer-read-only t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3115 ;; Make mode line update.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3116 (set-buffer-modified-p (buffer-modified-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3117 (and (marker-position Info-tag-table-marker)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3118 (buffer-modified-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3119 (message "Tags may have changed. Use Info-tagify if necessary")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3121 (defun Info-find-emacs-command-nodes (command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3122 "Return a list of locations documenting COMMAND in the XEmacs Info manual.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3123 The locations are of the format used in Info-history, i.e.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3124 \(FILENAME NODENAME BUFFERPOS\)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3125 (let ((where '())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3126 (cmd-desc (concat "^\\* " (regexp-quote (symbol-name command))
3625
e5c8780c8229 [xemacs-hg @ 2006-10-15 00:50:50 by youngs]
youngs
parents: 2421
diff changeset
3127 ":\\s *\\(.*\\)\\.")))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3128 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3129 (Info-find-node "XEmacs" "Command Index")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3130 ;; Take the index node off the Info history.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3131 ;; ??? says this isn't safe someplace else... hmmm.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3132 (setq Info-history (cdr Info-history))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3133 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3134 (while (re-search-backward cmd-desc nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3135 (setq where (cons (list Info-current-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3136 (buffer-substring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3137 (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3138 (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3139 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3140 where)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3141 where)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3143 ;;; fontification and mousability for info
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3145 (defun Info-highlight-region (start end face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3146 (let ((extent nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3147 (splitp (string-match "\n[ \t]+" (buffer-substring start end))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3148 (if splitp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3149 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3150 (setq extent (make-extent start (progn (goto-char start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3151 (end-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3152 (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3153 (set-extent-face extent face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3154 (set-extent-property extent 'info t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3155 (set-extent-property extent 'highlight t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3156 (skip-chars-forward "\n\t ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3157 (setq extent (make-extent (point) end)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3158 (setq extent (make-extent start end)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3159 (set-extent-face extent face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3160 (set-extent-property extent 'info t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3161 (set-extent-property extent 'highlight t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3162
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3163 (defun Info-fontify-node ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3164 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3165 (let ((case-fold-search t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3166 (xref-regexp (concat "\\*"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3167 (regexp-quote Info-footnote-tag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3168 "[ \n\t]*\\([^:]*\\):")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3169 ;; Clear the old extents
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3170 (map-extents #'(lambda (x y) (delete-extent x))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3171 (current-buffer) (point-min) (point-max) nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3172 ;; Break the top line iff it is > 79 characters. Some info nodes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3173 ;; have top lines that span 3 lines because of long node titles.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3174 ;; eg: (Info-find-node "lispref.info" "Window-Level Event Position Info")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3175 (toggle-read-only -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3176 (let ((extent nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3177 (len 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3178 (done nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3179 (p (point-min)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3180 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3181 (re-search-forward "Node: *[^,]+, " nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3182 (setq len (- (point) (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3183 extent (make-extent (point-min) (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3184 (set-extent-property extent 'invisible t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3185 (while (not done)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3186 (goto-char p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3187 (end-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3188 (if (< (current-column) (+ 78 len))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3189 (setq done t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3190 (goto-char p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3191 (forward-char (+ 79 len))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3192 (re-search-backward "," nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3193 (forward-char 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3194 (insert "\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3195 (just-one-space)
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
3196 (delete-backward-char 1)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3197 (setq p (point)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3198 len 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3199 (toggle-read-only 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3200 ;; Highlight xrefs in the top few lines of the node
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3201 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3202 (if (looking-at "^File: [^,: \t]+,?[ \t]+")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3203 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3204 (goto-char (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3205 (while
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3206 (looking-at "[ \t]*[^:, \t\n]+:[ \t]+\\([^:,\t\n]+\\),?\n?")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3207 (goto-char (match-end 0))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
3208 (Info-highlight-region (match-beginning 1) (match-end 1)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
3209 'info-xref))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3210 ;; Now get the xrefs in the body
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3211 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3212 (while (re-search-forward xref-regexp nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3213 (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3214 nil
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
3215 (Info-highlight-region (match-beginning 1) (match-end 1)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
3216 'info-xref)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3217 ;; then highlight the nodes in the menu.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3218 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3219 (if (and (search-forward "\n* menu:" nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3220 (while (re-search-forward
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3221 "^\\* \\([^:\t\n]*\\):?:[ \t\n]" nil t)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
3222 (Info-highlight-region (match-beginning 1) (match-end 1)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
3223 'info-node)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3224 (set-buffer-modified-p nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3226 (defun Info-construct-menu (&optional event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3227 "Construct a menu of Info commands.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3228 Adds an entry for the node at EVENT, or under point if EVENT is omitted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3229 Used to construct the menubar submenu and popup menu."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3230 (or event (setq event (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3231 (let ((case-fold-search t)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3232 (xref-regexp (concat "\\*"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3233 (regexp-quote Info-footnote-tag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3234 "[ \n\t]*\\([^:]*\\):"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3235 up-p prev-p next-p menu xrefs subnodes in)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3236 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3237 ;; `one-space' fixes "Notes:" xrefs that are split across lines.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3238 (flet
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3239 ((one-space (text)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3240 (let (i)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3241 (while (setq i (string-match "[ \n\t]+" text i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3242 (setq text (concat (substring text 0 i) " "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3243 (substring text (match-end 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3244 (setq i (1+ i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3245 text)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3246 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3247 (if (looking-at ".*\\bNext:") (setq next-p t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3248 (if (looking-at ".*\\bPrev:") (setq prev-p t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3249 (if (looking-at ".*Up:") (setq up-p t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3250 (setq menu (nconc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3251 (if (setq in (Info-indicated-node event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3252 (list (vector (one-space (cadr in)) in t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3253 "--:shadowEtchedIn"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3254 (list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3255 ["Goto Info Top-level" Info-directory]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3256 (vector "Next Node" 'Info-next :active next-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3257 (vector "Previous Node" 'Info-prev :active prev-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3258 (vector "Parent Node (Up)" 'Info-up :active up-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3259 ["Goto Node..." Info-goto-node]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3260 ["Goto Last Visited Node " Info-last])))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3261 ;; Find the xrefs and make a list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3262 (while (re-search-forward xref-regexp nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3263 (setq xrefs (cons (one-space (buffer-substring (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3264 (match-end 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3265 xrefs))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3266 (setq xrefs (nreverse xrefs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3267 (if (> (length xrefs) 21) (setcdr (nthcdr 20 xrefs) '(more)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3268 ;; Find the subnodes and make a list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3269 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3270 (if (search-forward "\n* menu:" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3271 (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3272 (setq subnodes (cons (buffer-substring (match-beginning 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3273 (match-end 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3274 subnodes))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3275 (setq subnodes (nreverse subnodes))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3276 (if (> (length subnodes) 21) (setcdr (nthcdr 20 subnodes) '(more))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3277 (if xrefs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3278 (nconc menu (list "--:shadowDoubleEtchedIn"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3279 " Cross-References"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3280 "--:singleLine")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3281 (mapcar #'(lambda (xref)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3282 (if (eq xref 'more)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3283 "...more..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3284 (vector xref
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3285 (list 'Info-follow-reference xref))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3286 xrefs)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3287 (if subnodes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3288 (nconc menu (list "--:shadowDoubleEtchedIn"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3289 " Sub-Nodes"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3290 "--:singleLine")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3291 (mapcar #'(lambda (node)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3292 (if (eq node 'more)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3293 "...more..."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3294 (vector node (list 'Info-menu node))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3295 subnodes)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3296 menu))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3297
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3298 (defun Info-menu-filter (menu)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3299 "This is the menu filter for the \"Info\" submenu."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3300 (Info-construct-menu))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3302 (defun Info-select-node-menu (event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3303 "Pops up a menu of applicable Info commands."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3304 (interactive "e")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3305 (select-window (event-window event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3306 (let ((menu (Info-construct-menu event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3307 (setq menu (nconc (list "Info" ; title: not displayed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3308 " Info Commands"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3309 "--:shadowDoubleEtchedOut")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3310 menu))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3311 (let ((popup-menu-titles nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3312 (popup-menu menu))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3314 ;;; Info toolbar support
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3315
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3316 ;; exit icon taken from GNUS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3317 (defvar info::toolbar-exit-icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3318 (if (featurep 'toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3319 (toolbar-make-button-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3320 (expand-file-name (if (featurep 'xpm) "info-exit.xpm" "info-exit.xbm")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3321 toolbar-icon-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3322 "Exit Info icon")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3323
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3324 (defvar info::toolbar-up-icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3325 (if (featurep 'toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3326 (toolbar-make-button-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3327 (expand-file-name (if (featurep 'xpm) "info-up.xpm" "info-up.xbm")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3328 toolbar-icon-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3329 "Up icon")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3331 (defvar info::toolbar-next-icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3332 (if (featurep 'toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3333 (toolbar-make-button-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3334 (expand-file-name (if (featurep 'xpm) "info-next.xpm" "info-next.xbm")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3335 toolbar-icon-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3336 "Next icon")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3338 (defvar info::toolbar-prev-icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3339 (if (featurep 'toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3340 (toolbar-make-button-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3341 (expand-file-name (if (featurep 'xpm) "info-prev.xpm" "info-prev.xbm")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3342 toolbar-icon-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3343 "Prev icon")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3344
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3345 (defvar info::toolbar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3346 (if (featurep 'toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3347 ; disabled until we get the next/prev-win icons working again.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3348 ; (cons (first initial-toolbar-spec)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3349 ; (cons (second initial-toolbar-spec)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3350 '([info::toolbar-exit-icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3351 Info-exit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3352 t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3353 "Exit info"]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3354 [info::toolbar-next-icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3355 Info-next
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3356 t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3357 "Next entry in same section"]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3358 [info::toolbar-prev-icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3359 Info-prev
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3360 t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3361 "Prev entry in same section"]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3362 [info::toolbar-up-icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3363 Info-up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3364 t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3365 "Up entry to enclosing section"]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3366 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3367 ;))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3368
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3369 (provide 'info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3371 (run-hooks 'Info-load-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3372
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3373 ;;; info.el ends here