annotate lisp/cmdloop.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 fd36a980d701
children 9fa29ec759e3
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 ;;; cmdloop.el --- support functions for the top-level command loop.
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) 1992-4, 1997 Free Software Foundation, Inc.
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
4 ;; Copyright (C) 2001, 2002, 2003 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 ;; Author: Richard Mlynarik
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Date: 8-Jul-92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Keywords: internal, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; Free Software Foundation, 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;;; Synched up with: FSF 19.30. (Some of the stuff below is in FSF's subr.el.)
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
29 ;;; Some parts synched with FSF 21.2.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;;; Commentary:
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 ;; This file is dumped with XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 (defun recursion-depth ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 "Return the current depth in recursive edits."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 (+ command-loop-level (minibuffer-depth)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 (defun top-level ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 "Exit all recursive editing levels."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 (throw 'top-level nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 (defun exit-recursive-edit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 "Exit from the innermost recursive edit or minibuffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 (if (> (recursion-depth) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 (throw 'exit nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 (error "No recursive edit is in progress"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 (defun abort-recursive-edit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 "Abort the command that requested this recursive edit or minibuffer input."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 (if (> (recursion-depth) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 (throw 'exit t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 (error "No recursive edit is in progress"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 ;; (defun keyboard-quit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 ;; "Signal a `quit' condition."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 ;; (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 ;; (deactivate-mark)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 ;; (signal 'quit nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 ;; moved here from pending-del.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 (defun keyboard-quit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 "Signal a `quit' condition.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 If this character is typed while lisp code is executing, it will be treated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 as an interrupt.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 If this character is typed at top-level, this simply beeps.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 If `zmacs-regions' is true, and the zmacs region is active in this buffer,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 then this key deactivates the region without beeping or signalling."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (interactive)
2611
139afe9fb2ee [xemacs-hg @ 2005-02-23 22:25:15 by adrian]
adrian
parents: 1445
diff changeset
75 (if (region-active-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 ;; pseudo-zmacs compatibility: don't beep if this ^G is simply
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 ;; deactivating the region. If it is inactive, beep.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 (signal 'quit nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 (defvar buffer-quit-function nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 "Function to call to \"quit\" the current buffer, or nil if none.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 \\[keyboard-escape-quit] calls this function when its more local actions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 \(such as cancelling a prefix argument, minibuffer or region) do not apply.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 (defun keyboard-escape-quit ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 "Exit the current \"mode\" (in a generalized sense of the word).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 This command can exit an interactive command such as `query-replace',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 can clear out a prefix argument or a region,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 can get out of the minibuffer or other recursive edit,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 cancel the use of the current buffer (for special-purpose buffers),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 or go back to just one window (by deleting all but the selected window)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 (cond ((eq last-command 'mode-exited) nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 ((> (minibuffer-depth) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 (abort-recursive-edit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 (current-prefix-arg
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 ((region-active-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 (zmacs-deactivate-region))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 ((> (recursion-depth) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 (exit-recursive-edit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 (buffer-quit-function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 (funcall buffer-quit-function))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 ((not (one-window-p t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 (delete-other-windows))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 ((string-match "^ \\*" (buffer-name (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 (bury-buffer))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 ;; `cancel-mode-internal' is a function of a misc-user event, which is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 ;; queued when window system directs XEmacs frame to cancel any modal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 ;; behavior it exposes, like mouse pointer grabbing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 ;; This function does nothing at the top level, but the code which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 ;; runs modal event loops, such as selection drag loop in `mouse-track',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 ;; check if misc-user function symbol is `cancel-mode-internal', and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 ;; takes necessary cleanup actions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 (defun cancel-mode-internal (object)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 (setq zmacs-region-stays t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 ;; Someone wrote: "This should really be a ring of last errors."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 ;; But why bother? This stuff is not all that necessary now that we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 ;; have message log, anyway.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 (defvar last-error nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 "Object describing the last signaled error.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 (defcustom errors-deactivate-region nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 "*Non-nil means that errors will cause the region to be deactivated."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 :group 'editing-basics)
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 (defun command-error (error-object)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 613
diff changeset
134 ;; if you want a backtrace before exiting, set stack-trace-on-error.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 613
diff changeset
135 (let* ((inhibit-quit t)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
136 (debug-on-error nil)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
137 (etype (car-safe error-object)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 (setq quit-flag nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 (setq standard-output t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 (setq standard-input t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 (setq executing-kbd-macro nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 (and errors-deactivate-region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 (zmacs-deactivate-region))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 (discard-input)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 (setq last-error error-object)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 (message nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 (ding nil (cond ((eq etype 'undefined-keystroke-sequence)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 (if (and (vectorp (nth 1 error-object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 (/= 0 (length (nth 1 error-object)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 (button-event-p (aref (nth 1 error-object) 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 'undefined-click
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 'undefined-key))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 ((eq etype 'quit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 'quit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 ((memq etype '(end-of-buffer beginning-of-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 'buffer-bound)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 ((eq etype 'buffer-read-only)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 'read-only)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 (t 'command-error)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 (display-error error-object t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 (if (noninteractive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 (progn
1445
0117860e01eb [xemacs-hg @ 2003-05-02 06:32:28 by stephent]
stephent
parents: 1346
diff changeset
166 (message "\n%s exiting.\n" emacs-program-name)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 (kill-emacs -1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 (defun describe-last-error ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 "Redisplay the last error-message. See the variable `last-error'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 (if last-error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 (with-displaying-help-buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 (lambda ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 (princ "Last error was:\n" standard-output)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 (display-error last-error standard-output)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 (message "No error yet")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 ;;#### Must be done later in the loadup sequence
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 ;(define-key (symbol-function 'help-command) "e" 'describe-last-error)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 (defun truncate-command-history-for-gc ()
3698
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
186 ;; We should try to avoid accessing any bindings to speak of in this
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
187 ;; function; as this hook is called asynchronously, the search for
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
188 ;; those bindings might search local bindings from essentially
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
189 ;; arbitrary functions. We force the body of the function to run at
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
190 ;; command-loop level, where the danger of local bindings is much
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
191 ;; reduced; the code can still do its job because the command history
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
192 ;; and values list will not grow before then anyway.
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
193 ;;
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
194 ;; Nothing is done in batch mode, both because it is a waste of time
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
195 ;; (there is no command loop!) and because this any GCs during dumping
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
196 ;; will invoke this code, and if it were to enqueue an eval event,
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
197 ;; the portable dumper would try to dump it and fail.
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
198 (if (not (noninteractive))
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
199 (enqueue-eval-event
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
200 (lambda (arg)
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
201 (let ((tail (nthcdr 30 command-history)))
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
202 (if tail (setcdr tail nil)))
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
203 (let ((tail (nthcdr 30 values)))
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
204 (if tail (setcdr tail nil))))
7d97cf62c899 [xemacs-hg @ 2006-11-24 13:45:37 by aidan]
aidan
parents: 3474
diff changeset
205 nil)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 (add-hook 'pre-gc-hook 'truncate-command-history-for-gc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 ;;;; Object-oriented programming at its finest
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 ;; Now in src/print.c; used by Ferror_message_string and others
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 ;(defun display-error (error-object stream) ;(defgeneric report-condition ...)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 ; "Display `error-object' on `stream' in a user-friendly way."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 ; (funcall (or (let ((type (car-safe error-object)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 ; (catch 'error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 ; (and (consp error-object)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 ; (symbolp type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 ; ;;(stringp (get type 'error-message))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 ; (consp (get type 'error-conditions))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 ; (let ((tail (cdr error-object)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 ; (while (not (null tail))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 ; (if (consp tail)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 ; (setq tail (cdr tail))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 ; (throw 'error nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 ; t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 ; ;; (check-type condition condition)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 ; (get type 'error-conditions)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 ; ;; Search class hierarchy
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 ; (let ((tail (get type 'error-conditions)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 ; (while (not (null tail))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 ; (cond ((not (and (consp tail)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 ; (symbolp (car tail))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 ; (throw 'error nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 ; ((get (car tail) 'display-error)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 ; (throw 'error (get (car tail)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 ; 'display-error)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 ; (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 ; (setq tail (cdr tail)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 ; ;; Default method
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 ; #'(lambda (error-object stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 ; (let ((type (car error-object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 ; (tail (cdr error-object))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 ; (first t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 ; (print-message-label 'error))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 ; (if (eq type 'error)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 ; (progn (princ (car tail) stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 ; (setq tail (cdr tail)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 ; (princ (or (gettext (get type 'error-message)) type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 ; stream))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 ; (while tail
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 ; (princ (if first ": " ", ") stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 ; (prin1 (car tail) stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 ; (setq tail (cdr tail)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 ; first nil))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 ; #'(lambda (error-object stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 ; (princ (gettext "Peculiar error ") stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 ; (prin1 error-object stream)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 ; error-object stream))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 (put 'file-error 'display-error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 #'(lambda (error-object stream)
1346
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
263 (let ((type (car error-object))
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
264 (tail (cdr error-object))
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
265 (first t)
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
266 (print-message-label 'error))
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
267 (if (eq type 'file-error)
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
268 (progn (princ (car tail) stream)
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
269 (setq tail (cdr tail)))
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
270 (princ (or (gettext (get type 'error-message)) type)
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
271 stream))
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
272 (while tail
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
273 (princ (if first ": " ", ") stream)
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
274 (prin1 (car tail) stream)
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
275 (setq tail (cdr tail)
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
276 first nil)))))
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 (put 'undefined-keystroke-sequence 'display-error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 #'(lambda (error-object stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 (princ (key-description (car (cdr error-object))) stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 ;; #### I18N3: doesn't localize properly.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 (princ (gettext " not defined.") stream) ; doo dah, doo dah.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 (defcustom teach-extended-commands-p t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 "*If true, then `\\[execute-extended-command]' will teach you keybindings.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 Any time you execute a command with \\[execute-extended-command] which has a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 shorter keybinding, you will be shown the alternate binding before the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 command executes. There is a short pause after displaying the binding,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 before executing it; the length can be controlled by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 `teach-extended-commands-timeout'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 :group 'keyboard)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 (defcustom teach-extended-commands-timeout 4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 "*How long to pause after displaying a keybinding before executing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 The value is measured in seconds. This only applies if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 `teach-extended-commands-p' is true."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 :type 'number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 :group 'keyboard)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 ;That damn RMS went off and implemented something differently, after
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 ;we had already implemented it. We can't support both properly until
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 ;we have Lisp magic variables.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 ;(defvar suggest-key-bindings t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 ; "*FSFmacs equivalent of `teach-extended-commands-*'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 ;Provided for compatibility only.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 ;Non-nil means show the equivalent key-binding when M-x command has one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 ;The value can be a length of time to show the message for.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 ;If the value is non-nil and not a number, we wait 2 seconds.")
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 ;(make-obsolete-variable 'suggest-key-bindings 'teach-extended-commands-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 (defun execute-extended-command (prefix-arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 "Read a command name from the minibuffer using 'completing-read'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 Then call the specified command using 'command-execute' and return its
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 return value. If the command asks for a prefix argument, supply the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 value of the current raw prefix argument, or the value of PREFIX-ARG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 when called from Lisp."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 (interactive "P")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 ;; Note: This doesn't hack "this-command-keys"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 (let ((prefix-arg prefix-arg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 (setq this-command (read-command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 ;; Note: this has the hard-wired
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 ;; "C-u" and "M-x" string bug in common
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 442
diff changeset
327 ;; with all Emacs's.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 ;; (i.e. it prints C-u and M-x regardless of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 ;; whether some other keys were actually bound
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 ;; to `execute-extended-command' and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 ;; `universal-argument'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 (cond ((eq prefix-arg '-)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 "- M-x ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 ((equal prefix-arg '(4))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 "C-u M-x ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 ((integerp prefix-arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 (format "%d M-x " prefix-arg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 ((and (consp prefix-arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 (integerp (car prefix-arg)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 (format "%d M-x " (car prefix-arg)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 "M-x ")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 (if (and teach-extended-commands-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 (interactive-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 ;; Remember the keys, run the command, and show the keys (if
4806
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
347 ;; any). The symbol-macrolet avoids some lexical-scope lossage.
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
348 (symbol-macrolet
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
349 ((execute-command-keys #:execute-command-keys)
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
350 (execute-command-name #:execute-command-name))
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
351 (let ((execute-command-keys (where-is-internal this-command))
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
352 (execute-command-name this-command)) ; the name can change
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
353 (command-execute this-command t)
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
354 (when execute-command-keys
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
355 ;; Normally the region is adjusted in post_command_hook;
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
356 ;; however, it is not called until after we finish. It
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
357 ;; looks ugly for the region to get updated after the
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
358 ;; delays, so we do it now. The code below is a Lispified
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
359 ;; copy of code in event-stream.c:post_command_hook().
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
360 (if (and (not zmacs-region-stays)
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
361 (or (not (eq (selected-window) (minibuffer-window)))
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
362 (eq (zmacs-region-buffer) (current-buffer))))
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
363 (zmacs-deactivate-region)
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
364 (zmacs-update-region))
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
365 ;; Wait for a while, so the user can see a message printed,
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
366 ;; if any.
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
367 (when (sit-for 1)
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
368 (display-message
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
369 'no-log
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
370 (format (if (cdr execute-command-keys)
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
371 "Command `%s' is bound to keys: %s"
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
372 "Command `%s' is bound to key: %s")
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
373 execute-command-name
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
374 (sorted-key-descriptions execute-command-keys)))
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
375 (sit-for teach-extended-commands-timeout)
fd36a980d701 Use uninterned symbols in various information-hiding contexts.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4222
diff changeset
376 (clear-message 'no-log)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 ;; Else, just run the command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 (command-execute this-command t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 ;;; C code calls this; the underscores in the variable names are to avoid
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 ;;; cluttering the specbind namespace (lexical scope! lexical scope!)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 ;;; Putting this in Lisp instead of C slows kbd macros by 50%.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 ;(defun command-execute (_command &optional _record-flag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 ; "Execute CMD as an editor command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 ;CMD must be a symbol that satisfies the `commandp' predicate.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 ;Optional second arg RECORD-FLAG non-nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 ;means unconditionally put this command in `command-history'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 ;Otherwise, that is done only if an arg is read using the minibuffer."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 ; (let ((_prefix prefix-arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 ; (_cmd (indirect-function _command)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 ; (setq prefix-arg nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 ; this-command _command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 ; current-prefix-arg _prefix
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 ; zmacs-region-stays nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 ; ;; #### debug_on_next_call = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 ; (cond ((and (symbolp _command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 ; (get _command 'disabled))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 ; (run-hooks disabled-command-hook))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 ; ((or (stringp _cmd) (vectorp _cmd))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 ; ;; If requested, place the macro in the command history.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 ; ;; For other sorts of commands, call-interactively takes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 ; ;; care of this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 ; (if _record-flag
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 ; (setq command-history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 ; (cons (list 'execute-kbd-macro _cmd _prefix)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 ; command-history)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 ; (execute-kbd-macro _cmd _prefix))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 ; (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 ; (call-interactively _command _record-flag)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 (defun y-or-n-p-minibuf (prompt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 "Ask user a \"y or n\" question. Return t if answer is \"y\".
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 Takes one argument, which is the string to display to ask the question.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 It should end in a space; `y-or-n-p' adds `(y or n) ' to it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 No confirmation of the answer is requested; a single character is enough.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 Also accepts Space to mean yes, or Delete to mean no."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 (let* ((pre "")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (yn (gettext "(y or n) "))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 ;; we need to translate the prompt ourselves because of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 ;; strange way we handle it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 (prompt (gettext prompt))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 (while (stringp yn)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 (if (let ((cursor-in-echo-area t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 (inhibit-quit t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 (message "%s%s%s" pre prompt yn)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 (setq event (next-command-event event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 (condition-case nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 (prog1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 (or quit-flag (eq 'keyboard-quit (key-binding event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 (setq quit-flag nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 (wrong-type-argument t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (message "%s%s%s%s" pre prompt yn (single-key-description event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 (setq quit-flag nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 (signal 'quit '())))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 (let* ((keys (events-to-keys (vector event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 (def (lookup-key query-replace-map keys)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 (cond ((eq def 'skip)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 (message "%s%sNo" prompt yn)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 (setq yn nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 ((eq def 'act)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 (message "%s%sYes" prompt yn)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (setq yn t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 ((eq def 'recenter)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 (recenter))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 ((or (eq def 'quit) (eq def 'exit-prefix))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 (signal 'quit '()))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 ((button-release-event-p event) ; ignore them
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 (message "%s%s%s%s" pre prompt yn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 (single-key-description event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 (ding nil 'y-or-n-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 (discard-input)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 (if (= (length pre) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 (setq pre (gettext "Please answer y or n. ")))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 yn)))
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 yes-or-no-p-minibuf (prompt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 "Ask user a yes-or-no question. Return t if answer is yes.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 Takes one argument, which is the string to display to ask the question.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 The user must confirm the answer with RET,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 and can edit it until it has been confirmed."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 (let ((p (concat (gettext prompt) (gettext "(yes or no) ")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 (ans ""))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 (while (stringp ans)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 (setq ans (downcase (read-string p nil t))) ;no history
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 (cond ((string-equal ans (gettext "yes"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 (setq ans t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 ((string-equal ans (gettext "no"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 (setq ans nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 (ding nil 'yes-or-no-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 (discard-input)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 (message "Please answer yes or no.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 (sleep-for 2))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 ans)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
484 (defun yes-or-no-p (prompt)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
485 "Ask user a yes-or-no question. Return t if answer is yes.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
486 The question is asked with a dialog box or the minibuffer, as appropriate.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
487 Takes one argument, which is the string to display to ask the question.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
488 It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
489 The user must confirm the answer with RET,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
490 and can edit it until it as been confirmed."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
491 (if (should-use-dialog-box-p)
4222
38ef5a6da799 [xemacs-hg @ 2007-10-13 14:08:26 by aidan]
aidan
parents: 3698
diff changeset
492 ;; and-fboundp is redundant, since yes-or-no-p-dialog-box is only
38ef5a6da799 [xemacs-hg @ 2007-10-13 14:08:26 by aidan]
aidan
parents: 3698
diff changeset
493 ;; bound if (featurep 'dialog). But it eliminates a compile-time
38ef5a6da799 [xemacs-hg @ 2007-10-13 14:08:26 by aidan]
aidan
parents: 3698
diff changeset
494 ;; warning.
38ef5a6da799 [xemacs-hg @ 2007-10-13 14:08:26 by aidan]
aidan
parents: 3698
diff changeset
495 (and-fboundp #'yes-or-no-p-dialog-box (yes-or-no-p-dialog-box prompt))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
496 (yes-or-no-p-minibuf prompt)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
497
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
498 (defun y-or-n-p (prompt)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
499 "Ask user a \"y or n\" question. Return t if answer is \"y\".
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
500 Takes one argument, which is the string to display to ask the question.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
501 The question is asked with a dialog box or the minibuffer, as appropriate.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
502 It should end in a space; `y-or-n-p' adds `(y or n) ' to it.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
503 No confirmation of the answer is requested; a single character is enough.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
504 Also accepts Space to mean yes, or Delete to mean no."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
505 (if (should-use-dialog-box-p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
506 (yes-or-no-p-dialog-box prompt)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
507 (y-or-n-p-minibuf prompt)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
508
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 (defun read-char ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 "Read a character from the command input (keyboard or macro).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 If a mouse click or non-ASCII character is detected, an error is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 signalled. The character typed is returned as an ASCII value. This
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 is most likely the wrong thing for you to be using: consider using
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 the `next-command-event' function instead."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 (let ((event (next-command-event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 (or inhibit-quit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 (and (event-matches-key-specifier-p event (quit-char))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 (signal 'quit nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 (prog1 (or (event-to-character event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 ;; Kludge. If the event we read was a mouse-release,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 ;; discard it and read the next one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 (if (button-release-event-p event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 (event-to-character (next-command-event event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 (error "Key read has no ASCII equivalent %S" event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 ;; this is not necessary, but is marginally more efficient than GC.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 (deallocate-event event)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 (defun read-char-exclusive ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 "Read a character from the command input (keyboard or macro).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 If a mouse click or non-ASCII character is detected, it is discarded.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 The character typed is returned as an ASCII value. This is most likely
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 the wrong thing for you to be using: consider using the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 `next-command-event' function instead."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 (let (event ch)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 (while (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 (setq event (next-command-event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 (or inhibit-quit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 (and (event-matches-key-specifier-p event (quit-char))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 (signal 'quit nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 (setq ch (event-to-character event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 (deallocate-event event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 (null ch)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 ch))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
548 ;;;; Input and display facilities.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
549
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
550 ;; BEGIN SYNCHED WITH FSF 21.2.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
551
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
552 (defvar read-quoted-char-radix 8
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
553 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
554 Legitimate radix values are 8, 10 and 16.")
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
555
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
556 (custom-declare-variable-early
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
557 'read-quoted-char-radix 8
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
558 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
559 Legitimate radix values are 8, 10 and 16."
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
560 :type '(choice (const 8) (const 10) (const 16))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
561 :group 'editing-basics)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
562
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 (defun read-quoted-char (&optional prompt)
3341
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
564 ;; XEmacs change; description of the character code input
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
565 "Like `read-char', but do not allow quitting.
3341
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
566
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
567 Also, if the first character read is a digit of base (the value of)
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
568 `read-quoted-char-radix', we read as many of such digits as are
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
569 typed and return a character with the corresponding Unicode code
3344
e9214c743a8b [xemacs-hg @ 2006-04-16 17:09:30 by aidan]
aidan
parents: 3341
diff changeset
570 point. Any input that is not a digit (in the base used) terminates
e9214c743a8b [xemacs-hg @ 2006-04-16 17:09:30 by aidan]
aidan
parents: 3341
diff changeset
571 the sequence. If the terminator is RET, it is discarded; any other
3341
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
572 terminator is used itself as input.
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
573
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
574 The optional argument PROMPT specifies a string to use to prompt the user.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
575 The variable `read-quoted-char-radix' controls which radix to use
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
576 for numeric input."
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
577 (let (;(message-log-max nil)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
578 done (first t) (code 0) char event
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 (prompt (and prompt (gettext prompt)))
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
580 )
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
581 (while (not done)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
582 (let ((inhibit-quit first)
3341
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
583 ;; Don't let C-h get the help message--only help
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
584 ;; function keys.
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
585 ;; XEmacs: we don't support the help function keys as of
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
586 ;; 2006-04-16. GNU have a Vhelp_event_list in addition
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
587 ;; to help-char in src/keyboard.c, and it's only useful
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
588 ;; to set help-form while help-char is nil when that
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
589 ;; functionality is available.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 (help-char nil)
3341
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
591 (help-form (format
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 "Type the special character you want to use,
3341
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
593 or the character code, base %d (the value of `read-quoted-char-radix')
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
594 RET terminates the character code and is discarded;
3341
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
595 any other non-digit terminates the character code and is then used as input."
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
596 read-quoted-char-radix)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 (and prompt (display-message 'prompt (format "%s-" prompt)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 (setq event (next-command-event)
3474
94903620d912 [xemacs-hg @ 2006-06-25 13:58:02 by aidan]
aidan
parents: 3344
diff changeset
599 ;; If event-to-character fails, this is fine, we handle that
94903620d912 [xemacs-hg @ 2006-06-25 13:58:02 by aidan]
aidan
parents: 3344
diff changeset
600 ;; with the (null char) cond branch below.
94903620d912 [xemacs-hg @ 2006-06-25 13:58:02 by aidan]
aidan
parents: 3344
diff changeset
601 char (event-to-character event))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 (if inhibit-quit (setq quit-flag nil)))
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
603 ;; Translate TAB key into control-I ASCII character, and so on.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
604 (and char
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
605 (let ((translated (lookup-key function-key-map (vector char))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
606 (if (arrayp translated)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
607 (setq char (aref translated 0)))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
608 (cond ((null char))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
609 ((not (characterp char))
3196
827b833cd3ce [xemacs-hg @ 2006-01-08 20:00:41 by aidan]
aidan
parents: 2828
diff changeset
610 ;; XEmacs change; event instead of char.
827b833cd3ce [xemacs-hg @ 2006-01-08 20:00:41 by aidan]
aidan
parents: 2828
diff changeset
611 (setq unread-command-events (list event)
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
612 done t))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
613 ; ((/= (logand char ?\M-\^@) 0)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
614 ; ;; Turn a meta-character into a character with the 0200 bit set.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
615 ; (setq code (logior (logand char (lognot ?\M-\^@)) 128)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
616 ; done t))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
617 ((and (<= ?0 char) (< char (+ ?0 (min 10 read-quoted-char-radix))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
618 (setq code (+ (* code read-quoted-char-radix) (- char ?0)))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
619 (and prompt (setq prompt (display-message 'prompt
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
620 (format "%s %c" prompt char)))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
621 ((and (<= ?a (downcase char))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
622 (< (downcase char) (+ ?a -10 (min 26 read-quoted-char-radix))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
623 (setq code (+ (* code read-quoted-char-radix)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
624 (+ 10 (- (downcase char) ?a))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
625 (and prompt (setq prompt (display-message 'prompt
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
626 (format "%s %c" prompt char)))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
627 ((and (not first) (eq char ?\C-m))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
628 (setq done t))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
629 ((not first)
3196
827b833cd3ce [xemacs-hg @ 2006-01-08 20:00:41 by aidan]
aidan
parents: 2828
diff changeset
630 ;; XEmacs change; event instead of char.
827b833cd3ce [xemacs-hg @ 2006-01-08 20:00:41 by aidan]
aidan
parents: 2828
diff changeset
631 (setq unread-command-events (list event)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 done t))
1346
01c57eb70ae9 [xemacs-hg @ 2003-03-09 02:27:27 by ben]
ben
parents: 1333
diff changeset
633 (t (setq code (char-to-int char)
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
634 done t)))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
635 (setq first nil))
3341
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
636 ;; XEmacs change; unicode-to-char instead of int-to-char
591c4e52c6d5 [xemacs-hg @ 2006-04-15 14:44:34 by aidan]
aidan
parents: 3196
diff changeset
637 (unicode-to-char code)))
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
638
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
639 ;; in passwd.el.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
640 ; (defun read-passwd (prompt &optional confirm default)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
641 ; "Read a password, prompting with PROMPT. Echo `.' for each character typed.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
642 ; End with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
643 ; Optional argument CONFIRM, if non-nil, then read it twice to make sure.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
644 ; Optional DEFAULT is a default password to use instead of empty input."
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
645 ; (if confirm
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
646 ; (let (success)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
647 ; (while (not success)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
648 ; (let ((first (read-passwd prompt nil default))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
649 ; (second (read-passwd "Confirm password: " nil default)))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
650 ; (if (equal first second)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
651 ; (progn
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
652 ; (and (arrayp second) (fillarray second ?\0))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
653 ; (setq success first))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
654 ; (and (arrayp first) (fillarray first ?\0))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
655 ; (and (arrayp second) (fillarray second ?\0))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
656 ; (message "Password not repeated accurately; please start over")
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
657 ; (sit-for 1))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
658 ; success)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
659 ; (let ((pass nil)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
660 ; (c 0)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
661 ; (echo-keystrokes 0)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
662 ; (cursor-in-echo-area t))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
663 ; (while (progn (message "%s%s"
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
664 ; prompt
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
665 ; (make-string (length pass) ?.))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
666 ; (setq c (read-char-exclusive nil t))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
667 ; (and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
668 ; (clear-this-command-keys)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
669 ; (if (= c ?\C-u)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
670 ; (progn
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
671 ; (and (arrayp pass) (fillarray pass ?\0))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
672 ; (setq pass ""))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
673 ; (if (and (/= c ?\b) (/= c ?\177))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
674 ; (let* ((new-char (char-to-string c))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
675 ; (new-pass (concat pass new-char)))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
676 ; (and (arrayp pass) (fillarray pass ?\0))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
677 ; (fillarray new-char ?\0)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
678 ; (setq c ?\0)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
679 ; (setq pass new-pass))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
680 ; (if (> (length pass) 0)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
681 ; (let ((new-pass (substring pass 0 -1)))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
682 ; (and (arrayp pass) (fillarray pass ?\0))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
683 ; (setq pass new-pass))))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
684 ; (message nil)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
685 ; (or pass default ""))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
686
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
687 ;; aliased to redraw-modeline, a built-in.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
688 ; (defun force-mode-line-update (&optional all)
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
689 ; "Force the mode-line of the current buffer to be redisplayed.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
690 ; With optional non-nil ALL, force redisplay of all mode-lines."
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
691 ; (if all (save-excursion (set-buffer (other-buffer))))
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
692 ; (set-buffer-modified-p (buffer-modified-p)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 (defun momentary-string-display (string pos &optional exit-char message)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 "Momentarily display STRING in the buffer at POS.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 Display remains until next character is typed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 If the char is EXIT-CHAR (optional third arg, default is SPC) it is swallowed;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 otherwise it is then available as input (as a command if nothing else).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 Display MESSAGE (optional fourth arg) in the echo area.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 (or exit-char (setq exit-char ?\ ))
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
702 (let ((inhibit-read-only t)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 ;; Don't modify the undo list at all.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 (buffer-undo-list t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 (modified (buffer-modified-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 (name buffer-file-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 insert-end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 (goto-char pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 ;; defeat file locking... don't try this at home, kids!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 (setq buffer-file-name nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714 (insert-before-markers (gettext string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 (setq insert-end (point))
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
716 ;; If the message end is off screen, recenter now.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
717 (if (< (window-end nil t) insert-end)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 (recenter (/ (window-height) 2)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 ;; If that pushed message start off the frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 ;; scroll to start it at the top of the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 (move-to-window-line 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 (if (> (point) pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 (goto-char pos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 (recenter 0))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 (message (or message (gettext "Type %s to continue editing."))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 (single-key-description exit-char))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 (let ((event (save-excursion (next-command-event))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 (or (eq (event-to-character event) exit-char)
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
730 (setq unread-command-events (list event)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 (if insert-end
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 (delete-region pos insert-end)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 (setq buffer-file-name name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 (set-buffer-modified-p modified))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736
1333
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
737 ;; END SYNCHED WITH FSF 21.2.
1b0339b048ce [xemacs-hg @ 2003-03-02 09:38:37 by ben]
ben
parents: 1123
diff changeset
738
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 ;;; cmdloop.el ends here