annotate lisp/frame.el @ 5127:a9c41067dd88 ben-lisp-object

more cleanups, terminology clarification, lots of doc work -------------------- ChangeLog entries follow: -------------------- man/ChangeLog addition: 2010-03-05 Ben Wing <ben@xemacs.org> * internals/internals.texi (Introduction to Allocation): * internals/internals.texi (Integers and Characters): * internals/internals.texi (Allocation from Frob Blocks): * internals/internals.texi (lrecords): * internals/internals.texi (Low-level allocation): Rewrite section on allocation of Lisp objects to reflect the new reality. Remove references to nonexistent XSETINT and XSETCHAR. modules/ChangeLog addition: 2010-03-05 Ben Wing <ben@xemacs.org> * postgresql/postgresql.c (allocate_pgconn): * postgresql/postgresql.c (allocate_pgresult): * postgresql/postgresql.h (struct Lisp_PGconn): * postgresql/postgresql.h (struct Lisp_PGresult): * ldap/eldap.c (allocate_ldap): * ldap/eldap.h (struct Lisp_LDAP): Same changes as in src/ dir. See large log there in ChangeLog, but basically: ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER ../hlo/src/ChangeLog addition: 2010-03-05 Ben Wing <ben@xemacs.org> * alloc.c: * alloc.c (old_alloc_sized_lcrecord): * alloc.c (very_old_free_lcrecord): * alloc.c (copy_lisp_object): * alloc.c (zero_sized_lisp_object): * alloc.c (zero_nonsized_lisp_object): * alloc.c (lisp_object_storage_size): * alloc.c (free_normal_lisp_object): * alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC): * alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT): * alloc.c (Fcons): * alloc.c (noseeum_cons): * alloc.c (make_float): * alloc.c (make_bignum): * alloc.c (make_bignum_bg): * alloc.c (make_ratio): * alloc.c (make_ratio_bg): * alloc.c (make_ratio_rt): * alloc.c (make_bigfloat): * alloc.c (make_bigfloat_bf): * alloc.c (size_vector): * alloc.c (make_compiled_function): * alloc.c (Fmake_symbol): * alloc.c (allocate_extent): * alloc.c (allocate_event): * alloc.c (make_key_data): * alloc.c (make_button_data): * alloc.c (make_motion_data): * alloc.c (make_process_data): * alloc.c (make_timeout_data): * alloc.c (make_magic_data): * alloc.c (make_magic_eval_data): * alloc.c (make_eval_data): * alloc.c (make_misc_user_data): * alloc.c (Fmake_marker): * alloc.c (noseeum_make_marker): * alloc.c (size_string_direct_data): * alloc.c (make_uninit_string): * alloc.c (make_string_nocopy): * alloc.c (mark_lcrecord_list): * alloc.c (alloc_managed_lcrecord): * alloc.c (free_managed_lcrecord): * alloc.c (sweep_lcrecords_1): * alloc.c (malloced_storage_size): * buffer.c (allocate_buffer): * buffer.c (compute_buffer_usage): * buffer.c (DEFVAR_BUFFER_LOCAL_1): * buffer.c (nuke_all_buffer_slots): * buffer.c (common_init_complex_vars_of_buffer): * buffer.h (struct buffer_text): * buffer.h (struct buffer): * bytecode.c: * bytecode.c (make_compiled_function_args): * bytecode.c (size_compiled_function_args): * bytecode.h (struct compiled_function_args): * casetab.c (allocate_case_table): * casetab.h (struct Lisp_Case_Table): * charset.h (struct Lisp_Charset): * chartab.c (fill_char_table): * chartab.c (Fmake_char_table): * chartab.c (make_char_table_entry): * chartab.c (copy_char_table_entry): * chartab.c (Fcopy_char_table): * chartab.c (put_char_table): * chartab.h (struct Lisp_Char_Table_Entry): * chartab.h (struct Lisp_Char_Table): * console-gtk-impl.h (struct gtk_device): * console-gtk-impl.h (struct gtk_frame): * console-impl.h (struct console): * console-msw-impl.h (struct Lisp_Devmode): * console-msw-impl.h (struct mswindows_device): * console-msw-impl.h (struct msprinter_device): * console-msw-impl.h (struct mswindows_frame): * console-msw-impl.h (struct mswindows_dialog_id): * console-stream-impl.h (struct stream_console): * console-stream.c (stream_init_console): * console-tty-impl.h (struct tty_console): * console-tty-impl.h (struct tty_device): * console-tty.c (allocate_tty_console_struct): * console-x-impl.h (struct x_device): * console-x-impl.h (struct x_frame): * console.c (allocate_console): * console.c (nuke_all_console_slots): * console.c (DEFVAR_CONSOLE_LOCAL_1): * console.c (common_init_complex_vars_of_console): * data.c (make_weak_list): * data.c (make_weak_box): * data.c (make_ephemeron): * database.c: * database.c (struct Lisp_Database): * database.c (allocate_database): * database.c (finalize_database): * device-gtk.c (allocate_gtk_device_struct): * device-impl.h (struct device): * device-msw.c: * device-msw.c (mswindows_init_device): * device-msw.c (msprinter_init_device): * device-msw.c (finalize_devmode): * device-msw.c (allocate_devmode): * device-tty.c (allocate_tty_device_struct): * device-x.c (allocate_x_device_struct): * device.c: * device.c (nuke_all_device_slots): * device.c (allocate_device): * dialog-msw.c (handle_question_dialog_box): * elhash.c: * elhash.c (struct Lisp_Hash_Table): * elhash.c (finalize_hash_table): * elhash.c (make_general_lisp_hash_table): * elhash.c (Fcopy_hash_table): * elhash.h (htentry): * emacs.c (main_1): * eval.c: * eval.c (size_multiple_value): * event-stream.c (finalize_command_builder): * event-stream.c (allocate_command_builder): * event-stream.c (free_command_builder): * event-stream.c (event_stream_generate_wakeup): * event-stream.c (event_stream_resignal_wakeup): * event-stream.c (event_stream_disable_wakeup): * event-stream.c (event_stream_wakeup_pending_p): * events.h (struct Lisp_Timeout): * events.h (struct command_builder): * extents-impl.h: * extents-impl.h (struct extent_auxiliary): * extents-impl.h (struct extent_info): * extents-impl.h (set_extent_no_chase_aux_field): * extents-impl.h (set_extent_no_chase_normal_field): * extents.c: * extents.c (gap_array_marker): * extents.c (gap_array): * extents.c (extent_list_marker): * extents.c (extent_list): * extents.c (stack_of_extents): * extents.c (gap_array_make_marker): * extents.c (extent_list_make_marker): * extents.c (allocate_extent_list): * extents.c (SLOT): * extents.c (mark_extent_auxiliary): * extents.c (allocate_extent_auxiliary): * extents.c (attach_extent_auxiliary): * extents.c (size_gap_array): * extents.c (finalize_extent_info): * extents.c (allocate_extent_info): * extents.c (uninit_buffer_extents): * extents.c (allocate_soe): * extents.c (copy_extent): * extents.c (vars_of_extents): * extents.h: * faces.c (allocate_face): * faces.h (struct Lisp_Face): * faces.h (struct face_cachel): * file-coding.c: * file-coding.c (finalize_coding_system): * file-coding.c (sizeof_coding_system): * file-coding.c (Fcopy_coding_system): * file-coding.h (struct Lisp_Coding_System): * file-coding.h (MARKED_SLOT): * fns.c (size_bit_vector): * font-mgr.c: * font-mgr.c (finalize_fc_pattern): * font-mgr.c (print_fc_pattern): * font-mgr.c (Ffc_pattern_p): * font-mgr.c (Ffc_pattern_create): * font-mgr.c (Ffc_name_parse): * font-mgr.c (Ffc_name_unparse): * font-mgr.c (Ffc_pattern_duplicate): * font-mgr.c (Ffc_pattern_add): * font-mgr.c (Ffc_pattern_del): * font-mgr.c (Ffc_pattern_get): * font-mgr.c (fc_config_create_using): * font-mgr.c (fc_strlist_to_lisp_using): * font-mgr.c (fontset_to_list): * font-mgr.c (Ffc_config_p): * font-mgr.c (Ffc_config_up_to_date): * font-mgr.c (Ffc_config_build_fonts): * font-mgr.c (Ffc_config_get_cache): * font-mgr.c (Ffc_config_get_fonts): * font-mgr.c (Ffc_config_set_current): * font-mgr.c (Ffc_config_get_blanks): * font-mgr.c (Ffc_config_get_rescan_interval): * font-mgr.c (Ffc_config_set_rescan_interval): * font-mgr.c (Ffc_config_app_font_add_file): * font-mgr.c (Ffc_config_app_font_add_dir): * font-mgr.c (Ffc_config_app_font_clear): * font-mgr.c (size): * font-mgr.c (Ffc_config_substitute): * font-mgr.c (Ffc_font_render_prepare): * font-mgr.c (Ffc_font_match): * font-mgr.c (Ffc_font_sort): * font-mgr.c (finalize_fc_config): * font-mgr.c (print_fc_config): * font-mgr.h: * font-mgr.h (struct fc_pattern): * font-mgr.h (XFC_PATTERN): * font-mgr.h (struct fc_config): * font-mgr.h (XFC_CONFIG): * frame-gtk.c (allocate_gtk_frame_struct): * frame-impl.h (struct frame): * frame-msw.c (mswindows_init_frame_1): * frame-x.c (allocate_x_frame_struct): * frame.c (nuke_all_frame_slots): * frame.c (allocate_frame_core): * gc.c: * gc.c (GC_CHECK_NOT_FREE): * glyphs.c (finalize_image_instance): * glyphs.c (allocate_image_instance): * glyphs.c (Fcolorize_image_instance): * glyphs.c (allocate_glyph): * glyphs.c (unmap_subwindow_instance_cache_mapper): * glyphs.c (register_ignored_expose): * glyphs.h (struct Lisp_Image_Instance): * glyphs.h (struct Lisp_Glyph): * glyphs.h (struct glyph_cachel): * glyphs.h (struct expose_ignore): * gui.c (allocate_gui_item): * gui.h (struct Lisp_Gui_Item): * keymap.c (struct Lisp_Keymap): * keymap.c (make_keymap): * lisp.h: * lisp.h (struct Lisp_String_Direct_Data): * lisp.h (struct Lisp_String_Indirect_Data): * lisp.h (struct Lisp_Vector): * lisp.h (struct Lisp_Bit_Vector): * lisp.h (DECLARE_INLINE_LISP_BIT_VECTOR): * lisp.h (struct weak_box): * lisp.h (struct ephemeron): * lisp.h (struct weak_list): * lrecord.h: * lrecord.h (struct lrecord_implementation): * lrecord.h (MC_ALLOC_CALL_FINALIZER): * lrecord.h (struct lcrecord_list): * lstream.c (finalize_lstream): * lstream.c (sizeof_lstream): * lstream.c (Lstream_new): * lstream.c (Lstream_delete): * lstream.h (struct lstream): * marker.c: * marker.c (finalize_marker): * marker.c (compute_buffer_marker_usage): * mule-charset.c: * mule-charset.c (make_charset): * mule-charset.c (compute_charset_usage): * objects-impl.h (struct Lisp_Color_Instance): * objects-impl.h (struct Lisp_Font_Instance): * objects-tty-impl.h (struct tty_color_instance_data): * objects-tty-impl.h (struct tty_font_instance_data): * objects-tty.c (tty_initialize_color_instance): * objects-tty.c (tty_initialize_font_instance): * objects.c (finalize_color_instance): * objects.c (Fmake_color_instance): * objects.c (finalize_font_instance): * objects.c (Fmake_font_instance): * objects.c (reinit_vars_of_objects): * opaque.c: * opaque.c (sizeof_opaque): * opaque.c (make_opaque_ptr): * opaque.c (free_opaque_ptr): * opaque.h: * opaque.h (Lisp_Opaque): * opaque.h (Lisp_Opaque_Ptr): * print.c (printing_unreadable_lcrecord): * print.c (external_object_printer): * print.c (debug_p4): * process.c (finalize_process): * process.c (make_process_internal): * procimpl.h (struct Lisp_Process): * rangetab.c (Fmake_range_table): * rangetab.c (Fcopy_range_table): * rangetab.h (struct Lisp_Range_Table): * scrollbar.c: * scrollbar.c (create_scrollbar_instance): * scrollbar.c (compute_scrollbar_instance_usage): * scrollbar.h (struct scrollbar_instance): * specifier.c (finalize_specifier): * specifier.c (sizeof_specifier): * specifier.c (set_specifier_caching): * specifier.h (struct Lisp_Specifier): * specifier.h (struct specifier_caching): * symeval.h: * symeval.h (SYMBOL_VALUE_MAGIC_P): * symeval.h (DEFVAR_SYMVAL_FWD): * symsinit.h: * syntax.c (init_buffer_syntax_cache): * syntax.h (struct syntax_cache): * toolbar.c: * toolbar.c (allocate_toolbar_button): * toolbar.c (update_toolbar_button): * toolbar.h (struct toolbar_button): * tooltalk.c (struct Lisp_Tooltalk_Message): * tooltalk.c (make_tooltalk_message): * tooltalk.c (struct Lisp_Tooltalk_Pattern): * tooltalk.c (make_tooltalk_pattern): * ui-gtk.c: * ui-gtk.c (allocate_ffi_data): * ui-gtk.c (emacs_gtk_object_finalizer): * ui-gtk.c (allocate_emacs_gtk_object_data): * ui-gtk.c (allocate_emacs_gtk_boxed_data): * ui-gtk.h: * window-impl.h (struct window): * window-impl.h (struct window_mirror): * window.c (finalize_window): * window.c (allocate_window): * window.c (new_window_mirror): * window.c (mark_window_as_deleted): * window.c (make_dummy_parent): * window.c (compute_window_mirror_usage): * window.c (compute_window_usage): Overall point of this change and previous ones in this repository: (1) Introduce new, clearer terminology: everything other than int or char is a "record" object, which comes in two types: "normal objects" and "frob-block objects". Fix up all places that referred to frob-block objects as "simple", "basic", etc. (2) Provide an advertised interface for doing operations on Lisp objects, including creating new types, that is clean and consistent in its naming, uses the above-referenced terms and avoids referencing "lrecords", "old lcrecords", etc., which should hide under the surface. (3) Make the size_in_bytes and finalizer methods take a Lisp_Object rather than a void * for consistency with other methods. (4) Separate finalizer method into finalizer and disksaver, so that normal finalize methods don't have to worry about disksaving. Other specifics: (1) Renaming: LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT implementation->basic_p -> implementation->frob_block_p ALLOCATE_FIXED_TYPE_AND_SET_IMPL -> ALLOC_FROB_BLOCK_LISP_OBJECT *FCCONFIG*, wrap_fcconfig -> *FC_CONFIG*, wrap_fc_config *FCPATTERN*, wrap_fcpattern -> *FC_PATTERN*, wrap_fc_pattern (the last two changes make the naming of these macros consistent with the naming of all other macros, since the objects are named fc-config and fc-pattern with a hyphen) (2) Lots of documentation fixes in lrecord.h. (3) Eliminate macros for copying, freeing, zeroing objects, getting their storage size. Instead, new functions: zero_sized_lisp_object() zero_nonsized_lisp_object() lisp_object_storage_size() free_normal_lisp_object() (copy_lisp_object() already exists) LISP_OBJECT_FROB_BLOCK_P() (actually a macro) Eliminated: free_lrecord() zero_lrecord() copy_lrecord() copy_sized_lrecord() old_copy_lcrecord() old_copy_sized_lcrecord() old_zero_lcrecord() old_zero_sized_lcrecord() LISP_OBJECT_STORAGE_SIZE() COPY_SIZED_LISP_OBJECT() COPY_SIZED_LCRECORD() COPY_LISP_OBJECT() ZERO_LISP_OBJECT() FREE_LISP_OBJECT() (4) Catch the remaining places where lrecord stuff was used directly and use the advertised interface, e.g. alloc_sized_lrecord() -> ALLOC_SIZED_LISP_OBJECT(). (5) Make certain statically-declared pseudo-objects (buffer_local_flags, console_local_flags) have their lheader initialized correctly, so things like copy_lisp_object() can work on them. Make extent_auxiliary_defaults a proper heap object Vextent_auxiliary_defaults, and make extent auxiliaries dumpable so that this object can be dumped. allocate_extent_auxiliary() now just creates the object, and attach_extent_auxiliary() creates an extent auxiliary and attaches to an extent, like the old allocate_extent_auxiliary(). (6) Create EXTENT_AUXILIARY_SLOTS macro, similar to the foo-slots.h files but in a macro instead of a file. The purpose is to avoid duplication when iterating over all the slots in an extent auxiliary. Use it. (7) In lstream.c, don't zero out object after allocation because allocation routines take care of this. (8) In marker.c, fix a mistake in computing marker overhead. (9) In print.c, clean up printing_unreadable_lcrecord(), external_object_printer() to avoid lots of ifdef NEW_GC's. (10) Separate toolbar-button allocation into a separate allocate_toolbar_button() function for use in the example code in lrecord.h.
author Ben Wing <ben@xemacs.org>
date Fri, 05 Mar 2010 04:08:17 -0600
parents e29fcfd8df5f
children 5502045ec510
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 ;;; frame.el --- multi-frame management independent of window systems.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
3 ;; Copyright (C) 1993, 1994, 1996, 1997, 2000, 2001, 2003
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
4 ;; Free Software Foundation, Inc.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995, 1996 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Keywords: internal, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
27 ;;; Synched up with: FSF 21.3.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 ;;; Commentary:
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 ;; This file is dumped with XEmacs.
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 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
35 ;; XEmacs addition
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 (defgroup frames nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 "Support for Emacs frames and window systems."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 :group 'environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
40 ;; XEmacs change: No need for `frame-creation-function'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
42 ;; XEmacs change: Emacs no longer specifies the minibuffer property here.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 ;;; The initial value given here for this must ask for a minibuffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 ;;; There must always exist a frame with a minibuffer, and after we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ;;; delete the terminal frame, this will be the only frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 (defcustom initial-frame-plist '(minibuffer t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 "Plist of frame properties for creating the initial X window frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 You can set this in your `.emacs' file; for example,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 (setq initial-frame-plist '(top 1 left 1 width 80 height 55))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 Properties specified here supersede the values given in `default-frame-plist'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 The format of this can also be an alist for backward compatibility.
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 If the value calls for a frame without a minibuffer, and you have not created
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 a minibuffer frame on your own, one is created according to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 `minibuffer-frame-plist'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 You can specify geometry-related options for just the initial frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 by setting this variable in your `.emacs' file; however, they won't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 take effect until Emacs reads `.emacs', which happens after first creating
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 the frame. If you want the frame to have the proper geometry as soon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 as it appears, you need to use this three-step process:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 * Specify X resources to give the geometry you want.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 * Set `default-frame-plist' to override these options so that they
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 don't affect subsequent frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 * Set `initial-frame-plist' in a way that matches the X resources,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 to override what you put in `default-frame-plist'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 :type 'plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 :group 'frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 (defcustom minibuffer-frame-plist '(width 80 height 2 menubar-visible-p nil
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
71 default-toolbar-visible-p nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 "Plist of frame properties for initially creating a minibuffer frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 You can set this in your `.emacs' file; for example,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (setq minibuffer-frame-plist '(top 1 left 1 width 80 height 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 Properties specified here supersede the values given in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 `default-frame-plist'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 The format of this can also be an alist for backward compatibility."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 :type 'plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 :group 'frames)
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 (defcustom pop-up-frame-plist nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 "Plist of frame properties used when creating pop-up frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 Pop-up frames are used for completions, help, and the like.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 This variable can be set in your init file, like this:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 (setq pop-up-frame-plist '(width 80 height 20))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
86 These supersede the values given in `default-frame-plist', for pop-up frames.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 The format of this can also be an alist for backward compatibility."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 :type 'plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 :group 'frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 (setq pop-up-frame-function
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
92 #'(lambda ()
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
93 (make-frame pop-up-frame-plist)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 (defcustom special-display-frame-plist '(height 14 width 80 unsplittable t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 "*Plist of frame properties used when creating special frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Special frames are used for buffers whose names are in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 `special-display-buffer-names' and for buffers whose names match
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 one of the regular expressions in `special-display-regexps'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 This variable can be set in your init file, like this:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 (setq special-display-frame-plist '(width 80 height 20))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 These supersede the values given in `default-frame-plist'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 The format of this can also be an alist for backward compatibility."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 :type 'plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 :group 'frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
107 ;; XEmacs addition
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 (defun safe-alist-to-plist (cruftiness)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 (if (consp (car cruftiness))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 (alist-to-plist cruftiness)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 cruftiness))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
113 ;; XEmacs change: require args to be a plist instead of an alist.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 (defun special-display-popup-frame (buffer &optional args)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
115 "Display BUFFER in its own frame, reusing an existing window if any.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
116 Return the window chosen.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
117 Currently we do not insist on selecting the window within its frame.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
118 If ARGS is a plist, use it as a list of frame property specs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
119 If ARGS is a list whose car is t,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
120 use (cadr ARGS) as a function to do the work.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
121 Pass it BUFFER as first arg, and (cddr ARGS) gives the rest of the args."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 ;; if we can't display simultaneous multiple frames, just return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 ;; nil and let the normal behavior take over.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 (and (device-on-window-system-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 (if (and args (eq t (car args)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 (apply (cadr args) buffer (cddr args))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 (let ((window (get-buffer-window buffer t)))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
128 (setq args (safe-alist-to-plist args))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
129 (or
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
130 ;; If we have a window already, make it visible.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
131 (when window
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
132 (let ((frame (window-frame window)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
133 (make-frame-visible frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
134 (raise-frame frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
135 window))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
136 ;; Reuse the current window if the user requested it.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
137 (when (lax-plist-get args 'same-window)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
138 (condition-case nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
139 (progn (switch-to-buffer buffer) (selected-window))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
140 (error nil)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
141 ;; Stay on the same frame if requested.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
142 (when (or (lax-plist-get args 'same-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
143 (lax-plist-get args 'same-window))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
144 (let* ((pop-up-frames nil) (pop-up-windows t)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
145 special-display-regexps special-display-buffer-names
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
146 (window (display-buffer buffer)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
147 ;; (set-window-dedicated-p window t)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
148 window))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
149 ;; If no window yet, make one in a new frame.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
150 (let ((frame (make-frame (append args
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
151 (safe-alist-to-plist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
152 special-display-frame-plist)))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
153 (set-window-buffer (frame-selected-window frame) buffer)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
154 (set-window-dedicated-p (frame-selected-window frame) t)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
155 (frame-selected-window frame)))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
157 ;; XEmacs change: comment out
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 ;(defun handle-delete-frame (event)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
159 ; "Handle delete-frame events from the X server."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 ; (interactive "e")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 ; (let ((frame (posn-window (event-start event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 ; (i 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 ; (tail (frame-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 ; (while tail
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 ; (and (frame-visible-p (car tail))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 ; (not (eq (car tail) frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 ; (setq i (1+ i)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 ; (setq tail (cdr tail)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 ; (if (> i 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 ; (delete-frame frame t)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
171 ; ;; Gildea@x.org says it is ok to ask questions before terminating.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
172 ; (save-buffers-kill-emacs))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 ;;;; Arrangement of frames at startup
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
176 ;; 1) Load the window system startup file from the lisp library and read the
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
177 ;; high-priority arguments (-q and the like). The window system startup
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
178 ;; file should create any frames specified in the window system defaults.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
179 ;;
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
180 ;; 2) If no frames have been opened, we open an initial text frame.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
181 ;;
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
182 ;; 3) Once the init file is done, we apply any newly set properties
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
183 ;; in initial-frame-plist to the frame.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
185 ;; These are now called explicitly at the proper times,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
186 ;; since that is easier to understand.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
187 ;; Actually using hooks within Emacs is bad for future maintenance. --rms.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
188 ;; (add-hook 'before-init-hook 'frame-initialize)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
189 ;; (add-hook 'window-setup-hook 'frame-notice-user-settings)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
190
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
191 ;; If we create the initial frame, this is it.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 (defvar frame-initial-frame nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 ;; Record the properties used in frame-initialize to make the initial frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 (defvar frame-initial-frame-plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 (defvar frame-initial-geometry-arguments nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
199 ;; XEmacs addition
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 (defun canonicalize-frame-plists ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 (setq initial-frame-plist (safe-alist-to-plist initial-frame-plist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 (setq default-frame-plist (safe-alist-to-plist default-frame-plist)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
204 ;; startup.el calls this function before loading the user's init
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
205 ;; file - if there is no frame with a minibuffer open now, create
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
206 ;; one to display messages while loading the init file.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 (defun frame-initialize ()
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
208 "Create an initial frame if necessary."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 ;; In batch mode, we actually use the initial terminal device for output.
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
210 ;; XEmacs addition
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 (canonicalize-frame-plists)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
212
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 (if (not (noninteractive))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 (progn
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
215 ;; Turn on special-display processing only if there's a window system.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
216 (setq special-display-function 'special-display-popup-frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 ;; If there is no frame with a minibuffer besides the terminal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 ;; frame, then we need to create the opening frame. Make sure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 ;; it has a minibuffer, but let initial-frame-plist omit the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 ;; minibuffer spec.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 (or (delq terminal-frame (minibuffer-frame-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 (setq frame-initial-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 (append initial-frame-plist default-frame-plist))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
226 ;; XEmacs change: omit the scrollbar settings
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
227 ; (or (assq 'horizontal-scroll-bars frame-initial-frame-alist)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
228 ; (setq frame-initial-frame-alist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
229 ; (cons '(horizontal-scroll-bars . t)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
230 ; frame-initial-frame-alist)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 (setq default-minibuffer-frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 (setq frame-initial-frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 (make-frame initial-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 (car (delq terminal-device
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 (device-list))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 ;; Delete any specifications for window geometry properties
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 ;; so that we won't reapply them in frame-notice-user-settings.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 ;; It would be wrong to reapply them then,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 ;; because that would override explicit user resizing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 (setq initial-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 (frame-remove-geometry-props initial-frame-plist))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 ;; At this point, we know that we have a frame open, so we
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
243 ;; can delete the terminal frame.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
244 ;; XEmacs change: Do it the same way Fkill_emacs does it. -slb
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 (delete-console terminal-console)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
246 (setq terminal-frame nil))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
248 ;; XEmacs change: omit the pc window-system stuff.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
249 ; ;; No, we're not running a window system. Use make-terminal-frame if
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
250 ; ;; we support that feature, otherwise arrange to cause errors.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
251 ; (or (eq window-system 'pc)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
252 ; (setq frame-creation-function
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
253 ; (if (fboundp 'tty-create-frame-with-faces)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
254 ; 'tty-create-frame-with-faces
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
255 ; (function
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
256 ; (lambda (parameters)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
257 ; (error
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
258 ; "Can't create multiple frames without a window system"))))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
259 ))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
260
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
261 (defvar frame-notice-user-settings t
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
262 "Non-nil means function `frame-notice-user-settings' wasn't run yet.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
264 ;; startup.el calls this function after loading the user's init
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
265 ;; file. Now default-frame-plist and initial-frame-plist contain
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
266 ;; information to which we must react; do what needs to be done.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 (defun frame-notice-user-settings ()
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
268 "Act on user's init file settings of frame parameters.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
269 React to settings of `default-frame-plist', `initial-frame-plist' there."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
270 ;; XEmacs addition
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
271 (canonicalize-frame-plists)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
273 ;; XEmacs change: omit menu-bar manipulations.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
274 ; ;; Make menu-bar-mode and default-frame-alist consistent.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
275 ; (when (boundp 'menu-bar-mode)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
276 ; (let ((default (assq 'menu-bar-lines default-frame-alist)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
277 ; (if default
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
278 ; (setq menu-bar-mode (not (eq (cdr default) 0)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
279 ; (setq default-frame-alist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
280 ; (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
281 ; default-frame-alist)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
283 ;; XEmacs change: omit tool-bar manipulations.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
284 ; ;; Make tool-bar-mode and default-frame-alist consistent. Don't do
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
285 ; ;; it in batch mode since that would leave a tool-bar-lines
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
286 ; ;; parameter in default-frame-alist in a dumped Emacs, which is not
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
287 ; ;; what we want.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
288 ; (when (and (boundp 'tool-bar-mode)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
289 ; (not noninteractive))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
290 ; (let ((default (assq 'tool-bar-lines default-frame-alist)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
291 ; (if default
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
292 ; (setq tool-bar-mode (not (eq (cdr default) 0)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
293 ; (setq default-frame-alist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
294 ; (cons (cons 'tool-bar-lines (if tool-bar-mode 1 0))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
295 ; default-frame-alist)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 ;; Creating and deleting frames may shift the selected frame around,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 ;; and thus the current buffer. Protect against that. We don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 ;; want to use save-excursion here, because that may also try to set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 ;; the buffer of the selected window, which fails when the selected
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 ;; window is the minibuffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 (let ((old-buffer (current-buffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
304 ;; XEmacs change: omit special handling for MS-DOS
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
305 ; (when (and frame-notice-user-settings
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
306 ; (null frame-initial-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
307 ; ;; This case happens when we don't have a window system, and
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
308 ; ;; also for MS-DOS frames.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
309 ; (let ((parms (frame-parameters frame-initial-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
310 ; ;; Don't change the frame names.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
311 ; (setq parms (delq (assq 'name parms) parms))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
312 ; ;; Can't modify the minibuffer parameter, so don't try.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
313 ; (setq parms (delq (assq 'minibuffer parms) parms))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
314 ; (modify-frame-parameters nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
315 ; (if (null window-system)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
316 ; (append initial-frame-alist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
317 ; default-frame-alist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
318 ; parms
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
319 ; nil)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
320 ; ;; initial-frame-alist and
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
321 ; ;; default-frame-alist were already
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
322 ; ;; applied in pc-win.el.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
323 ; parms))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
324 ; (if (null window-system) ;; MS-DOS does this differently in pc-win.el
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
325 ; (let ((newparms (frame-parameters))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
326 ; (frame (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
327 ; (tty-handle-reverse-video frame newparms)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
328 ; ;; If we changed the background color, we need to update
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
329 ; ;; the background-mode parameter, and maybe some faces,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
330 ; ;; too.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
331 ; (when (assq 'background-color newparms)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
332 ; (unless (or (assq 'background-mode initial-frame-alist)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
333 ; (assq 'background-mode default-frame-alist))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
334 ; (frame-set-background-mode frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
335 ; (face-set-after-frame-default frame))))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
336
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 ;; If the initial frame is still around, apply initial-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 ;; and default-frame-plist to it.
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
339 (when (frame-live-p frame-initial-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
340
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
341 ;; XEmacs change: omit the tool-bar manipulations
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
342 ; ;; When tool-bar has been switched off, correct the frame size
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
343 ; ;; by the lines added in x-create-frame for the tool-bar and
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
344 ; ;; switch `tool-bar-mode' off.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
345 ; (when (display-graphic-p)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
346 ; (let ((tool-bar-lines (or (assq 'tool-bar-lines initial-frame-alist)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
347 ; (assq 'tool-bar-lines default-frame-alist))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
348 ; (when (and tool-bar-originally-present
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
349 ; (or (null tool-bar-lines)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
350 ; (null (cdr tool-bar-lines))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
351 ; (eq 0 (cdr tool-bar-lines))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
352 ; (let* ((char-height (frame-char-height frame-initial-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
353 ; (image-height tool-bar-images-pixel-height)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
354 ; (margin (cond ((and (consp tool-bar-button-margin)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
355 ; (integerp (cdr tool-bar-button-margin))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
356 ; (> tool-bar-button-margin 0))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
357 ; (cdr tool-bar-button-margin))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
358 ; ((and (integerp tool-bar-button-margin)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
359 ; (> tool-bar-button-margin 0))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
360 ; tool-bar-button-margin)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
361 ; (t 0)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
362 ; (relief (if (and (integerp tool-bar-button-relief)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
363 ; (> tool-bar-button-relief 0))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
364 ; tool-bar-button-relief 3))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
365 ; (lines (/ (+ image-height
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
366 ; (* 2 margin)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
367 ; (* 2 relief)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
368 ; (1- char-height))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
369 ; char-height))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
370 ; (height (frame-parameter frame-initial-frame 'height))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
371 ; (newparms (list (cons 'height (- height lines))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
372 ; (initial-top (cdr (assq 'top
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
373 ; frame-initial-geometry-arguments)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
374 ; (top (frame-parameter frame-initial-frame 'top)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
375 ; (when (and (consp initial-top) (eq '- (car initial-top)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
376 ; (let ((adjusted-top
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
377 ; (cond ((and (consp top)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
378 ; (eq '+ (car top)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
379 ; (list '+
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
380 ; (+ (cadr top)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
381 ; (* lines char-height))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
382 ; ((and (consp top)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
383 ; (eq '- (car top)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
384 ; (list '-
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
385 ; (- (cadr top)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
386 ; (* lines char-height))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
387 ; (t (+ top (* lines char-height))))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
388 ; (setq newparms
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
389 ; (append newparms
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
390 ; `((top . ,adjusted-top))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
391 ; nil))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
392 ; (modify-frame-parameters frame-initial-frame newparms)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
393 ; (tool-bar-mode -1)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 ;; The initial frame we create above always has a minibuffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 ;; If the user wants to remove it, or make it a minibuffer-only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 ;; frame, then we'll have to delete the selected frame and make a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 ;; new one; you can't remove or add a root window to/from an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 ;; existing frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 ;; NOTE: default-frame-plist was nil when we created the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 ;; existing frame. We need to explicitly include
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 ;; default-frame-plist in the properties of the screen we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 ;; create here, so that its new value, gleaned from the user's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 ;; .emacs file, will be applied to the existing screen.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 (if (not (eq (car
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 (or (and (lax-plist-member
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 initial-frame-plist 'minibuffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 (list (lax-plist-get initial-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 'minibuffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 (and (lax-plist-member default-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 'minibuffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 (list (lax-plist-get default-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 'minibuffer)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 '(t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 ;; Create the new frame.
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
418 (let (props ;new
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
419 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 ;; If the frame isn't visible yet, wait till it is.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 ;; If the user has to position the window,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 ;; Emacs doesn't know its real position until
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 ;; the frame is seen to be visible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
425 ;; XEmacs change: check the initially-unmapped property
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 (if (frame-property frame-initial-frame 'initially-unmapped)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 (while (not (frame-visible-p frame-initial-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 (sleep-for 1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 (setq props (frame-properties frame-initial-frame))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
431
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 ;; Get rid of `name' unless it was specified explicitly before.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 (or (lax-plist-member frame-initial-frame-plist 'name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 (setq props (lax-plist-remprop props 'name)))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
435
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
436 (setq props (append initial-frame-plist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
437 default-frame-plist
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 props
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 nil))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
440
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 ;; Get rid of `reverse', because that was handled
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 ;; when we first made the frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 (laxputf props 'reverse nil)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
444
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
445 ;; XEmacs addition: Get rid of `window-id', otherwise make-frame
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
446 ;; will think we're trying to setup an external widget.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 (laxremf props 'window-id)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
448
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 (if (lax-plist-member frame-initial-geometry-arguments 'height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 (laxremf props 'height))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 (if (lax-plist-member frame-initial-geometry-arguments 'width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 (laxremf props 'width))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 (if (lax-plist-member frame-initial-geometry-arguments 'left)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 (laxremf props 'left))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 (if (lax-plist-member frame-initial-geometry-arguments 'top)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 (laxremf props 'top))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 ;; Now create the replacement initial frame.
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
458 ;(setq new
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
459 (make-frame
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
460 ;; Use the geometry args that created the existing
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
461 ;; frame, rather than the props we get for it.
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
462 (append '(user-size t user-position t)
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
463 frame-initial-geometry-arguments
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
464 props))
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
465 ;)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 ;; The initial frame, which we are about to delete, may be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 ;; the only frame with a minibuffer. If it is, create a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 ;; new one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 (or (delq frame-initial-frame (minibuffer-frame-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 (make-initial-minibuffer-frame nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 ;; If the initial frame is serving as a surrogate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 ;; minibuffer frame for any frames, we need to wean them
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 ;; onto a new frame. The default-minibuffer-frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 ;; variable must be handled similarly.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 (let ((users-of-initial
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 (filtered-frame-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 #'(lambda (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 (and (not (eq frame frame-initial-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 (eq (window-frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 (minibuffer-window frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 frame-initial-frame))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 (if (or users-of-initial
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 (eq default-minibuffer-frame frame-initial-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 ;; Choose an appropriate frame. Prefer frames which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 ;; are only minibuffers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 (let* ((new-surrogate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 (car
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 (or (filtered-frame-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 #'(lambda (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 (eq 'only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 (frame-property frame 'minibuffer))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 (minibuffer-frame-list))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (new-minibuffer (minibuffer-window new-surrogate)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 (if (eq default-minibuffer-frame frame-initial-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 (setq default-minibuffer-frame new-surrogate))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 ;; Wean the frames using frame-initial-frame as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 ;; their minibuffer frame.
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
502 (mapc
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
503 #'(lambda (frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
504 (set-frame-property frame 'minibuffer
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
505 new-minibuffer))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
506 users-of-initial))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 ;; Redirect events enqueued at this frame to the new frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 ;; Is this a good idea?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 ;; Probably not, since this whole redirect-frame-focus
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 ;; stuff is a load of trash, and so is this function we're in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 ;; --ben
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 ;(redirect-frame-focus frame-initial-frame new)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 ;; Finally, get rid of the old frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 (delete-frame frame-initial-frame t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 ;; Otherwise, we don't need all that rigamarole; just apply
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 ;; the new properties.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 (let (newprops allprops tail)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 (setq allprops (append initial-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 default-frame-plist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 (if (lax-plist-member frame-initial-geometry-arguments 'height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 (laxremf allprops 'height))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 (if (lax-plist-member frame-initial-geometry-arguments 'width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 (remf allprops 'width))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 (if (lax-plist-member frame-initial-geometry-arguments 'left)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 (laxremf allprops 'left))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 (if (lax-plist-member frame-initial-geometry-arguments 'top)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 (laxremf allprops 'top))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 (setq tail allprops)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 ;; Find just the props that have changed since we first
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 ;; made this frame. Those are the ones actually set by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 ;; the init file. For those props whose values we already knew
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 ;; (such as those spec'd by command line options)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 ;; it is undesirable to specify the parm again
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 ;; once the user has seen the frame and been able to alter it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 ;; manually.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 (while tail
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 (let (newval oldval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 (setq oldval (lax-plist-get frame-initial-frame-plist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 (car tail)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 (setq newval (lax-plist-get allprops (car tail)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 (or (eq oldval newval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 (laxputf newprops (car tail) newval)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 (setq tail (cddr tail)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 (set-frame-properties frame-initial-frame newprops)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
548 ;; XEmacs change: omit the background manipulation
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
549 ; ;; If we changed the background color,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
550 ; ;; we need to update the background-mode parameter
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
551 ; ;; and maybe some faces too.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
552 ; (when (assq 'background-color newparms)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
553 ; (unless (assq 'background-mode newparms)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
554 ; (frame-set-background-mode frame-initial-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
555 ; (face-set-after-frame-default frame-initial-frame)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 ;; Restore the original buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 (set-buffer old-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 ;; Make sure the initial frame can be GC'd if it is ever deleted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 ;; Make sure frame-notice-user-settings does nothing if called twice.
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
563 (setq frame-notice-user-settings nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 (setq frame-initial-frame nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 (defun make-initial-minibuffer-frame (device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 (let ((props (append '(minibuffer only)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 (safe-alist-to-plist minibuffer-frame-plist))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 (make-frame props device)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 ;;;; Creation of additional frames, and other frame miscellanea
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
574 (defun modify-all-frames-properties (plist)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
575 "Modify all current and future frames' parameters according to PLIST.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
576 This changes `default-frame-plist' and possibly `initial-frame-plist'.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
577 See `set-frame-properties' for more information."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
578 (dolist (frame (frame-list))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
579 (set-frame-properties frame plist))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
580
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
581 ;; XEmacs change: iterate over plists instead of alists
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
582 (map-plist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
583 #'(lambda (prop val)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
584 ;; initial-frame-plist needs setting only when
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
585 ;; frame-notice-user-settings is true
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
586 (and frame-notice-user-settings
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
587 (lax-plist-remprop initial-frame-plist prop))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
588 (lax-plist-remprop default-frame-plist prop))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
589 plist)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
590
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
591 (and frame-notice-user-settings
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
592 (setq initial-frame-plist (append initial-frame-plist plist)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
593 (setq default-frame-plist (append default-frame-plist plist)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
594
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 (defun get-other-frame ()
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
596 "Return some frame other than the current frame.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
597 Create one if necessary. Note that the minibuffer frame, if separate,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
598 is not considered (see `next-frame')."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 (let* ((this (selected-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 ;; search visible frames first
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 (next (next-frame this 'visible-nomini)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 ;; then search iconified frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 (if (eq this next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 (setq next (next-frame 'visible-iconic-nomini)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 (if (eq this next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 ;; otherwise, make a new frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 (make-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 next)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 (defun next-multiframe-window ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 "Select the next window, regardless of which frame it is on."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 (select-window (next-window (selected-window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 (> (minibuffer-depth) 0)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
615 t))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
616 ;; XEmacs change: select-window already selects the containing frame
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
617 ;(select-frame-set-input-focus (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
618 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 (defun previous-multiframe-window ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 "Select the previous window, regardless of which frame it is on."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 (select-window (previous-window (selected-window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 (> (minibuffer-depth) 0)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
625 t))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
626 ;; XEmacs change: select-window already selects the containing frame
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
627 ;(select-frame-set-input-focus (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
628 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
630 ;; XEmacs change: Emacs has make-frame-on-display
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 (defun make-frame-on-device (type connection &optional props)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 "Create a frame of type TYPE on CONNECTION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 TYPE should be a symbol naming the device type, i.e. one of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 x An X display. CONNECTION should be a standard display string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 such as \"unix:0\", or nil for the display specified on the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 command line or in the DISPLAY environment variable. Only if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 support for X was compiled into XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639 tty A standard TTY connection or terminal. CONNECTION should be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 a TTY device name such as \"/dev/ttyp2\" (as determined by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 the Unix command `tty') or nil for XEmacs' standard input
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 and output (usually the TTY in which XEmacs started). Only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 if support for TTY's was compiled into XEmacs.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 444
diff changeset
644 gtk A GTK device.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 mswindows A connection to a machine running Microsoft Windows NT or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 Windows 95/97.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 pc A direct-write MS-DOS frame. Not currently implemented.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 PROPS should be a plist of properties, as in the call to `make-frame'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 If a connection to CONNECTION already exists, it is reused; otherwise,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 a new connection is opened."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 (make-frame props (make-device type connection props)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
655 ;; XEmacs omission: Emacs has make-frame-command here, but it reduces to
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
656 ;; make-frame for us.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
657
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
658 ;; XEmacs omission: the following 2 variables are not yet implemented.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
659 ;(defvar before-make-frame-hook nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
660 ; "Functions to run before a frame is created.")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
661 ;
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
662 ;(defvar after-make-frame-functions nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
663 ; "Functions to run after a frame is created.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
664 ;The functions are run with one arg, the newly created frame.")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
665 ;
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
666 (defvar after-setting-font-hook nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
667 "Functions to run after a frame's font has been changed.")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
668
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 ;; Alias, kept temporarily.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 (defalias 'new-frame 'make-frame)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
671 (make-obsolete 'new-frame 'make-frame)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
673 ;; XEmacs change: Emacs has make-frame here. We have it in C, so no need for
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
674 ;; frame-creation-function.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
676 ;; XEmacs addition: support optional DEVICE argument.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 (defun filtered-frame-list (predicate &optional device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 "Return a list of all live frames which satisfy PREDICATE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 If optional second arg DEVICE is non-nil, restrict the frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 returned to that device."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 (let ((frames (if device (device-frame-list device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 (frame-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 good-frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 (while (consp frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 (if (funcall predicate (car frames))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 (setq good-frames (cons (car frames) good-frames)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 (setq frames (cdr frames)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 good-frames))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
690 ;; XEmacs addition: support optional DEVICE argument.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 (defun minibuffer-frame-list (&optional device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 "Return a list of all frames with their own minibuffers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 If optional second arg DEVICE is non-nil, restrict the frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 returned to that device."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 (filtered-frame-list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 #'(lambda (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 (eq frame (window-frame (minibuffer-window frame))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
700 ;; XEmacs omission: Emacs has frames-on-display-list here, but that is
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
701 ;; essentially equivalent to supplying the optional DEVICE argument to
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
702 ;; filtered-frame-list.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
703
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
704 ;; XEmacs addition: the following two functions make life a lot simpler below.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
705 (defsubst display-frame (display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
706 "Return the active frame for DISPLAY.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
707 DISPLAY may be a frame, a device, or a console. If it is omitted or nil,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
708 it defaults to the selected frame."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
709 (cond
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
710 ((null display) (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
711 ((framep display) display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
712 ((devicep display) (selected-frame display))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
713 ((consolep display) (selected-frame (car (console-device-list display))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
714 (t (error 'wrong-type-argument "Not a frame, device, or console" display))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
715
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
716 (defsubst display-device (display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
717 "Return the device for DISPLAY.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
718 DISPLAY may be a frame, a device, or a console. If it is omitted or nil,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
719 it defaults to the selected frame."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
720 (cond
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
721 ((null display) (selected-device))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
722 ((framep display) (frame-device display))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
723 ((devicep display) display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
724 ((consolep display) (car (console-device-list display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
725 (t (error 'wrong-type-argument "Not a frame, device, or console" display))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
726
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
727 ;; Emacs compatibility function. We do not allow display names of the type
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
728 ;; HOST:SERVER.SCREEN as Emacs does, but we do handle devices and consoles.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
729 (defun framep-on-display (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
730 "Return the type of frames on DISPLAY.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
731 DISPLAY may be a frame, a device, or a console. If it is a frame, its type
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
732 is returned. If DISPLAY is omitted or nil, it defaults to the selected
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
733 frame. All frames on a given device or console are of the same type."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
734 (cond
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
735 ((null display) (frame-type (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
736 ((framep display) (frame-type display))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
737 ((devicep display) (device-type display))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
738 ((consolep display) (console-type display))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
739 (t (error 'wrong-type-argument "Not a frame, device, or console" display))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
740
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
741 ;; XEmacs addition: Emacs does not have this function.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 (defun frame-minibuffer-only-p (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 "Return non-nil if FRAME is a minibuffer-only frame."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 (eq (frame-root-window frame) (minibuffer-window frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 (defun frame-remove-geometry-props (plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 "Return the property list PLIST, but with geometry specs removed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 This deletes all bindings in PLIST for `top', `left', `width',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 `height', `user-size' and `user-position' properties.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 Emacs uses this to avoid overriding explicit moves and resizings from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 the user during startup."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 (setq plist (canonicalize-lax-plist (copy-sequence plist)))
4783
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
753 (mapc #'(lambda (property)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
754 (if (lax-plist-member plist property)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
755 (progn
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
756 (setq frame-initial-geometry-arguments
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
757 (cons property
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
758 (cons (lax-plist-get plist property)
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
759 frame-initial-geometry-arguments)))
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
760 (setq plist (lax-plist-remprop plist property)))))
e29fcfd8df5f Eliminate most core code byte-compile warnings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4759
diff changeset
761 '(height width top left user-size user-position))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
764 ;; XEmacs change: Emacs has focus-follows-mouse here, which lets them
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
765 ;; Customize it. XEmacs has it builtin. Should that change?
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
766
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
767 ;; XEmacs change: we have focus-frame instead of multiple foo-focus-frame
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
768 ;; functions.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
769 (defun select-frame-set-input-focus (frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
770 "Select FRAME, raise it, and set input focus, if possible."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
771 (raise-frame frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
772 (focus-frame frame) ;; This also selects FRAME
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
773 ;; XEmacs change: This is a bad idea; you should in general never warp the
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
774 ;; pointer unless the user asks for it.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
775 ;;(if focus-follows-mouse
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
776 ;; (set-mouse-position (selected-window) (1- (frame-width frame)) 0)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
777 )
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
778
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 (defun other-frame (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 "Select the ARG'th different visible frame, and raise it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 All frames are arranged in a cyclic order.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 This command selects the frame ARG steps away in that order.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 A negative ARG moves in the opposite order.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
785 To make this command work properly, you must tell Emacs
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
786 how the system (or the window manager) generally handles
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
787 focus-switching between windows. If moving the mouse onto a window
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
788 selects it (gives it focus), set `focus-follows-mouse' to t.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
789 Otherwise, that variable should be nil."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 (interactive "p")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 (let ((frame (selected-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 (while (> arg 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 (setq frame (next-frame frame 'visible-nomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 (setq arg (1- arg)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 (while (< arg 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 (setq frame (previous-frame frame 'visible-nomini))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 (setq arg (1+ arg)))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
798 (select-frame-set-input-focus frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
799
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
800 (defun iconify-or-deiconify-frame ()
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
801 "Iconify the selected frame, or deiconify if it's currently an icon."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
802 (interactive)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
803 (if (lax-plist-get (frame-properties) 'visibility)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
804 (iconify-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
805 (make-frame-visible)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
806
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
807 (defun make-frame-names-alist ()
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
808 (let* ((current-frame (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
809 (falist
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
810 (cons
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
811 (cons (frame-property current-frame 'name) current-frame) nil))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
812 (frame (next-frame current-frame t)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
813 (while (not (eq frame current-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
814 (progn
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
815 (setq falist (cons (cons (frame-property frame 'name) frame) falist))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
816 (setq frame (next-frame frame t))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
817 falist))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
818
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
819 (defvar frame-name-history nil)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
820 (defun select-frame-by-name (name)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
821 "Select the frame on the current terminal whose name is NAME and raise it.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
822 If there is no frame by that name, signal an error."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
823 (interactive
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
824 (let* ((frame-names-alist (make-frame-names-alist))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
825 (default (car (car frame-names-alist)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
826 (input (completing-read
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
827 (format "Select Frame (default %s): " default)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
828 frame-names-alist nil t nil 'frame-name-history default)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
829 ;; XEmacs change: use the last param of completing-read to simplify.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
830 (list input)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
831 (let* ((frame-names-alist (make-frame-names-alist))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
832 (frame (cdr (assoc name frame-names-alist))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
833 (or frame
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
834 (error "There is no frame named `%s'" name))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
835 (make-frame-visible frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
836 ;; XEmacs change: make-frame-visible implies (raise-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
837 ;; (raise-frame frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
838 ;; XEmacs change: we defined this function, might as well use it.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
839 (select-frame-set-input-focus frame)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 ;; XEmacs-added utility functions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 (defmacro save-selected-frame (&rest body)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 "Execute forms in BODY, then restore the selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 The value returned is the value of the last form in BODY."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 (let ((old-frame (gensym "ssf")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 `(let ((,old-frame (selected-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 (progn ,@body)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 (select-frame ,old-frame)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 (defmacro with-selected-frame (frame &rest body)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 "Execute forms in BODY with FRAME as the selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 The value returned is the value of the last form in BODY."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 `(save-selected-frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 (select-frame ,frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 ,@body))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
859 ; This is in C in Emacs
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 (defun frame-list ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 "Return a list of all frames on all devices/consoles."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 ;; Lists are copies, so nconc is safe here.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 (apply 'nconc (mapcar 'device-frame-list (device-list))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 (defun frame-type (&optional frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 "Return the type of the specified frame (e.g. `x' or `tty').
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 This is equivalent to the type of the frame's device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 Value is `tty' for a tty frame (a character-only terminal),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 `x' for a frame that is an X window,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
870 `mswindows' for a frame that is a MS Windows desktop window,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
871 `msprinter' for a frame that is a MS Windows print job,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 `stream' for a stream frame (which acts like a stdio stream), and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 `dead' for a deleted frame."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 (or frame (setq frame (selected-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 (if (not (frame-live-p frame)) 'dead
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 (device-type (frame-device frame))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 (defun device-or-frame-p (object)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 "Return non-nil if OBJECT is a device or frame."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 (or (devicep object)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 (framep object)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 (defun device-or-frame-type (device-or-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 "Return the type (e.g. `x' or `tty') of DEVICE-OR-FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 DEVICE-OR-FRAME should be a device or a frame object. See `device-type'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 for a description of the possible types."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 (if (devicep device-or-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 (device-type device-or-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 (frame-type device-or-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 (defun fw-frame (obj)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 "Given a frame or window, return the associated frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 Return nil otherwise."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894 (cond ((windowp obj) (window-frame obj))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 ((framep obj) obj)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 (t nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 ;;;; Frame configurations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 (defun current-frame-configuration ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 "Return a list describing the positions and states of all frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 Its car is `frame-configuration'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 Each element of the cdr is a list of the form (FRAME PLIST WINDOW-CONFIG),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 where
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 FRAME is a frame object,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 PLIST is a property list specifying some of FRAME's properties, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 WINDOW-CONFIG is a window configuration object for FRAME."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 (cons 'frame-configuration
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 (mapcar (function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 (lambda (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 (list frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 (frame-properties frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 (current-window-configuration frame))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 (frame-list))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 (defun set-frame-configuration (configuration &optional nodelete)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 "Restore the frames to the state described by CONFIGURATION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 Each frame listed in CONFIGURATION has its position, size, window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 configuration, and other properties set as specified in CONFIGURATION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 Ordinarily, this function deletes all existing frames not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 listed in CONFIGURATION. But if optional second argument NODELETE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 is given and non-nil, the unwanted frames are iconified instead."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 (or (frame-configuration-p configuration)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 (signal 'wrong-type-argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 (list 'frame-configuration-p configuration)))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
927 (let ((config-alist (cdr configuration))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 frames-to-delete)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
929 (mapc #'(lambda (frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
930 (let ((properties (assq frame config-alist)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
931 (if properties
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
932 (progn
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
933 (set-frame-properties
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
934 frame
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
935 ;; Since we can't set a frame's minibuffer status,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
936 ;; we might as well omit the parameter altogether.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
937 (lax-plist-remprop (nth 1 properties) 'minibuffer))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
938 (set-window-configuration (nth 2 properties)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
939 (setq frames-to-delete (cons frame frames-to-delete)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 (frame-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 (if nodelete
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 ;; Note: making frames invisible here was tried
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 ;; but led to some strange behavior--each time the frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 ;; was made visible again, the window manager asked afresh
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 ;; for where to put it.
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
946 (mapc #'iconify-frame frames-to-delete)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
947 (mapc #'delete-frame frames-to-delete))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
949 ; XEmacs change: this function is in subr.el in Emacs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
950 ; That's because they don't always include frame.el, while we do.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 (defun frame-configuration-p (object)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 "Return non-nil if OBJECT seems to be a frame configuration.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 Any list whose car is `frame-configuration' is assumed to be a frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 configuration."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 (and (consp object)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 (eq (car object) 'frame-configuration)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
960 ;;;; Convenience functions for accessing and interactively changing
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
961 ;;;; frame parameters.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
962
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
963 (defun frame-height (&optional frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
964 "Return number of lines available for display on FRAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
965 If FRAME is omitted, describe the currently selected frame."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
966 (frame-property frame 'height))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
967
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
968 (defun frame-width (&optional frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
969 "Return number of columns available for display on FRAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
970 If FRAME is omitted, describe the currently selected frame."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
971 (frame-property frame 'width))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
972
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
973 (defalias 'set-default-font 'set-frame-font)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
974
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
975 ;; XEmacs change: this function differs significantly from Emacs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
976 (defun set-frame-font (font-name &optional keep-size)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
977 "Set the font of the selected frame to FONT-NAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
978 When called interactively, prompt for the name of the font to use.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
979 To get the frame's current default font, use `(face-font-name 'default)'.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
980
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
981 The default behavior is to keep the numbers of lines and columns in
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
982 the frame, thus may change its pixel size. If optional KEEP-SIZE is
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
983 non-nil (interactively, prefix argument) the current frame size (in
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
984 pixels) is kept by adjusting the numbers of the lines and columns."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
985 (interactive
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
986 (let* ((frame (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
987 (completion-ignore-case t)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
988 (font (completing-read "Font name: "
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
989 (mapcar #'list
2527
491f8cf78a9c [xemacs-hg @ 2005-01-28 02:58:38 by ben]
ben
parents: 2509
diff changeset
990 (font-list "*" frame))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
991 nil nil nil nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
992 (face-font-name 'default frame))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
993 (list font current-prefix-arg)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
994 (let* ((frame (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
995 (fht (frame-pixel-height frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
996 (fwd (frame-pixel-width frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
997 (face-list-to-change (face-list)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
998 (when (eq (device-type) 'mswindows)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
999 (setq face-list-to-change
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1000 (delq 'border-glyph face-list-to-change)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1001 ;; FIXME: Is it sufficient to just change the default face, due to
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1002 ;; face inheritance?
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1003 (dolist (face face-list-to-change)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1004 (when (face-font-instance face)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1005 (condition-case c
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1006 (set-face-font face font-name frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1007 (error
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1008 (display-error c nil)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1009 (sit-for 1)))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1010 (if keep-size
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1011 (set-frame-pixel-size frame fwd fht)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1012 (run-hooks 'after-setting-font-hook))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1013
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1014 (defun set-frame-property (frame prop val)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1015 "Set property PROP of FRAME to VAL. See `set-frame-properties'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1016 (set-frame-properties frame (list prop val)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1017
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1018 ;; XEmacs change: this function differs significantly from Emacs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1019 (defun set-background-color (color-name)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1020 "Set the background color of the selected frame to COLOR-NAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1021 When called interactively, prompt for the name of the color to use.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1022 To get the frame's current background color, use
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1023 `(face-background-name 'default)'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1024 (interactive (list (read-color "Color: ")))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1025 ;; (set-face-foreground 'text-cursor color-name (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1026 (set-face-background 'default color-name (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1027
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1028 ;; XEmacs change: this function differs significantly from Emacs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1029 (defun set-foreground-color (color-name)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1030 "Set the foreground color of the selected frame to COLOR-NAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1031 When called interactively, prompt for the name of the color to use.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1032 To get the frame's current foreground color, use
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1033 `(face-foreground-name 'default)'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1034 (interactive (list (read-color "Color: ")))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1035 (set-face-foreground 'default color-name (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1036
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1037 ;; XEmacs change: this function differs significantly from Emacs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1038 (defun set-cursor-color (color-name)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1039 "Set the text cursor color of the selected frame to COLOR-NAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1040 When called interactively, prompt for the name of the color to use.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1041 To get the frame's current cursor color, use
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1042 '(face-background-name 'text-cursor)'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1043 (interactive (list (read-color "Color: ")))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1044 (set-face-background 'text-cursor color-name (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1045
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1046 ;; XEmacs change: this function differs significantly from Emacs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1047 (defun set-mouse-color (color-name)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1048 "Set the color of the mouse pointer of the selected frame to COLOR-NAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1049 When called interactively, prompt for the name of the color to use.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1050 To get the frame's current mouse color, use
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1051 `(face-foreground-name 'pointer)'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1052 (interactive (list (read-color "Color: ")))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1053 (set-face-foreground 'pointer color-name (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1054
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1055 ;; XEmacs change: this function differs significantly from Emacs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1056 (defun set-border-color (color-name)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1057 "Set the color of the border of the selected frame to COLOR-NAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1058 When called interactively, prompt for the name of the color to use.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1059 To get the frame's current border color, use
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1060 `(face-foreground-name 'border-glyph)'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1061 (interactive (list (read-color "Color: ")))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1062 (set-face-foreground 'border-glyph color-name (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1063
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1064 ;;; BEGIN XEmacs addition
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1065 ;;; This is the traditional XEmacs auto-raise and auto-lower, which applies
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1066 ;;; to all frames.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1067
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1068 (defcustom auto-raise-frame nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1069 "*If true, frames will be raised to the top when selected.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1070 Under X, most ICCCM-compliant window managers will have an option to do this
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1071 for you, but this variable is provided in case you're using a broken WM."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1072 :type 'boolean
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1073 :group 'frames)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1074
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1075 (defcustom auto-lower-frame nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1076 "*If true, frames will be lowered to the bottom when no longer selected.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1077 Under X, most ICCCM-compliant window managers will have an option to do this
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1078 for you, but this variable is provided in case you're using a broken WM."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1079 :type 'boolean
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1080 :group 'frames)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1081
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1082 (defun default-select-frame-hook ()
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1083 "Implement the `auto-raise-frame' variable.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1084 For use as the value of `select-frame-hook'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1085 (if auto-raise-frame (raise-frame (selected-frame))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1087 (defun default-deselect-frame-hook ()
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1088 "Implement the `auto-lower-frame' variable.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1089 For use as the value of `deselect-frame-hook'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1090 (if auto-lower-frame (lower-frame (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1091 (highlight-extent nil nil))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1092
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1093 (or select-frame-hook
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1094 (add-hook 'select-frame-hook 'default-select-frame-hook))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1095
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1096 (or deselect-frame-hook
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1097 (add-hook 'deselect-frame-hook 'default-deselect-frame-hook))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1098
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1099 ;;; END XEmacs addition
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1100 ;;; Following is the Emacs auto-raise/auto-lower interface, which lets the
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1101 ;;; user select individual frames to auto-raise and auto-lower
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1102
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1103 ;; XEmacs addition: the next two variables do not appear in Emacs
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1104 (defvar auto-raise-specifier (make-boolean-specifier auto-raise-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1105 "Specifier that determines which frames should auto-raise.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1106 A value of `t' means that a frame auto-raises; `nil' means it does not.")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1107
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1108 (defvar auto-lower-specifier (make-boolean-specifier auto-lower-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1109 "Specifier that determines which frames should auto-lower.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1110 A value of `t' means that a frame auto-lowers; `nil' means it does not.")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1111
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1112 ;; XEmacs change: use specifiers instead of frame-parameters
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1113 (defun auto-raise-mode (arg)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1114 "Toggle whether or not the selected frame should auto-raise.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1115 With arg, turn auto-raise mode on if and only if arg is positive.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1116 Note that this controls Emacs's own auto-raise feature.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1117 Some window managers allow you to enable auto-raise for certain windows.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1118 You can use that for Emacs windows if you wish, but if you do,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1119 that is beyond the control of Emacs and this command has no effect on it."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1120 (interactive "P")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1121 (if (null arg)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1122 (setq arg
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1123 (if (specifier-instance auto-raise-specifier (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1124 -1 1)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1125 (if (> arg 0)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1126 (progn
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1127 (raise-frame (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1128 (add-hook 'select-frame-hook 'default-select-frame-hook))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1129 (set-specifier auto-raise-specifier (> arg 0) (selected-frame))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1130
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1131 ;; XEmacs change: use specifiers instead of frame-parameters
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1132 (defun auto-lower-mode (arg)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1133 "Toggle whether or not the selected frame should auto-lower.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1134 With arg, turn auto-lower mode on if and only if arg is positive.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1135 Note that this controls Emacs's own auto-lower feature.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1136 Some window managers allow you to enable auto-lower for certain windows.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1137 You can use that for Emacs windows if you wish, but if you do,
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1138 that is beyond the control of Emacs and this command has no effect on it."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1139 (interactive "P")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1140 (if (null arg)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1141 (setq arg
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1142 (if (specifier-instance auto-lower-specifier (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1143 -1 1)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1144 (if (> arg 0)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1145 (progn
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1146 (lower-frame (selected-frame))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1147 (add-hook 'deselect-frame-hook 'default-deselect-frame-hook))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1148 (set-specifier auto-lower-specifier (> arg 0) (selected-frame))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1150 ;; XEmacs omission: XEmacs does not support changing the frame name
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1151 ;(defun set-frame-name (name)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1152 ; "Set the name of the selected frame to NAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1153 ;When called interactively, prompt for the name of the frame.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1154 ;The frame name is displayed on the modeline if the terminal displays only
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1155 ;one frame, otherwise the name is displayed on the frame's caption bar."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1156 ; (interactive "sFrame name: ")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1157 ; (modify-frame-parameters (selected-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1158 ; (list (cons 'name name))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1159
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1160 ;; XEmacs omission: XEmacs attaches scrollbars to windows, not frames.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1161 ;; See window-hscroll and ... what? window-start?
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1162 ;(defun frame-current-scroll-bars (&optional frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1163 ; "Return the current scroll-bar settings in frame FRAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1164 ;Value is a cons (VERTICAL . HORISONTAL) where VERTICAL specifies the
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1165 ;current location of the vertical scroll-bars (left, right, or nil),
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1166 ;and HORISONTAL specifies the current location of the horisontal scroll
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1167 ;bars (top, bottom, or nil)."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1168 ; (let ((vert (frame-parameter frame 'vertical-scroll-bars))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1169 ; (hor nil))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1170 ; (unless (memq vert '(left right nil))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1171 ; (setq vert default-frame-scroll-bars))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1172 ; (cons vert hor)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1173
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1174 ;;;; Frame/display capabilities.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1175 (defun display-mouse-p (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1176 "Return non-nil if DISPLAY has a mouse available.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1177 DISPLAY can be a frame, a device, a console, or nil (meaning the
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1178 selected frame)."
4546
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1179 (let (type)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1180 (setq display (display-device display)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1181 type (device-type display))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1182 (cond
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1183 ((eq 'mswindows type)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1184 (> (declare-boundp mswindows-num-mouse-buttons) 0))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1185 ((device-on-window-system-p display)
4759
aa5ed11f473b Remove support for obsolete systems. See xemacs-patches message with ID
Jerry James <james@xemacs.org>
parents: 4689
diff changeset
1186 ;; We assume X, GTK and the rest always have a pointing device.
4546
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1187 t)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1188 ((eq 'tty type)
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1942
diff changeset
1189 (and-fboundp 'gpm-is-supported-p
4546
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1190 (gpm-is-supported-p display)))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1191 (t nil))))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1192
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1193 (defun display-popup-menus-p (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1194 "Return non-nil if popup menus are supported on DISPLAY.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1195 DISPLAY can be a frame, a device, a console, or nil (meaning the selected
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1196 frame). Support for popup menus requires that the mouse be available."
4546
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1197 (setq display (display-device display))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1198 (and
4546
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1199 (featurep 'menubar)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1200 (device-on-window-system-p display)
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1201 (display-mouse-p display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1202
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1203 (defun display-graphic-p (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1204 "Return non-nil if DISPLAY is a graphic display.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1205 Graphical displays are those which are capable of displaying several
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1206 frames and several different fonts at once. This is true for displays
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1207 that use a window system such as X, and false for text-only terminals.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1208 DISPLAY can be a frame, a device, a console, or nil (meaning the selected
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1209 frame)."
4586
732e3243f2e4 Correct a bug in #'display-graphic-p.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4546
diff changeset
1210 (device-on-window-system-p (display-device display)))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1211
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1212 (defun display-images-p (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1213 "Return non-nil if DISPLAY can display images.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1214 DISPLAY can be a frame, a device, a console, or nil (meaning the selected
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1215 frame)."
4546
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1216 (and (memq (image-instance-type (specifier-instance
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1217 (glyph-image xemacs-logo)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1218 display))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1219 '(color-pixmap mono-pixmap))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1220 t))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1221
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1222 (defalias 'display-multi-frame-p 'display-graphic-p)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1223 (defalias 'display-multi-font-p 'display-graphic-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1225 (defun display-selections-p (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1226 "Return non-nil if DISPLAY supports selections.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1227 A selection is a way to transfer text or other data between programs
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1228 via special system buffers called `selection' or `cut buffer' or
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1229 `clipboard'.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1230 DISPLAY can be a frame, a device, a console, or nil (meaning the selected
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1231 frame)."
4546
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1232 (or
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1233 (device-on-window-system-p display)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1234 ;; GPM supports #'get-selection-foreign, but not #'own-selection.
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1235 (and-fboundp 'gpm-is-supported-p
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1236 (gpm-is-supported-p display))))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1237
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1238 (defun display-screens (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1239 "Return the number of screens associated with DISPLAY."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1240 (device-num-screens (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1241
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1242 (defun display-pixel-height (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1243 "Return the height of DISPLAY's screen in pixels.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1244 For character terminals, each character counts as a single pixel."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1245 (device-pixel-height (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1246
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1247 (defun display-pixel-width (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1248 "Return the width of DISPLAY's screen in pixels.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1249 For character terminals, each character counts as a single pixel."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1250 (device-pixel-width (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1251
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1252 (defun display-mm-height (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1253 "Return the height of DISPLAY's screen in millimeters.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1254 If the information is unavailable, value is nil."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1255 (device-mm-height (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1256
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1257 (defun display-mm-width (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1258 "Return the width of DISPLAY's screen in millimeters.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1259 If the information is unavailable, value is nil."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1260 (device-mm-width (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1261
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1262 (defun display-backing-store (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1263 "Return the backing store capability of DISPLAY's screen.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1264 The value may be `always', `when-mapped', `not-useful', or nil if
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1265 the question is inapplicable to a certain kind of display."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1266 (device-backing-store (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1267
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1268 (defun display-save-under (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1269 "Return non-nil if DISPLAY's screen supports the SaveUnder feature."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1270 (device-save-under (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1271
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1272 (defun display-planes (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1273 "Return the number of planes supported by DISPLAY."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1274 (device-bitplanes (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1275
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1276 (defun display-color-cells (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1277 "Return the number of color cells supported by DISPLAY."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1278 (device-color-cells (display-device display)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1279
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1280 (defun display-visual-class (&optional display)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1281 "Returns the visual class of DISPLAY.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1282 The value is one of the symbols `static-gray', `gray-scale',
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1283 `static-color', `pseudo-color', `true-color', or `direct-color'."
4546
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1284 (let (type planes)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1285 (setq display (display-device display)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1286 type (device-type display))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1287 (cond
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1288 ((eq 'x type)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1289 (declare-fboundp (x-display-visual-class display)))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1290 ((eq 'gtk type)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1291 (declare-fboundp (gtk-display-visual-class display)))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1292 ((device-on-window-system-p display)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1293 (setq planes (display-planes display))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1294 (cond ((eq planes 1) 'static-gray)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1295 ((eq planes 4) 'static-color)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1296 ((> planes 8) 'true-color)
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1297 (t 'pseudo-color)))
44129f301385 Make functions in frame.el more general.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4506
diff changeset
1298 (t 'static-gray))))
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1299
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1300
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1301 ;; XEmacs change: omit the Emacs 18 compatibility functions:
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1302 ;; screen-height, screen-width, set-screen-height, and set-screen-width.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1303
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1304 (defun delete-other-frames (&optional frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1305 "Delete all frames except FRAME.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1306 If FRAME uses another frame's minibuffer, the minibuffer frame is
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1307 left untouched. FRAME nil or omitted means use the selected frame."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1308 (interactive)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1309 (unless frame
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1310 (setq frame (selected-frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1311 (let* ((mini-frame (window-frame (minibuffer-window frame)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1312 (frames (delq mini-frame (delq frame (frame-list)))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1313 (mapc 'delete-frame frames)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1314
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1315 ;; XEmacs change: we still use delete-frame-hook
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1316 ;; miscellaneous obsolescence declarations
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1317 ;(defvaralias 'delete-frame-hook 'delete-frame-functions)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1318 ;(make-obsolete-variable 'delete-frame-hook 'delete-frame-functions "21.4")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1319
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1320
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1321 ;; Highlighting trailing whitespace.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1322 ;; XEmacs omission: this functionality is provided by whitespace-mode in the
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1323 ;; text-modes package.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1324
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1325 ;(make-variable-buffer-local 'show-trailing-whitespace)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1326
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1327 ;(defcustom show-trailing-whitespace nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1328 ; "*Non-nil means highlight trailing whitespace in face `trailing-whitespace'.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1329 ;
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1330 ;Setting this variable makes it local to the current buffer."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1331 ; :tag "Highlight trailing whitespace."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1332 ; :type 'boolean
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1333 ; :group 'font-lock)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1334
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1335
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1336 ;; Scrolling
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1337 ;; XEmacs omission: This functionality is always enabled on XEmacs.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1338
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1339 ;(defgroup scrolling nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1340 ; "Scrolling windows."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1341 ; :version "21.1"
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1342 ; :group 'frames)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1343
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1344 ;(defcustom auto-hscroll-mode t
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1345 ; "*Allow or disallow automatic scrolling windows horizontally.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1346 ;If non-nil, windows are automatically scrolled horizontally to make
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1347 ;point visible."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1348 ; :version "21.1"
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1349 ; :type 'boolean
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1350 ; :group 'scrolling)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1351 ;(defvaralias 'automatic-hscrolling 'auto-hscroll-mode)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1352
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1353
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1354 ;; Blinking cursor
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1355 ;; XEmacs omission: this functionality is provided by blink-cursor in the
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1356 ;; edit-utils package.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1357
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1358 ; (defgroup cursor nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1359 ; "Displaying text cursors."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1360 ; :version "21.1"
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1361 ; :group 'frames)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1363 ; (defcustom blink-cursor-delay 0.5
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1364 ; "*Seconds of idle time after which cursor starts to blink."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1365 ; :tag "Delay in seconds."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1366 ; :type 'number
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1367 ; :group 'cursor)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1368
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1369 ; (defcustom blink-cursor-interval 0.5
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1370 ; "*Length of cursor blink interval in seconds."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1371 ; :tag "Blink interval in seconds."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1372 ; :type 'number
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1373 ; :group 'cursor)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1374
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1375 ; (defvar blink-cursor-idle-timer nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1376 ; "Timer started after `blink-cursor-delay' seconds of Emacs idle time.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1377 ; The function `blink-cursor-start' is called when the timer fires.")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1378
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1379 ; (defvar blink-cursor-timer nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1380 ; "Timer started from `blink-cursor-start'.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1381 ; This timer calls `blink-cursor' every `blink-cursor-interval' seconds.")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1382
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1383 ; (defvar blink-cursor-mode nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1384 ; "Non-nil means blinking cursor is active.")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1385
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1386 ; (defun blink-cursor-mode (arg)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1387 ; "Toggle blinking cursor mode.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1388 ; With a numeric argument, turn blinking cursor mode on iff ARG is positive.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1389 ; When blinking cursor mode is enabled, the cursor of the selected
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1390 ; window blinks.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1391
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1392 ; Note that this command is effective only when Emacs
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1393 ; displays through a window system, because then Emacs does its own
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1394 ; cursor display. On a text-only terminal, this is not implemented."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1395 ; (interactive "P")
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1396 ; (let ((on-p (if (null arg)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1397 ; (not blink-cursor-mode)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1398 ; (> (prefix-numeric-value arg) 0))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1399 ; (if blink-cursor-idle-timer
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1400 ; (cancel-timer blink-cursor-idle-timer))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1401 ; (if blink-cursor-timer
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1402 ; (cancel-timer blink-cursor-timer))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1403 ; (setq blink-cursor-idle-timer nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1404 ; blink-cursor-timer nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1405 ; blink-cursor-mode nil)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1406 ; (if on-p
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1407 ; (progn
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1408 ; ;; Hide the cursor.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1409 ; ;(internal-show-cursor nil nil)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1410 ; (setq blink-cursor-idle-timer
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1411 ; (run-with-idle-timer blink-cursor-delay
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1412 ; blink-cursor-delay
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1413 ; 'blink-cursor-start))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1414 ; (setq blink-cursor-mode t))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1415 ; (internal-show-cursor nil t))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1416
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1417 ; ;; Note that this is really initialized from startup.el before
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1418 ; ;; the init-file is read.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1419
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1420 ; (defcustom blink-cursor nil
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1421 ; "*Non-nil means blinking cursor mode is active."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1422 ; :group 'cursor
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1423 ; :tag "Blinking cursor"
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1424 ; :type 'boolean
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1425 ; :set #'(lambda (symbol value)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1426 ; (set-default symbol value)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1427 ; (blink-cursor-mode (or value 0))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1428
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1429 ; (defun blink-cursor-start ()
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1430 ; "Timer function called from the timer `blink-cursor-idle-timer'.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1431 ; This starts the timer `blink-cursor-timer', which makes the cursor blink
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1432 ; if appropriate. It also arranges to cancel that timer when the next
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1433 ; command starts, by installing a pre-command hook."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1434 ; (when (null blink-cursor-timer)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1435 ; (add-hook 'pre-command-hook 'blink-cursor-end)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1436 ; (setq blink-cursor-timer
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1437 ; (run-with-timer blink-cursor-interval blink-cursor-interval
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1438 ; 'blink-cursor-timer-function))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1439
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1440 ; (defun blink-cursor-timer-function ()
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1441 ; "Timer function of timer `blink-cursor-timer'."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1442 ; (internal-show-cursor nil (not (internal-show-cursor-p))))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1443
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1444 ; (defun blink-cursor-end ()
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1445 ; "Stop cursor blinking.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1446 ; This is installed as a pre-command hook by `blink-cursor-start'.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1447 ; When run, it cancels the timer `blink-cursor-timer' and removes
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1448 ; itself as a pre-command hook."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1449 ; (remove-hook 'pre-command-hook 'blink-cursor-end)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1450 ; (internal-show-cursor nil t)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1451 ; (cancel-timer blink-cursor-timer)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1452 ; (setq blink-cursor-timer nil))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1453
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454
1942
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1455 ;; Hourglass pointer
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1456 ;; XEmacs omission: this functionality is provided elsewhere.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1457
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1458 ; (defcustom display-hourglass t
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1459 ; "*Non-nil means show an hourglass pointer when running under a window system."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1460 ; :tag "Hourglass pointer"
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1461 ; :type 'boolean
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1462 ; :group 'cursor)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1463
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1464 ; (defcustom hourglass-delay 1
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1465 ; "*Seconds to wait before displaying an hourglass pointer."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1466 ; :tag "Hourglass delay"
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1467 ; :type 'number
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1468 ; :group 'cursor)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1469
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1470 ;
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1471 ; (defcustom cursor-in-non-selected-windows t
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1472 ; "*Non-nil means show a hollow box cursor in non-selected-windows.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1473 ; If nil, don't show a cursor except in the selected window.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1474 ; Use Custom to set this variable to get the display updated."
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1475 ; :tag "Cursor in non-selected windows"
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1476 ; :type 'boolean
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1477 ; :group 'cursor
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1478 ; :set #'(lambda (symbol value)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1479 ; (set-default symbol value)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1480 ; (force-mode-line-update t)))
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1481
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1482
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1483 ;;;; Key bindings
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1484 ;; XEmacs change: these keybindings are in keydef.el.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1485
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1486 ;(define-key ctl-x-5-map "2" 'make-frame-command)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1487 ;(define-key ctl-x-5-map "1" 'delete-other-frames)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1488 ;(define-key ctl-x-5-map "0" 'delete-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1489 ;(define-key ctl-x-5-map "o" 'other-frame)
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1490
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1491
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1492 ;;; XEmacs addition: nothing below this point appears in the Emacs version.
da8cdcec6dff [xemacs-hg @ 2004-03-08 15:22:44 by james]
james
parents: 903
diff changeset
1493
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 ;;; Iconifying emacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 ;;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 ;;; The function iconify-emacs replaces every non-iconified emacs window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 ;;; with a *single* icon. Iconified emacs windows are left alone. When
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 ;;; emacs is in this globally-iconified state, de-iconifying any emacs icon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1499 ;;; will uniconify all frames that were visible, and iconify all frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1500 ;;; that were not. This is done by temporarily changing the value of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501 ;;; `map-frame-hook' to `deiconify-emacs' (which should never be called
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1502 ;;; except from the map-frame-hook while emacs is iconified).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 ;;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504 ;;; The title of the icon representing all emacs frames is controlled by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 ;;; the variable `icon-name'. This is done by temporarily changing the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 ;;; value of `frame-icon-title-format'. Unfortunately, this changes the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507 ;;; titles of all emacs icons, not just the "big" icon.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508 ;;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1509 ;;; It would be nice if existing icons were removed and restored by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 ;;; iconifying the emacs process, but I couldn't make that work yet.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 (defvar icon-name nil) ; set this at run time, not load time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 (defvar iconification-data nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1515
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1516 (defun iconify-emacs ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 "Replace every non-iconified FRAME with a *single* icon.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 Iconified frames are left alone. When XEmacs is in this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519 globally-iconified state, de-iconifying any emacs icon will uniconify
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520 all frames that were visible, and iconify all frames that were not."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1521 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1522 (if iconification-data (error "already iconified?"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1523 (let* ((frames (frame-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1524 (rest frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1525 (me (selected-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1526 frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527 (while rest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 (setq frame (car rest))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529 (setcar rest (cons frame (frame-visible-p frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530 ; (if (memq (cdr (car rest)) '(icon nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 ; (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 ; (make-frame-visible frame) ; deiconify, and process the X event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533 ; (sleep-for 500 t) ; process X events; I really want to XSync() here
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534 ; ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 (or (eq frame me) (make-frame-invisible frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 (setq rest (cdr rest)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 (or (boundp 'map-frame-hook) (setq map-frame-hook nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 (or icon-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 (setq icon-name (concat invocation-name " @ " (system-name))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540 (setq iconification-data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541 (list frame-icon-title-format map-frame-hook frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 frame-icon-title-format icon-name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 map-frame-hook 'deiconify-emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 (iconify-frame me)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 (defun deiconify-emacs (&optional ignore)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548 (or iconification-data (error "not iconified?"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 (setq frame-icon-title-format (car iconification-data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 map-frame-hook (car (cdr iconification-data))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 iconification-data (car (cdr (cdr iconification-data))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 (while iconification-data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553 (let ((visibility (cdr (car iconification-data))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 (cond (visibility ;; JV (Note non-nil means visible in XEmacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 (make-frame-visible (car (car iconification-data))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 ; (t ;; (eq visibility 'icon) ;; JV Not in XEmacs!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 ; (make-frame-visible (car (car iconification-data)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 ; (sleep-for 500 t) ; process X events; I really want to XSync() here
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 ; (iconify-frame (car (car iconification-data))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560 ;; (t nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 (setq iconification-data (cdr iconification-data))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 (defun suspend-or-iconify-emacs ()
3547
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1565 "Call iconify-emacs if using a window system, otherwise suspend.
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1566
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1567 `suspend' here can mean different things; if the current TTY console was
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1568 created by gnuclient, that console is suspended, and the related devices and
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1569 frames are removed from the display. Otherwise the Emacs process as a whole
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1570 is suspended--that is, the traditional Unix suspend takes place. "
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 (cond ((device-on-window-system-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 (iconify-emacs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1574 ((and (eq (device-type) 'tty)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1575 (declare-fboundp (console-tty-controlling-process
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1576 (selected-console))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577 (suspend-console (selected-console)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 (suspend-emacs))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 ;; This is quite a mouthful, but it should be descriptive, as it's
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 ;; bound to C-z. FSF takes the easy way out by binding C-z to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 ;; different things depending on window-system. We can't do the same,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 ;; because we allow simultaneous X and TTY consoles.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585 (defun suspend-emacs-or-iconify-frame ()
3547
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1586 "Iconify the selected frame if using a window system, otherwise suspend.
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1587
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1588 `suspend' here can mean different things; if the current TTY console was
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1589 created by gnuclient, the console is suspended, and the related devices and
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1590 frames are removed from the display. Otherwise the Emacs process as a whole
dd935ef485d2 [xemacs-hg @ 2006-08-06 22:14:08 by aidan]
aidan
parents: 3061
diff changeset
1591 is suspended--that is, the traditional Unix suspend takes place. "
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593 (cond ((device-on-window-system-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 (iconify-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 ((and (eq (frame-type) 'tty)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1596 (declare-fboundp (console-tty-controlling-process
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 462
diff changeset
1597 (selected-console))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598 (suspend-console (selected-console)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1600 (suspend-emacs))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1601
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 ;;; Application-specific frame-management
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 (defcustom get-frame-for-buffer-default-frame-name nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1606 "*The default frame to select; see doc of `get-frame-for-buffer'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 :type 'string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608 :group 'frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1610 (defcustom get-frame-for-buffer-default-instance-limit nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 "*The default instance limit for creating new frames;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 see doc of `get-frame-for-buffer'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613 :type 'integer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 :group 'frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616 (defun get-frame-name-for-buffer (buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 (let ((mode (and (get-buffer buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 (save-excursion (set-buffer buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 major-mode))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1620 (or (get mode 'frame-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621 get-frame-for-buffer-default-frame-name)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1623 (defun get-frame-for-buffer-make-new-frame (buffer &optional frame-name plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 (let* ((fr (make-frame plist))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1625 (w (frame-root-window fr)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1626 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627 ;; Make the one buffer being displayed in this newly created
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 ;; frame be the buffer of interest, instead of something
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 ;; random, so that it won't be shown in two-window mode.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630 ;; Avoid calling switch-to-buffer here, since that's something
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1631 ;; people might want to call this routine from.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1632 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1633 ;; (If the root window doesn't have a buffer, then that means
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1634 ;; there is more than one window on the frame, which can only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1635 ;; happen if the user has done something funny on the frame-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636 ;; creation-hook. If that's the case, leave it alone.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1637 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 (if (window-buffer w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 (set-window-buffer w buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 fr))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 (defcustom get-frame-for-buffer-default-to-current nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 "*When non-nil, `get-frame-for-buffer' will default to the selected frame."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 :group 'frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1647 (defun get-frame-for-buffer-noselect (buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648 &optional not-this-window-p on-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1649 "Return a frame in which to display BUFFER.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 This is a subroutine of `get-frame-for-buffer' (which see)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1651 (let (name limit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1652 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653 ((or on-frame (eq (selected-window) (minibuffer-window)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654 ;; don't switch frames if a frame was specified, or to list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655 ;; completions from the minibuffer, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1656 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1657
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 ((setq name (get-frame-name-for-buffer buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1659 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1660 ;; This buffer's mode expressed a preference for a frame of a particular
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 ;; name. That always takes priority.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663 (let ((limit (get name 'instance-limit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1664 (defaults (get name 'frame-defaults))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1665 (matching-frames '())
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1666 frames frame already-visible)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1667 ;; Sort the list so that iconic frames will be found last. They
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1668 ;; will be used too, but mapped frames take precedence. And
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 ;; fully visible frames come before occluded frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 ;; Hidden frames come after really visible ones
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 (setq frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 (sort (frame-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673 #'(lambda (s1 s2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 (cond ((frame-totally-visible-p s2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1675 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1676 ((not (frame-visible-p s2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1677 (frame-visible-p s1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1678 ((eq (frame-visible-p s2) 'hidden)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679 (eq (frame-visible-p s1) t ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 ((not (frame-totally-visible-p s2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1681 (and (frame-visible-p s1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1682 (frame-totally-visible-p s1)))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 ;; but the selected frame should come first, even if it's occluded,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684 ;; to minimize thrashing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685 (setq frames (cons (selected-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1686 (delq (selected-frame) frames)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1687
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1688 (setq name (symbol-name name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1689 (while frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1690 (setq frame (car frames))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1691 (if (equal name (frame-name frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1692 (if (get-buffer-window buffer frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1693 (setq already-visible frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1694 frames nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1695 (setq matching-frames (cons frame matching-frames))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1696 (setq frames (cdr frames)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1697 (cond (already-visible
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1698 already-visible)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1699 ((or (null matching-frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1700 (eq limit 0) ; means create with reckless abandon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1701 (and limit (< (length matching-frames) limit)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1702 (get-frame-for-buffer-make-new-frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1703 buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705 (alist-to-plist (acons 'name name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 (plist-to-alist defaults)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708 ;; do not switch any of the window/buffer associations in an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709 ;; existing frame; this function only picks a frame; the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710 ;; determination of which windows on it get reused is up to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 ;; display-buffer itself.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1712 ;; (or (window-dedicated-p (selected-window))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713 ;; (switch-to-buffer buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 (car matching-frames)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716 ((setq limit get-frame-for-buffer-default-instance-limit)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 ;; This buffer's mode did not express a preference for a frame of a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1719 ;; particular name, but the user wants a new frame rather than
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720 ;; reusing the existing one.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721 (let* ((defname
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 (or (plist-get default-frame-plist 'name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1723 default-frame-name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1724 (frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 (sort (filtered-frame-list #'(lambda (x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1726 (or (frame-visible-p x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 (frame-iconified-p x))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 #'(lambda (s1 s2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 (cond ((and (frame-visible-p s1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730 (not (frame-visible-p s2))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1731 ((and (eq (frame-visible-p s1) t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 (eq (frame-visible-p s2) 'hidden)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 ((and (frame-visible-p s2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734 (not (frame-visible-p s1)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1735 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1736 ((and (equal (frame-name s1) defname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1737 (not (equal (frame-name s2) defname))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1738 ((and (equal (frame-name s2) defname)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 (not (equal (frame-name s1) defname)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741 ((frame-totally-visible-p s2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1743 (t))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1744 ;; put the selected frame last. The user wants a new frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1745 ;; so don't reuse the existing one unless forced to.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746 (setq frames (append (delq (selected-frame) frames) (list frames)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1747 (if (or (eq limit 0) ; means create with reckless abandon
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748 (< (length frames) limit))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749 (get-frame-for-buffer-make-new-frame buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1750 (car frames))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1751
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752 (not-this-window-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753 (let ((w-list (windows-of-buffer buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1754 f w
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 (first-choice nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1756 (second-choice (if get-frame-for-buffer-default-to-current
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1757 (selected-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1758 nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1759 (last-resort nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1760 (while (and w-list (null first-choice))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1761 (setq w (car w-list)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 f (window-frame w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 (cond ((eq w (selected-window)) nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764 ((not (frame-visible-p f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1765 (if (null last-resort)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1766 (setq last-resort f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1767 ((eq f (selected-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1768 (setq first-choice f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1769 ((null second-choice)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1770 (setq second-choice f)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771 (setq w-list (cdr w-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 (or first-choice second-choice last-resort)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1774 (get-frame-for-buffer-default-to-current (selected-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1776 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778 ;; This buffer's mode did not express a preference for a frame of a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1779 ;; particular name. So try to find a frame already displaying this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1780 ;; buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1782 (let ((w (or (get-buffer-window buffer nil) ; check current first
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1783 (get-buffer-window buffer 'visible) ; then visible
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784 (get-buffer-window buffer 0)))) ; then iconic
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1785 (cond ((null w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1786 ;; It's not in any window - return nil, meaning no frame has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787 ;; preference.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1788 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1789 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790 ;; Otherwise, return the frame of the buffer's window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 (window-frame w))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1793
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794 ;; The pre-display-buffer-function is called for effect, so this needs to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 ;; actually select the frame it wants. Fdisplay_buffer() takes notice of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796 ;; changes to the selected frame.
903
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 771
diff changeset
1797 (defun get-frame-for-buffer (buffer &optional not-this-window-p on-frame
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 771
diff changeset
1798 shrink-to-fit)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1799 "Select and return a frame in which to display BUFFER.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1800 Normally, the buffer will simply be displayed in the selected frame.
3061
fd1acd2f457a [xemacs-hg @ 2005-11-13 07:39:26 by ben]
ben
parents: 2527
diff changeset
1801 But if the symbol naming the major-mode of the buffer has a `frame-name'
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1802 property (which should be a symbol), then the buffer will be displayed in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1803 a frame of that name. If there is no frame of that name, then one is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1804 created.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1805
3061
fd1acd2f457a [xemacs-hg @ 2005-11-13 07:39:26 by ben]
ben
parents: 2527
diff changeset
1806 If the major-mode doesn't have a `frame-name' property, then the frame
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 named by `get-frame-for-buffer-default-frame-name' will be used. If
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 that is nil (the default) then the currently selected frame will used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809
3061
fd1acd2f457a [xemacs-hg @ 2005-11-13 07:39:26 by ben]
ben
parents: 2527
diff changeset
1810 If the frame-name symbol has an `instance-limit' property (an integer)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1811 then each time a buffer of the mode in question is displayed, a new frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1812 with that name will be created, until there are `instance-limit' of them.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813 If instance-limit is 0, then a new frame will be created each time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1814
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1815 If a buffer is already displayed in a frame, then `instance-limit' is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1816 ignored, and that frame is used.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1817
3061
fd1acd2f457a [xemacs-hg @ 2005-11-13 07:39:26 by ben]
ben
parents: 2527
diff changeset
1818 If the frame-name symbol has a `frame-defaults' property, then that is
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1819 prepended to the `default-frame-plist' when creating a frame for the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1820 first time.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822 This function may be used as the value of `pre-display-buffer-function',
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1823 to cause the `display-buffer' function and its callers to exhibit the
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1824 above behavior."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1825 (let ((frame (get-frame-for-buffer-noselect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826 buffer not-this-window-p on-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1827 (if (not (eq frame (selected-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1829 (select-frame frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1830 (or (frame-visible-p frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1831 ;; If the frame was already visible, just focus on it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1832 ;; If it wasn't visible (it was just created, or it used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1833 ;; to be iconified) then uniconify, raise, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1834 (make-frame-visible frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1835 frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1836
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1837 (defun frames-of-buffer (&optional buffer visible-only)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838 "Return list of frames that BUFFER is currently being displayed on.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839 If the buffer is being displayed on the currently selected frame, that frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 is first in the list. VISIBLE-ONLY will only list non-iconified frames."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841 (let ((list (windows-of-buffer buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 (cur-frame (selected-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1843 next-frame frames save-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1844
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 (while list
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 (if (memq (setq next-frame (window-frame (car list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847 frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849 (if (eq cur-frame next-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1850 (setq save-frame next-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1851 (and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 (or (not visible-only)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853 (frame-visible-p next-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 (setq frames (append frames (list next-frame))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 (setq list (cdr list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857 (if save-frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858 (append (list save-frame) frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 frames)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1861 (defcustom temp-buffer-shrink-to-fit nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1862 "*When non-nil resize temporary output buffers to minimize blank lines."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1863 :type 'boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 :group 'frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 (defcustom temp-buffer-max-height .5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 "*Proportion of frame to use for temp windows."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 :type 'number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 :group 'frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870
4506
bd28481bb0e1 Port #'window-buffer-height, #'fit-window-to-buffer, & window, buf, functions.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4044
diff changeset
1871 ;; See also #'temp-buffer-resize-mode in help.el.
bd28481bb0e1 Port #'window-buffer-height, #'fit-window-to-buffer, & window, buf, functions.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4044
diff changeset
1872
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 (defun show-temp-buffer-in-current-frame (buffer)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1874 "For use as the value of `temp-buffer-show-function':
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1875 always displays the buffer in the selected frame, regardless of the behavior
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876 that would otherwise be introduced by the `pre-display-buffer-function', which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877 is normally set to `get-frame-for-buffer' (which see)."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878 (let ((pre-display-buffer-function nil)) ; turn it off, whatever it is
903
4a27df428c73 [xemacs-hg @ 2002-07-06 05:48:14 by andyp]
andyp
parents: 771
diff changeset
1879 (let ((window (display-buffer buffer nil nil temp-buffer-shrink-to-fit)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1880 (if (not (eq (last-nonminibuf-frame) (window-frame window)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1881 ;; only the pre-display-buffer-function should ever do this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1882 (error "display-buffer switched frames on its own!!"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 (setq minibuffer-scroll-window window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1884 (set-window-start window 1) ; obeys narrowing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1885 (set-window-point window 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1886 nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1888 (setq temp-buffer-show-function 'show-temp-buffer-in-current-frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1889
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891 ;; from Bob Weiner <bweiner@pts.mot.com>, modified by Ben Wing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1892
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1893 ;; By adding primitives to directly access the window hierarchy,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894 ;; we can move many functions into Lisp. We do it this way
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 ;; because the implementations are simpler in Lisp, and because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896 ;; new functions like this can be added without requiring C
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897 ;; additions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1899 (defun frame-utmost-window-2 (window position left-right-p major-end-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900 minor-end-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 ;; LEFT-RIGHT-P means we're looking for the leftmost or rightmost
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 ;; window, instead of the highest or lowest. In this case, we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1903 ;; say that the "major axis" goes left-to-right instead of top-to-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 ;; bottom. The "minor axis" always goes perpendicularly.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 ;; If MAJOR-END-P is t, we're looking for a windows that abut the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 ;; end (i.e. right or bottom) of the major axis, instead of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 ;; start.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910 ;; If MINOR-END-P is t, then we want to start counting from the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 ;; end of the minor axis instead of the beginning.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 ;; Here's the general idea: Imagine we're trying to count the number
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914 ;; of windows that abut the top; call this function foo(). So, we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 ;; start with the root window. If this is a vertical combination
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916 ;; window, then foo() applied to the root window is the same as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1917 ;; foo() applied to the first child. If the root is a horizontal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1918 ;; combination window, then foo() applied to the root is the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 ;; same as the sum of foo() applied to each of the children.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 ;; Otherwise, the root window is a leaf window, and foo() is 1.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921 ;; Now it's clear that, each time foo() encounters a leaf window,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1922 ;; it's encountering a different window that abuts the top.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 ;; With a little examining, you can see that foo encounters the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924 ;; top-abutting windows in order from left to right. We can
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 ;; modify foo() to return the nth top-abutting window by simply
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1926 ;; keeping a global variable that is decremented each time
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927 ;; foo() encounters a leaf window and would return 1. If the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928 ;; global counter gets to zero, we've encountered the window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 ;; we were looking for, so we exit right away using a `throw'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 ;; Otherwise, we make sure that all normal paths return nil.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 (let (child)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 (cond ((setq child (if left-right-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934 (window-first-hchild window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 (window-first-vchild window)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936 (if major-end-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 (while (window-next-child child)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1938 (setq child (window-next-child child))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1939 (frame-utmost-window-2 child position left-right-p major-end-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1940 minor-end-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1941 ((setq child (if left-right-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1942 (window-first-vchild window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1943 (window-first-hchild window)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1944 (if minor-end-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1945 (while (window-next-child child)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1946 (setq child (window-next-child child))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1947 (while child
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1948 (frame-utmost-window-2 child position left-right-p major-end-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1949 minor-end-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1950 (setq child (if minor-end-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1951 (window-previous-child child)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1952 (window-next-child child))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1953 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1954 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1955 (setcar position (1- (car position)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1956 (if (= (car position) 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1957 (throw 'fhw-exit window)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1958 nil)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1959
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1960 (defun frame-utmost-window-1 (frame position left-right-p major-end-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1961 (let (minor-end-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1962 (or frame (setq frame (selected-frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1963 (or position (setq position 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1964 (if (>= position 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1965 (setq position (1+ position))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1966 (setq minor-end-p t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967 (setq position (- position)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 (catch 'fhw-exit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 ;; we use a cons here as a simple form of call-by-reference.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970 ;; scheme has "boxes" for the same purpose.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971 (frame-utmost-window-2 (frame-root-window frame) (list position)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 left-right-p major-end-p minor-end-p))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975 (defun frame-highest-window (&optional frame position)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 "Return the highest window on FRAME which is at POSITION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1978 POSITION is used to distinguish between multiple windows that abut
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1979 the top of the frame: 0 means the leftmost window abutting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1980 top of the frame, 1 the next-leftmost, etc. POSITION can also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 be less than zero: -1 means the rightmost window abutting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 top of the frame, -2 the next-rightmost, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983 If omitted, POSITION defaults to 0, i.e. the leftmost highest window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1984 If there is no window at the given POSITION, return nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985 (frame-utmost-window-1 frame position nil nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1986
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987 (defun frame-lowest-window (&optional frame position)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988 "Return the lowest window on FRAME which is at POSITION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1990 POSITION is used to distinguish between multiple windows that abut
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 the bottom of the frame: 0 means the leftmost window abutting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992 bottom of the frame, 1 the next-leftmost, etc. POSITION can also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993 be less than zero: -1 means the rightmost window abutting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994 bottom of the frame, -2 the next-rightmost, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 If omitted, POSITION defaults to 0, i.e. the leftmost lowest window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996 If there is no window at the given POSITION, return nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 (frame-utmost-window-1 frame position nil t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1998
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 (defun frame-leftmost-window (&optional frame position)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000 "Return the leftmost window on FRAME which is at POSITION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 POSITION is used to distinguish between multiple windows that abut
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2003 the left edge of the frame: 0 means the highest window abutting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2004 left edge of the frame, 1 the next-highest, etc. POSITION can also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2005 be less than zero: -1 means the lowest window abutting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006 left edge of the frame, -2 the next-lowest, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007 If omitted, POSITION defaults to 0, i.e. the highest leftmost window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2008 If there is no window at the given POSITION, return nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2009 (frame-utmost-window-1 frame position t nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011 (defun frame-rightmost-window (&optional frame position)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2012 "Return the rightmost window on FRAME which is at POSITION.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2013 If omitted, FRAME defaults to the currently selected frame.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 POSITION is used to distinguish between multiple windows that abut
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015 the right edge of the frame: 0 means the highest window abutting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2016 right edge of the frame, 1 the next-highest, etc. POSITION can also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2017 be less than zero: -1 means the lowest window abutting the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2018 right edge of the frame, -2 the next-lowest, etc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2019 If omitted, POSITION defaults to 0, i.e. the highest rightmost window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2020 If there is no window at the given POSITION, return nil."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2021 (frame-utmost-window-1 frame position t t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2022
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2025 ;; frame properties.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2026
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027 (put 'cursor-color 'frame-property-alias [text-cursor background])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2028 (put 'modeline 'frame-property-alias 'has-modeline-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2029
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2030
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 (provide 'frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2032
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2033 ;;; frame.el ends here