annotate lisp/behavior.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 ebb35ddea76a
children 2def0d83a5e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
1 ;;; behavior.el --- consistent interface onto packages
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
2
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
3 ;; Copyright (C) 2000, 2001, 2002, 2003 Ben Wing.
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
4
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
5 ;; Author: Ben Wing
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
6 ;; Maintainer: XEmacs Development Team
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
7 ;; Keywords: internal, dumped
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
8
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
9 ;; This file is part of XEmacs.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
10
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
14 ;; any later version.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
15
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
19 ;; General Public License for more details.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
20
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
25
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
26 ;;; Synched up with: Not in FSF.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
27
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
28 ;;; Authorship:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
29
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
30 ;; Created July 2000 by Ben Wing.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
31
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
32 ;;; Commentary:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
33
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
34 ;; This file is dumped with XEmacs.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
35
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
36 ;; This file is part of the "Behaviors" project and is a work in progress.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
37 ;; The purpose of the project is to provide (a) a consistent interface (at
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
38 ;; the API level) onto the functionality provided by packages, and (b) an
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
39 ;; easy-to-use user interface for this functionality, something that
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
40 ;; *really works*.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
41 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
42 ;; First, what characteristics do/should packages have? (NOTE: In this
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
43 ;; discussion below, `package' and `behavior' are being used more or less
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
44 ;; interchangeably. Eventually this will get resolved.)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
45
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
46 ;; 1) A file, or one or more file, containing the code of the package. In
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
47 ;; addition, a "head" file in the case that the package needs to be
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
48 ;; loaded in order to get its functionality (e.g. "load-to-enable"
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
49 ;; packages -- an abomination that is tolerated only with severe
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
50 ;; displeasure).
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
51 ;; 2) A Lisp name -- a fairly short symbol (2-3 words max), uncapitalized,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
52 ;; without use of excessive abbreviation and with words set off by
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
53 ;; dashes. This should be the same as the name of the topmost custom
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
54 ;; group associated with the package (see next item), and preferably the
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
55 ;; same as the common prefix used for variables defined by your package
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
56 ;; and the name of the head file of the package.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
57 ;; 3) Associated custom group listing the settings associated with the package.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
58 ;; 4) Enable and disable methods for turning on or off the functionality of
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
59 ;; the package, if it's amenable to such a model. Most packages are of two
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
60 ;; types:
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
61 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
62 ;; (a) They add some functionality to XEmacs, which is incorporated
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
63 ;; into and makes changes to the normal functionality of XEmacs. Once the
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
64 ;; package is enabled, the user doesn't have to do anything specific for
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
65 ;; the package to do its thing -- it happens automatically if the user is
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
66 ;; using the area whose behavior has been changed. These include packages
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
67 ;; such as `avoid' (which makes the mouse poointer move when the cursor
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
68 ;; gets too close), EFS (which adds the ability to treat an FTP site as
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
69 ;; part of the local file system), the packages that supply the
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
70 ;; mode-specific handling for various files, etc
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
71 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
72 ;; (b) They provide functionality in the form of specific command to be
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
73 ;; invoked. This can be as simple as the `hippie-expand' command (tries
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
74 ;; lots of different expansion methods for the text before point, to
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
75 ;; try and get a result) and as complicated as GNUS or VM.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
76 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
77 ;; Some packages might provide both -- you can enable them and they
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
78 ;; incorporate some functionality into the XEmacs base, but while
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
79 ;; they're enabled they provide certain commands. #### We need some
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
80 ;; thought here, and case-by-case analysis, to determine if this really
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
81 ;; makes sense -- can the enable/disable be removed and whatever needs
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
82 ;; to happen incorporated as part of the command? can the
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
83 ;; enable/disable just added to the commands?
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
84 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
85 ;; 5) Packages of type (b) just above will have a list of commands that can be
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
86 ;; run. They should be in standard menubar format -- i.e. just like a
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
87 ;; submenu, but without the initial string indidicating the name of the
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
88 ;; menu.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
89 ;; 6) Short doc string, for use in a menu item. *NOT* necessarily the same
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
90 ;; as the documentation for the Custom group, which is often too long.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
91 ;; 7) Long documentation.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
92 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
93 ;; Good package etiquette:
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
94 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
95 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
96 ;; -- Never mess with the menu yourself, or try to "cheat" by putting yourself
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
97 ;; high up in the hierarchy, e.g. at the top-level or directly off a
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
98 ;; top-level group that expects to contain only groups of groups, not
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
99 ;; end-level groups.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
100 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
101 ;; -- Never use the `override-behavior' commands or the like for specifying
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
102 ;; (in an overriding fashion) the exact appearance of the hierarchies.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
103 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
104 ;; -- For type (a), with enable/disable methods:
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
105 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
106 ;; (a) Loading the file should NOT DO ANYTHING. Not enable, not add hooks,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
107 ;; nothing.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
108 ;; (b) Both enable and disable hooks must exist. The disable hook must
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
109 ;; completely reset the environment to how it was before the package
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
110 ;; was enabled. This includes restoring the prior bindings for
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
111 ;; modified key bindings. #### We need some helper function to assist
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
112 ;; with remembering the old key bindings and putting them back only
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
113 ;; when new key bindings haven't been made -- but recognize when those
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
114 ;; new key bondings were attached as a result of loading another
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
115 ;; package, so that after any order of loading and unloading a series
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
116 ;; of packages, the original bindings will eventually occur. (Something
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
117 ;; like `advice' for key definitions.) Replacement of functions should
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
118 ;; happen through `advice'.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
119 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
120 ;; We recognize that many packages out there don't follow these precepts at
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
121 ;; all. Many or most of them are install-only, often happening
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
122 ;; automatically when the file is loaded. Converting these will be a step
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
123 ;; at a time: First, redo the latter type so that the initialization code
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
124 ;; is put into a function and not run automatically upon load. Next step,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
125 ;; try to provide some sort of disable. Third step, work on making sure
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
126 ;; that disable removes *everything* and enable puts it all back. Fourth
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
127 ;; step, work on properly advising keys and functions.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
128 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
129
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
130 ;; Comparison/Integration with Custom:
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
131
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
132 ;; Custom only handles variable settings, and has no concept of standard
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
133 ;; enable/disable methods for a package, a standard way of specifying
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
134 ;; package documentation, or a list of commands associated with a package.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
135 ;; Also, its groups do not always map very well onto packages and the
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
136 ;; resulting hierarchy is too big, confusing, difficult-to-navigate, and
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
137 ;; incoherent. More generally it does not address at all the basic problem
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
138 ;; that a hierarchy created in a decentralized fashion -- and by a large
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
139 ;; number of authors, some more competent than others -- will inevitably be
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
140 ;; incoherent when put together.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
141 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
142
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
143 ;; In general, ease-of-use was not the overarching goal of Custom. The
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
144 ;; primary goal of Custom seems to have been to provide a consistent interface
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
145 ;; and get all the packages to use it. Ease-of-use -- or even following
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
146 ;; established user-interface standards -- has taken a far-distant second, and
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
147 ;; appears in many respects to be an afterthought that never had any serious
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
148 ;; effort investigated into it.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
149 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
150 ;; The eventual intent of this project is to integrate with custom. The final
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
151 ;; intent of integration is that this project subsumes Custom completely,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
152 ;; making Custom the unified, user-friendly means of controlling XEmacs that
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
153 ;; has never properly existed. However, that will take a lot of work. For
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
154 ;; the meantime, the plan is to develop the Behavior subsystem independent of
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
155 ;; Custom, with ease-of-use as the primary goal, and get it to the point where
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
156 ;; it encompasses most packages out there, has stabilized its interface, and
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
157 ;; works well. At that point, we will consider integration with Custom. (Note
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
158 ;; that the hard part of the Behavior work is not actually behaviorizing the
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
159 ;; packages, but developing the interface itself.)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
160 ;;
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
161 ;; As for integrating with Custom -- ideally that would mean simply extending
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
162 ;; defgroup, but that is not really possible given that backward-compatibility
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
163 ;; would not work -- existing versions of `defgroup' give an error when
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
164 ;; presented with an unknown keyword. In practice, then, this might mean that
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
165 ;; a separate `define-behavior' command (or `defpackage', or the like) will
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
166 ;; still exist.
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
167
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
168 ;;; Code:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
169
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
170 ;; Hash table mapping behavior names to property lists, with entries for
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
171 ;; :group, :custom-group, :short-doc, :require, :enable, :disable,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
172 ;; and :commands.
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
173 (defconst behavior-hash-table (make-hash-table))
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
174 ;; Hash table mapping groups to property lists (entries for :group, :children,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
175 ;; :short-doc).
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
176 (defconst behavior-group-hash-table (make-hash-table))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
177 ;; Hash table with override information for groups.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
178 ;; :short-doc).
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
179 (defconst behavior-override-hash-table (make-hash-table))
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
180
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
181 (defvar within-behavior-enabling-disabling nil)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
182
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
183 (defgroup behaviors nil
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
184 "Behaviors -- high-level functionality interface.")
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
185
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
186 ;; List of enabled behaviors.
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
187 (defcustom enabled-behavior-list nil
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
188 "List of currently enabled behaviors.
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
189 Normally, don't set it directly; use `enable-behavior' or `disable-behavior'."
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
190 :initialize #'set-default
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
191 :set #'(lambda (sym val)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
192 (if within-behavior-enabling-disabling
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
193 (set sym val)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
194 (let* ((old-val enabled-behavior-list)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
195 (disable-list (set-difference old-val val))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
196 (enable-list (set-difference val old-val)))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
197 (dolist (b disable-list)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
198 (disable-behavior b t))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
199 (dolist (b enable-list)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
200 (enable-behavior b t))
897
7da79fbe37bb [xemacs-hg @ 2002-07-02 19:09:22 by stephent]
stephent
parents: 800
diff changeset
201 (assert (equal (sort (copy-sequence enabled-behavior-list) 'string-lessp)
7da79fbe37bb [xemacs-hg @ 2002-07-02 19:09:22 by stephent]
stephent
parents: 800
diff changeset
202 (sort (copy-sequence val) 'string-lessp))))))
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
203 :type '(repeat (symbol :tag "Behavior"))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
204 :group 'behaviors)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
205
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
206
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
207 (defvar behavior-history nil
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
208 "History of entered behaviors.")
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
209
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
210 (defun behavior-group-p (group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
211 "Non-nil if GROUP is the name of a valid behavior group."
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
212 (not (null (gethash group behavior-group-hash-table))))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
213
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
214 (defun check-behavior-group (group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
215 "Verify that GROUP is a valid behavior group, or nil.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
216 Return GROUP if so."
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
217 (or (behavior-group-p group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
218 (error 'invalid-argument "Invalid behavior group" group))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
219 group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
220
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
221 (defun* define-behavior (name doc-string &key
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
222 group custom-group
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
223 (short-doc
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
224 (capitalize-string-as-title
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
225 (replace-in-string (symbol-name name) "-" " ")))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
226 require enable disable commands
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
227 &allow-other-keys)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
228 ;; We allow other keys to allow for the possibility of extensions by
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
229 ;; later versions of XEmacs. Packages should be able to support those
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
230 ;; extensions without worrying about causing problems with older versions
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
231 ;; of XEmacs.
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
232 "Define a behavior named NAME.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
233 DOC-STRING must be specified, a description of what the behavior does
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
234 when it's enabled and how to further control it (typically through
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
235 custom variables). Accepted keywords are
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
236
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
237 :group Symbol naming the behavior group this behavior is within.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
238 :custom-group Symbol naming the custom group containing the options that
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
239 can be set in association with this behavior. If not specified,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
240 the custom group with the same name as the behavior will be
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
241 used, if it exists.
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
242 :short-doc A \"pretty\" version of the name, for use in menus. If omitted
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
243 a prettified name will be generated.
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
244 :require A single symbol or a list of such symbols, which need to be
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
245 present at enable time, or will be loaded using `require'.
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
246 :enable A function of no variables, which turns the behavior on.
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
247 :disable A function of no variables, which turns the behavior off.
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
248 :commands A list of interactive commands that can be invoked in
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
249 conjunction with the behavior. These will appear in a submenu
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
250 along with the rest of the items for the behavior.
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
251
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
252 Behaviors are assumed to be global, and to take effect immediately; if
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
253 the underlying package is per-buffer, it may have to scan all existing
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
254 buffers and frob them. When a behavior is disabled, it should completely
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
255 go away *everywhere*, as if it were never invoked at all.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
256
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
257 The :disable keyword can be missing, although this is considered bad
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
258 practice. In such a case, attempting to disable the behavior will signal
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
259 an error unless you use the `force' option.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
260
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
261 The :enable keyword can be missing. This is useful for behaviors that
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
262 are really a series of related commands without anything semantically
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
263 corresponding to \"turning on\" or \"turning off\" the behavior.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
264
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
265 A behavior with no :enable and no :command is possible. This might be
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
266 used, for example, by a behavior that encapsulates a series of related
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
267 Lisp functions. Such behaviors may be handled specially, e.g. not
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
268 displayed in the menus or displayed in a separate location, since they
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
269 have no user-invocable behavior."
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
270 (let ((entry (list :group (check-behavior-group group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
271 :custom-group custom-group
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
272 :short-doc short-doc :require require
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
273 :enable enable :disable disable
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
274 :commands commands)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
275 (puthash name entry behavior-hash-table))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
276 ;; update the children list of the group we're in (maybe nil).
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
277 (unless (member name (getf (gethash group behavior-group-hash-table)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
278 :children))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
279 (push name (getf (gethash group behavior-group-hash-table) :children))))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
280
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
281 (defun* override-behavior (name &key
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
282 short-doc
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
283 group
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
284 include
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
285 demote-others)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
286 "Override the default properties of a behavior group NAME.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
287 Normally, groups are created and assigned properties by individual packages.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
288 The resulting hierarchy may not make much sense globally. This function
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
289 allows the hierarchy and appearance of a group to be specified globally,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
290 and will take precendence over the properties assigned by `define-behavior-group'. This allows a global organization to be imposed on groups, while still allowing for graceful handling of new or unknown groups.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
291
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
292 NAME can be a symbol specifying a group name, or a list of
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
293 \(PARENT [...] NAME), where a path from a particular parent is explicitly
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
294 given. (This latter form allows the same name to be assigned to more than one
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
295 group.)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
296
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
297 Accepted keywords are
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
298
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
299 :short-doc A \"pretty\" version of the name, for use in menus.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
300 :group Parent group, if any. Should not be given if the parents are
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
301 explicitly specified in NAME.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
302 :include A list of behaviors that are specifically included in this
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
303 group, in addition to those that are included by the behaviors
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
304 themselves.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
305 :demote-others If non-nil, exclude all behaviors not specified in the :include
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
306 list and put them instead (i.e. \"demote\" them) to another group,
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
307 usually a subgroup."
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
308 (let ((entry (list :group (check-behavior-group group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
309 :short-doc short-doc
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
310 :include include
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
311 :demote-others demote-others)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
312 (puthash name entry behavior-override-hash-table)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
313
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
314 (defun* define-behavior-group (name &key
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
315 (short-doc
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
316 (capitalize-string-as-title
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
317 (replace-in-string (symbol-name name) "-"
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
318 " ")))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
319 group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
320 "Define a behavior group NAME.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
321
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
322 NAME can be a symbol specifying a group name, or a list of
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
323 \(PARENT [...] NAME), where a path from a particular parent is explicitly
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
324 given. (This latter form allows the same name to be assigned to more than one
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
325 group.)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
326
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
327 Accepted keywords are
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
328
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
329 :short-doc A \"pretty\" version of the name, for use in menus. If omitted
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
330 a prettified name will be generated.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
331 :group Parent group, if any. Should not be given if the parents are
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
332 explicitly specified in NAME."
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
333 (let ((entry (list :group (check-behavior-group group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
334 :short-doc short-doc)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
335 (puthash name entry behavior-group-hash-table))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
336 ;; update the children list of the parent (maybe nil).
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
337 (push name (getf (gethash group behavior-group-hash-table) :children)))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
338
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
339 (defun read-behavior (prompt &optional must-match initial-contents history
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
340 default-value)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
341 "Return a behavior symbol from the minibuffer, prompting with string PROMPT.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
342 If non-nil, optional second arg INITIAL-CONTENTS is a string to insert
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
343 in the minibuffer before reading.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
344 Third arg HISTORY, if non-nil, specifies a history list. (It defaults to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
345 `behavior-history'.)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
346 Fourth arg DEFAULT-VALUE is the default value. If non-nil, it is used
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
347 for history command, and as the value to return if the user enters the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
348 empty string."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
349 (let ((result
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
350 (completing-read
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
351 prompt
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
352 (let ((table (let (lis)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
353 (maphash #'(lambda (key val)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
354 (push (cons key val) lis))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
355 behavior-hash-table)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
356 (nreverse lis))))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
357 (mapc #'(lambda (aentry)
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
358 (setcar aentry (symbol-name (car aentry))))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
359 table)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
360 table)
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
361 nil must-match initial-contents (or history 'behavior-history)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
362 default-value)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
363 (if (and result (stringp result))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
364 (intern result)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
365 result)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
366
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
367 (defun behavior-enabled-p (behavior)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
368 "Non-nil if BEHAVIOR (a symbol) if currently enabled."
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
369 (memq behavior enabled-behavior-list))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
370
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
371 (defun enable-behavior (behavior &optional force)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
372 "Enable the specified behavior."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
373 (interactive (list (read-behavior "Enable Behavior: " t) current-prefix-arg))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
374 (let ((plist (gethash behavior behavior-hash-table)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
375 (or plist (error 'invalid-argument "Not a behavior" behavior))
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
376 (or force (not (memq behavior enabled-behavior-list))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
377 (error 'invalid-change "Behavior already enabled" behavior))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
378 (let ((require (getf plist :require))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
379 (enable (getf plist :enable)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
380 (cond ((listp require)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
381 (mapc #'(lambda (sym) (require sym)) require))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
382 ((symbolp require)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
383 (require require))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
384 ((null require))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
385 (t (error 'invalid-argument "Invalid :require spec" require)))
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
386 (message "Enabling behavior %s..." behavior)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
387 (if enable (funcall enable))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
388 (message "Enabling behavior %s...done" behavior)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
389 (let ((within-behavior-enabling-disabling t))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
390 (customize-set-variable 'enabled-behavior-list
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
391 (cons behavior enabled-behavior-list))))))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
392
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
393 (defun disable-behavior (behavior &optional force)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
394 "Disable the specified behavior."
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
395 (interactive (list (read-behavior "Disable Behavior: " t)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
396 current-prefix-arg))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
397 (let ((plist (gethash behavior behavior-hash-table)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
398 (or plist (error 'invalid-argument "Not a behavior" behavior))
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
399 (or force (memq behavior enabled-behavior-list)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
400 (error 'invalid-change "Behavior not enabled" behavior))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
401 (let ((require (getf plist :require))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
402 (disable (getf plist :disable)))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
403 (cond ((listp require)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
404 (mapc #'(lambda (sym) (require sym)) require))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
405 ((symbolp require)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
406 (require require))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
407 ((null require))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
408 (t (error 'invalid-argument "Invalid :require spec" require)))
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
409 (message "Disabling behavior %s..." behavior)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
410 (if disable (funcall disable))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
411 (message "Disabling behavior %s...done" behavior)
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
412 (let ((within-behavior-enabling-disabling t))
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
413 (customize-set-variable 'enabled-behavior-list
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 502
diff changeset
414 (delq behavior enabled-behavior-list))))))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
415
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
416 (defun compute-behavior-group-children (group hash)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
417 "Compute the actual children for GROUP and its subgroups.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
418 This takes into account the override information specified."
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
419 (let* ((group-plist (gethash group behavior-group-hash-table))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
420 (override (gethash group behavior-override-hash-table))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
421 (children (getf group-plist :children)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
422 )
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
423 )
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
424
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
425 (defun behavior-menu-filter-1 (menu group)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
426 (submenu-generate-accelerator-spec
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
427 (let* (
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
428 ;;options
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
429 ;;help
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
430 (enable
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
431 (menu-split-long-menu
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
432 (menu-sort-menu
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
433 (let ((group-plist (gethash group behavior-group-hash-table)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
434 (loop for behavior in (getf group-plist :children)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
435 nconc (if (behavior-group-p behavior)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
436 (list
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
437 (cons (getf
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
438 (gethash behavior behavior-group-hash-table)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
439 :short-doc)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
440 (behavior-menu-filter-1 menu behavior)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
441 (let* ((plist (gethash behavior behavior-hash-table))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
442 (commands (getf plist :commands)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
443 (nconc
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
444 (if (getf plist :enable)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
445 `([,(format "%s (%s) [toggle]"
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
446 (getf plist :short-doc)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
447 behavior)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
448 (if (memq ',behavior
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
449 enabled-behavior-list)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
450 (disable-behavior ',behavior)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
451 (enable-behavior ',behavior))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
452 :active ,(if (getf plist :disable) t
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
453 (not (memq
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
454 ',behavior
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
455 enabled-behavior-list)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
456 :style toggle
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
457 :selected (memq ',behavior
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
458 enabled-behavior-list)]))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
459 (cond ((null commands) nil)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
460 ((and (eq (length commands) 1)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
461 (vectorp (elt commands 0)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
462 (let ((comm (copy-sequence
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
463 (elt commands 0))))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
464 (setf (elt comm 0)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
465 (format "%s (%s)"
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
466 (elt comm 0) behavior))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
467 (list comm)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
468 (t (list
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
469 (cons (format "%s (%s) Commands"
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
470 (getf plist :short-doc)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
471 behavior)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
472 commands)))))))))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
473 ))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
474 )
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
475 )
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
476 enable)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
477 '(?p)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
478
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
479 (defun behavior-menu-filter (menu)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
480 (append
4372
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
481 `(("%_Package Utilities"
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
482 ("%_Set Download Site"
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
483 ("%_Official Releases"
4372
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
484 :filter ,#'(lambda (&rest junk)
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
485 (menu-split-long-menu
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
486 (submenu-generate-accelerator-spec
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
487 (package-ui-download-menu)))))
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
488 ("%_Pre-Releases"
4372
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
489 :filter ,#'(lambda (&rest junk)
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
490 (menu-split-long-menu
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
491 (submenu-generate-accelerator-spec
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
492 (package-ui-pre-release-download-menu)))))
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
493 ("%_Site Releases"
4372
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
494 :filter ,#'(lambda (&rest junk)
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
495 (menu-split-long-menu
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
496 (submenu-generate-accelerator-spec
ebb35ddea76a Byte-compile menu lambdas; make the menu of available tutorials more readable.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2546
diff changeset
497 (package-ui-site-release-download-menu))))))
2546
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
498 "--:shadowEtchedIn"
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
499 ["%_Update Package Index" package-get-update-base]
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
500 ["%_List and Install" pui-list-packages]
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
501 ["U%_pdate Installed Packages" package-get-update-all]
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
502 ["%_Help" (Info-goto-node "(xemacs)Packages")])
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
503 "----")
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
504 (behavior-menu-filter-1 menu nil)))
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
505
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
506 ;; Initialize top-level group.
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
507 (puthash nil '(:children nil :short-doc "Root") behavior-group-hash-table)
5d1743698fb3 [xemacs-hg @ 2005-02-03 05:26:39 by ben]
ben
parents: 1346
diff changeset
508
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
509 (provide 'behavior)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
510
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents:
diff changeset
511 ;;; finder-inf.el ends here