annotate lisp/package-ui.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 e29fcfd8df5f
children 2e528066e2fc
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 ;;; package-ui.el ---
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1998 by Darryl Okahata
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Author: Darryl Okahata <darrylo@sr.hp.com>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Keywords: internal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; 02111-1307, USA.
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 ;;; Synched up with: Not in FSF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 (require 'package-get) ;; which, in turn, requires 'package-admin
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;; User-changeable variables:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 (defgroup pui nil
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
34 "Convenient interface to the package system."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 :group 'package-tools
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 :tag "Package User interface"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 :prefix "pui-")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 (defcustom pui-package-install-dest-dir nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 "*If non-nil (Automatic) path to package tree to install packages in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 Otherwise, use old path for installed packages and make a guess for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 new ones."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 :group 'pui
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 :tag "Install Location"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 :type '(choice (const :tag "Automatic" nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 (directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 (defcustom pui-list-verbose t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 "*If non-nil, display verbose info in the package list buffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 :group 'pui
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 :tag "Verbose Listing"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 :type 'boolean)
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 (defcustom pui-up-to-date-package-face nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 "*The face to use for packages that are up-to-date."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 :group 'pui
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 :type 'face)
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 (defcustom pui-selected-package-face 'bold
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 "*The face to use for selected packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 Set this to `nil' to use the `default' face."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 :group 'pui
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 :type 'face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 (defcustom pui-deleted-package-face 'blue
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 "*The face to use for packages marked for removal.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 Set this to `nil' to use the `default' face."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 :group 'pui
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 :type 'face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 (defcustom pui-outdated-package-face 'red
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 "*The face to use for outdated packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 Set this to `nil' to use the `default' face."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 :group 'pui
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 :type 'face)
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 (defcustom pui-uninstalled-package-face 'italic
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 "*The face to use for uninstalled packages.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 Set this to `nil' to use the `default' face."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 :group 'pui
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 :type 'face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
83 (defcustom pui-info-buffer "*Packages*"
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
84 "*Buffer to use for displaying package information."
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
85 :group 'pui
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
86 :type 'string)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
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 ;; End of user-changeable variables.
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 (defvar pui-selected-packages nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 "The list of user-selected packages to install.")
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 (defvar pui-deleted-packages nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 "The list of user-selected packages to remove.")
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 (defvar pui-actual-package "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 (defvar pui-display-keymap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 (let ((m (make-keymap)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 (suppress-keymap m)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 (set-keymap-name m 'pui-display-keymap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 (define-key m "q" 'pui-quit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 (define-key m "g" 'pui-list-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 (define-key m "i" 'pui-display-info)
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
107 (define-key m "m" 'pui-display-maintainer)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 (define-key m "?" 'describe-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 (define-key m "v" 'pui-toggle-verbosity-redisplay)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 (define-key m "d" 'pui-toggle-package-delete-key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 (define-key m "D" 'pui-toggle-package-delete-key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 (define-key m [return] 'pui-toggle-package-key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 (define-key m "x" 'pui-install-selected-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 (define-key m "I" 'pui-install-selected-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 (define-key m "r" 'pui-add-required-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 (define-key m "n" 'next-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 (define-key m "+" 'pui-toggle-package-key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 (define-key m "p" 'previous-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 (define-key m " " 'scroll-up-command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 (define-key m [delete] 'scroll-down-command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 m)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 "Keymap to use in the `pui-info-buffer' buffer")
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 (defvar pui-package-keymap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 (let ((m (make-sparse-keymap)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 (set-keymap-name m 'pui-package-keymap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 (define-key m 'button2 'pui-toggle-package-event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 ;; We use a popup menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 (define-key m 'button3 'pui-popup-context-sensitive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 m)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 "Keymap to use over package names/descriptions.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
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 ;; End of variables
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 ;; Configuration routines
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 (defun package-ui-add-site (site)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 "Add site to package-get-remote and possibly offer to update package list."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 (let ((had-none (null package-get-remote)))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
144 (setq package-get-remote site)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 (when (and had-none package-get-was-current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 (y-or-n-p "Update Package list?"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 (setq package-get-was-current nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 (package-get-require-base t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 (if (get-buffer pui-info-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 (pui-list-packages))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 (set-menubar-dirty-flag)))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
153
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
154 ;;;###autoload
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
155 (defun package-ui-download-menu ()
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
156 "Build the `Add Download Site' menu."
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
157 (mapcar (lambda (site)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
158 (vector (car site)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
159 `(if (equal package-get-remote (quote ,(cdr site)))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
160 (setq package-get-remote nil)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
161 (package-ui-add-site (quote ,(cdr site))))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
162 ;; I've used radio buttons so that only a single
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
163 ;; site can be selected, but they are in fact
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
164 ;; toggles. SY.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
165 :style 'radio
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
166 :selected `(equal package-get-remote (quote ,(cdr site)))))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
167 package-get-download-sites))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 ;;;###autoload
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
170 (defun package-ui-pre-release-download-menu ()
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
171 "Build the 'Pre-Release Download Sites' menu."
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
172 (mapcar (lambda (site)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
173 (vector (car site)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
174 `(if (equal package-get-remote (quote ,(cdr site)))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
175 (setq package-get-remote nil)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
176 (package-ui-add-site (quote ,(cdr site))))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
177 ;; I've used radio buttons so that only a single
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
178 ;; site can be selected, but they are in fact
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
179 ;; toggles. SY.
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
180 :style 'radio
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
181 :selected `(equal package-get-remote (quote ,(cdr site)))))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
182 package-get-pre-release-download-sites))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
183
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
184 ;;;###autoload
1374
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
185 (defun package-ui-site-release-download-menu ()
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
186 "Build the 'Site Release Download Sites' menu."
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
187 (mapcar (lambda (site)
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
188 (vector (car site)
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
189 `(if (equal package-get-remote (quote ,(cdr site)))
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
190 (setq package-get-remote nil)
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
191 (package-ui-add-site (quote ,(cdr site))))
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
192 ;; I've used radio buttons so that only a single
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
193 ;; site can be selected, but they are in fact
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
194 ;; toggles. SY.
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
195 :style 'radio
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
196 :selected `(equal package-get-remote (quote ,(cdr site)))))
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
197 package-get-site-release-download-sites))
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
198
d638fc15d68b [xemacs-hg @ 2003-03-24 11:10:54 by adrian]
adrian
parents: 1365
diff changeset
199 ;;;###autoload
1647
d90ba01b5346 [xemacs-hg @ 2003-08-27 17:18:20 by youngs]
youngs
parents: 1410
diff changeset
200 (defun pui-set-local-package-get-directory ()
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
201 "Set a new package binary directory in `package-get-remote'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 Note that no provision is made for saving any changes made by this function.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 It exists mainly as a convenience for one-time package installations from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 disk."
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
205 (interactive)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
206 (let ((dir (read-directory-name
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
207 "New package binary directory to add? "
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
208 nil nil t)))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
209 (setq package-get-remote (list nil dir))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
210 (message "Package directory \"%s\" added." dir)))
428
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 ;; Package list/installer routines
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 (defun pui-quit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 (kill-buffer nil))
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 (defun pui-package-symbol-char (pkg-sym version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 (if (package-get-info-find-package packages-package-list pkg-sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 (let ((installed (package-get-key pkg-sym :version)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 (if (>= (if (stringp installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 (string-to-number installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 (if (stringp version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 (string-to-number version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 (list " " pui-up-to-date-package-face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 (list "*" pui-outdated-package-face)))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
231 (list "-" pui-uninstalled-package-face))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 (defun pui-update-package-display (extent &optional pkg-sym version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 "Update the package status for EXTENT.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 If PKG-SYM or VERSION are not given, they are read from the extent.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 These are used to determine whether or not the package is installed,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 and whether or not it is up-to-date."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 (let (buffer-read-only disp sym-char)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 (if (not pkg-sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 (setq pkg-sym (extent-property extent 'pui-package)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 (if (not version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 (setq version (package-get-info-prop (extent-property extent 'pui-info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 'version)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 (cond ((member pkg-sym pui-selected-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 (if pui-selected-package-face
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 (set-extent-face extent (get-face pui-selected-package-face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 (set-extent-face extent (get-face 'default)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 (setq sym-char "+"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 ((member pkg-sym pui-deleted-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 (if pui-deleted-package-face
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 (set-extent-face extent (get-face pui-deleted-package-face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 (set-extent-face extent (get-face 'default)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 (setq sym-char "D"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 (setq disp (pui-package-symbol-char pkg-sym version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 (setq sym-char (car disp))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 (if (car (cdr disp))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 (set-extent-face extent (get-face (car (cdr disp))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 (set-extent-face extent (get-face 'default)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 (goto-char (extent-start-position extent))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 (delete-char 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 (insert sym-char)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
264 (set-buffer-modified-p nil))))
428
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 (defun pui-toggle-package (extent)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 (let (pkg-sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 (setq pkg-sym (extent-property extent 'pui-package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 (if (member pkg-sym pui-selected-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 (setq pui-selected-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 (delete pkg-sym pui-selected-packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 (setq pui-selected-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 (cons pkg-sym pui-selected-packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 (setq pui-deleted-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 (delete pkg-sym pui-deleted-packages)))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
276 (pui-update-package-display extent pkg-sym)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 (defun pui-toggle-package-key ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 "Select/unselect package for installation, using the keyboard."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 (let (extent)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 (if (setq extent (extent-at (point) (current-buffer) 'pui))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 (pui-toggle-package extent)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
285 (forward-line 1))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
286 (error 'invalid-operation
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
287 "No package under cursor!"))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 (defun pui-toggle-package-delete (extent)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 (let (pkg-sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 (setq pkg-sym (extent-property extent 'pui-package))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 (if (member pkg-sym pui-deleted-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 (setq pui-deleted-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 (delete pkg-sym pui-deleted-packages))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 (setq pui-deleted-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 (cons pkg-sym pui-deleted-packages))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
297 (setq pui-selected-packages
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 (delete pkg-sym pui-selected-packages)))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
299 (pui-update-package-display extent pkg-sym)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300
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 (defun pui-toggle-package-delete-key ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 "Select/unselect package for removal, using the keyboard."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 (let (extent)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 (if (setq extent (extent-at (point) (current-buffer) 'pui))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 (pui-toggle-package-delete extent)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
309 (forward-line 1))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
310 (error 'invalid-operation
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
311 "No package under cursor!"))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 (defun pui-current-package ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 (let ((extent (extent-at (point) (current-buffer) 'pui)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 (if extent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 (extent-property extent 'pui-package))))
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 (defun pui-toggle-package-event (event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 "Select/unselect package for installation, using the mouse."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 (interactive "e")
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
321 (let* ((ep (event-point event))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
322 (buffer (window-buffer (event-window event)))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
323 (extent (extent-at ep buffer 'pui-package)))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
324 (pui-toggle-package extent)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 (defun pui-toggle-verbosity-redisplay ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 "Toggle verbose package info."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 (setq pui-list-verbose (not pui-list-verbose))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
331 (pui-list-packages)))
428
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 (defun pui-install-selected-packages ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 "Install selected packages."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 (interactive)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
336 (let ((tmpbuf "*Packages-To-Remove*")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
337 do-delete)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 (when pui-deleted-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 (with-output-to-temp-buffer tmpbuf
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 (display-completion-list (sort
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
342 (mapcar #'symbol-name pui-deleted-packages)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
343 #'string<)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 :activate-callback nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 :help-string "Packages selected for removal:\n"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
346 :completion-string t))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 (setq tmpbuf (get-buffer-create tmpbuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 (display-buffer tmpbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 (setq do-delete (yes-or-no-p "Remove these packages? "))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 (kill-buffer tmpbuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 (when do-delete
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 (message "Deleting selected packages ...") (sit-for 0)
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
353 (mapc (lambda (pkg)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
354 (package-admin-delete-binary-package
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
355 pkg (package-admin-get-install-dir pkg)))
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
356 (nreverse pui-deleted-packages))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 (message "Packages deleted"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
359 (let ((tmpbuf "*Packages-To-Install*")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
360 do-install)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 (if pui-selected-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 ;; Don't change window config when asking the user if he really
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 ;; wants to install the packages. We do this to avoid messing up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 ;; the window configuration if errors occur (we don't want to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 ;; display random buffers in addition to the error buffer, if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 ;; errors occur, which would normally be caused by display-buffer).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 (with-output-to-temp-buffer tmpbuf
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
370 (display-completion-list
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
371 (sort (mapcar #'symbol-name pui-selected-packages) #'string<)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
372 :activate-callback nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
373 :help-string "Packages selected for installation:\n"
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
374 :completion-string t))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 (setq tmpbuf (get-buffer-create tmpbuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 (display-buffer tmpbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 (setq do-install (y-or-n-p "Install these packages? "))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
378 (kill-buffer tmpbuf))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 (if do-install
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 ;; Clear old temp buffer history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 (set-buffer (get-buffer-create package-admin-temp-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 (buffer-disable-undo package-admin-temp-buffer)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
385 (erase-buffer package-admin-temp-buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 (message "Installing selected packages ...") (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 (if (catch 'done
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
388 (mapc (lambda (pkg)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
389 (if (not (package-get pkg nil nil
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
390 pui-package-install-dest-dir))
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
391 (throw 'done nil)))
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
392 (nreverse pui-selected-packages))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 (pui-list-packages)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
396 (message "Packages installed"))))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
397 (clear-message)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 (if pui-deleted-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 (pui-list-packages)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
400 (error 'invalid-operation
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
401 "No packages have been selected!")))
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 442
diff changeset
402 ;; sync with windows type systems
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
403 (package-net-update-installed-db)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 (defun pui-add-required-packages ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 "Select packages required by those already selected for installation."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 (let ((tmpbuf "*Required-Packages*") do-select)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 (if pui-selected-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 (let ((dependencies
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 (delq nil (mapcar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 (lambda (pkg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 (let ((installed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 (package-get-key pkg :version))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 (current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 (package-get-info-prop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 (package-get-info-version
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 (package-get-info-find-package
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 package-get-base pkg) nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 'version)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 (if (or (null installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 (< (if (stringp installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 (string-to-number installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 installed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 (if (stringp current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 (string-to-number current)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 current)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 pkg
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 (package-get-dependencies pui-selected-packages)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 ;; Don't change window config when asking the user if he really
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 ;; wants to add the packages. We do this to avoid messing up
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 ;; the window configuration if errors occur (we don't want to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 ;; display random buffers in addition to the error buffer, if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 ;; errors occur, which would normally be caused by display-buffer).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (save-window-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 (with-output-to-temp-buffer tmpbuf
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 (display-completion-list (sort
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 (mapcar #'(lambda (pkg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 (symbol-name pkg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 dependencies)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 'string<)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 :activate-callback nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 :help-string "Required packages:\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 :completion-string t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (setq tmpbuf (get-buffer-create tmpbuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 (display-buffer tmpbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 (setq do-select (y-or-n-p "Select these packages? "))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 (kill-buffer tmpbuf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 (if do-select
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 (setq pui-selected-packages
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 (union pui-selected-packages dependencies))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 (map-extents #'(lambda (extent maparg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 (pui-update-package-display extent))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 nil nil nil nil nil 'pui)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 (message "added dependencies"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 (clear-message)))
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
459 (error 'invalid-operation
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
460 "No packages have been selected!"))))
428
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 (defun pui-help-echo (extent &optional force-update)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 "Display additional package info in the modeline.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 EXTENT determines the package to display (the package information is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 attached to the extent as properties)."
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
466 (let (pkg-sym info inst-ver inst-auth-ver auth-ver date maintainer balloon req)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 (if (or force-update (not (current-message))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
468 (string-match ".*: .*: " (current-message)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 (setq pkg-sym (extent-property extent 'pui-package)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 info (extent-property extent 'pui-info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 inst-ver (package-get-key pkg-sym :version)
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
473 inst-auth-ver (package-get-key pkg-sym :author-version)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 auth-ver (package-get-info-prop info 'author-version)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 date (package-get-info-prop info 'date)
852
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
476 maintainer (package-get-info-prop info 'maintainer)
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
477 req (package-get-info-prop info 'requires))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 (if (not inst-ver)
852
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
479 (setq inst-ver 0))
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
480 (if (featurep 'balloon-help)
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
481 (progn
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
482 (setq balloon (format "
2146
e4307a6b9ebb [xemacs-hg @ 2004-06-21 18:26:18 by adrian]
adrian
parents: 1742
diff changeset
483 Package Information: [For package: \"%s\"]\n================
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
484 Installed Upstream Ver: %s Available Upstream Ver: %s
852
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
485 Maintainer : %s
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
486 Released : %s
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
487 Required Packages : %s\n\n"
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
488 pkg-sym inst-auth-ver auth-ver maintainer
852
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
489 date req))
d83885ef293b [xemacs-hg @ 2002-05-25 01:55:29 by youngs]
youngs
parents: 624
diff changeset
490 (set-extent-property extent 'balloon-help balloon)))
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
491 (format
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
492 "Installed upstream ver: %s Available upstream ver: %s"
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
493 inst-auth-ver auth-ver)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (defun pui-display-info (&optional no-error event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 "Display additional package info in the modeline.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 Designed to be called interactively (from a keypress)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 (let (extent)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 (beginning-of-line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 (if (setq extent (extent-at (point) (current-buffer) 'pui))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 (message (pui-help-echo extent t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 (if no-error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 (clear-message nil)
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
506 (error 'invalid-operation
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
507 "No package under cursor!"))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
509 (defun pui-display-maintainer (&optional no-error event)
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
510 "Display a package's maintainer in the minibuffer."
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
511 (interactive)
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2146
diff changeset
512 (let (extent ;pkg-sym
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2146
diff changeset
513 info maintainer)
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
514 (save-excursion
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
515 (beginning-of-line)
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
516 (if (setq extent (extent-at (point) (current-buffer) 'pui))
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
517 (progn
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2146
diff changeset
518 (setq ;pkg-sym (extent-property extent 'pui-package)
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2146
diff changeset
519 info (extent-property extent 'pui-info)
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2146
diff changeset
520 maintainer (package-get-info-prop info 'maintainer))
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
521 (message (format "Maintainer: %s" maintainer)))
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
522 (if no-error
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
523 (clear-message nil)
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
524 (error 'invalid-operation
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
525 "No package under cursor!"))))))
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
526
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 (defvar pui-menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 '("Packages"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 ["Toggle install " pui-toggle-package-key :active (pui-current-package) :suffix (format "`%s'" (or (pui-current-package) "..."))]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 ["Toggle delete " pui-toggle-package-delete-key :active (pui-current-package) :suffix (format "`%s'" (or (pui-current-package) "..."))]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 ["Info on" pui-display-info :active (pui-current-package) :suffix (format "`%s'" (or (pui-current-package) "..."))]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 "---"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 ["Add Required" pui-add-required-packages t]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 ["Install/Remove Selected" pui-install-selected-packages t]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 "---"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 ["Verbose" pui-toggle-verbosity-redisplay
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 :active t :style toggle :selected pui-list-verbose]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 ["Refresh" pui-list-packages t]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 ["Help" pui-help t]
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 ["Quit" pui-quit t]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
542 ;;; "Why is there no standard function to do this?"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
543 (defun pui-popup-context-sensitive (event)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
544 (interactive "e")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
545 (save-excursion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
546 (set-buffer (event-buffer event))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
547 (goto-char (event-point event))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
548 (popup-menu pui-menu event)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
549 ;; I agree with dired.el - this is seriously bogus.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
550 (while (popup-up-p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
551 (dispatch-event (next-event)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 (defun list-packages-mode ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 "Symbols in the leftmost column:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 + The package is marked for installation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 - The package has not been installed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 D The package has been marked for deletion.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 * The currently installed package is old, and a newer version is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 available.
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 Useful keys:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 `\\[pui-toggle-package-key]' to select/unselect the current package for installation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 `\\[pui-toggle-package-delete-key]' to select/unselect the current package for removal.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 `\\[pui-add-required-packages]' to add any packages required by those selected.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 `\\[pui-install-selected-packages]' to install/delete selected packages.
1742
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
568 `\\[pui-display-info]' to display additional information about the package in the minibuffer.
7f92ee59c996 [xemacs-hg @ 2003-10-13 18:53:23 by viteno]
viteno
parents: 1647
diff changeset
569 `\\[pui-display-maintainer]' to display the package's maintainer in the minibuffer
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 `\\[pui-list-packages]' to refresh the package list.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 `\\[pui-toggle-verbosity-redisplay]' to toggle between a verbose and non-verbose display.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 `\\[pui-quit]' to kill this buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 "
1410
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
574 (error 'invalid-operation
44de306310b8 [xemacs-hg @ 2003-04-14 03:40:26 by youngs]
youngs
parents: 1378
diff changeset
575 "You cannot enter this mode directly. Use `pui-list-packages'"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 (put 'list-packages-mode 'mode-class 'special)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 (defun pui-list-packages ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 "List all packages and package information.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 The package name, version, and description are displayed. From the displayed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 buffer, the user can see which packages are installed, which are not, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 which are out-of-date (a newer version is available). The user can then
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 select packages for installation via the keyboard or mouse."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 (package-get-require-base t)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
588 (let ((outbuf (get-buffer-create pui-info-buffer))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
589 (sep-string "===============================================================================\n")
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
590 start)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 (message "Creating package list ...") (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 (set-buffer outbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 (setq buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 (buffer-disable-undo outbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 (erase-buffer outbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 (kill-all-local-variables)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 (use-local-map pui-display-keymap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 (setq major-mode 'list-packages-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 (setq mode-name "Packages")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 (setq truncate-lines t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 (unless package-get-remote
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 (insert "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 Warning: No download sites specified. Package index may be out of date.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 If you intend to install packages, specify download sites first.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 "))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 (if pui-list-verbose
2598
2f5d53e62972 [xemacs-hg @ 2005-02-19 22:25:12 by viteno]
viteno
parents: 2367
diff changeset
610 (insert " Latest Installed
2f5d53e62972 [xemacs-hg @ 2005-02-19 22:25:12 by viteno]
viteno
parents: 2367
diff changeset
611 Package name Vers. Vers. Description
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 ")
2598
2f5d53e62972 [xemacs-hg @ 2005-02-19 22:25:12 by viteno]
viteno
parents: 2367
diff changeset
613 (insert " Latest
2f5d53e62972 [xemacs-hg @ 2005-02-19 22:25:12 by viteno]
viteno
parents: 2367
diff changeset
614 Package name Vers. Description
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 "))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 (insert sep-string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 (setq start (point))
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 2598
diff changeset
618 (mapc
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
619 #'(lambda (pkg)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
620 (let (pkg-sym info version desc
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
621 b e extent current-vers disp)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
622 (setq pkg-sym (car pkg)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
623 info (package-get-info-version (cdr pkg) nil))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
624 (setq version (package-get-info-prop info 'version)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
625 desc (package-get-info-prop info 'description))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
627 (setq disp (pui-package-symbol-char pkg-sym
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
628 version))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
629 (setq b (point))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
630 (if pui-list-verbose
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
631 (progn
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
632 (setq current-vers (package-get-key pkg-sym :version))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
633 (cond
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
634 ((not current-vers)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
635 (setq current-vers "-----"))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
636 ((stringp current-vers)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
637 (setq current-vers
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
638 (format "%.2f"
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
639 (string-to-number current-vers))))
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
640 ((numberp current-vers)
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
641 (setq current-vers (format "%.2f" current-vers))))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
642 (insert
2598
2f5d53e62972 [xemacs-hg @ 2005-02-19 22:25:12 by viteno]
viteno
parents: 2367
diff changeset
643 (format "%s %-20s %-5.2f %-5s %s\n"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
644 (car disp) pkg-sym
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
645 (if (stringp version)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
646 (string-to-number version)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
647 version)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
648 current-vers desc)))
2598
2f5d53e62972 [xemacs-hg @ 2005-02-19 22:25:12 by viteno]
viteno
parents: 2367
diff changeset
649 (insert (format "%s %-20s %-5s %s\n"
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
650 (car disp)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
651 pkg-sym version desc)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
652 (save-excursion
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
653 (setq e (progn
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
654 (forward-line -1)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
655 (end-of-line)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
656 (point))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
657 (setq extent (make-extent b e))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
658 (if (car (cdr disp))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
659 (set-extent-face extent (get-face (car (cdr disp))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
660 (set-extent-face extent (get-face 'default)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
661 (set-extent-property extent 'highlight t)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
662 (set-extent-property extent 'pui t)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
663 (set-extent-property extent 'pui-package pkg-sym)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
664 (set-extent-property extent 'pui-info info)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
665 (set-extent-property extent 'help-echo 'pui-help-echo)
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
666 (set-extent-property extent 'keymap pui-package-keymap)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
667 (sort (copy-sequence package-get-base)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
668 #'(lambda (a b)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
669 (string< (symbol-name (car a))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
670 (symbol-name (car b))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 (insert sep-string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 (insert (documentation 'list-packages-mode))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 (setq buffer-read-only t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 (pop-to-buffer outbuf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 (delete-other-windows)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 (goto-char start)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 (setq pui-selected-packages nil) ; Reset list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 (setq pui-deleted-packages nil) ; Reset list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 (when (featurep 'menubar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 (set-buffer-menubar current-menubar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 (add-submenu '() pui-menu)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 (setq mode-popup-menu pui-menu))
1365
02909207294a [xemacs-hg @ 2003-03-20 13:19:56 by youngs]
youngs
parents: 852
diff changeset
684 (clear-message)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 ;;;###autoload
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 (defalias 'list-packages 'pui-list-packages)
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 (provide 'package-ui)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 ;;; package-ui.el ends here