emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105396: * src/keymap.c (Fmake_compos


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105396: * src/keymap.c (Fmake_composed_keymap): Move to subr.el.
Date: Wed, 03 Aug 2011 17:40:06 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105396
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2011-08-03 17:40:06 -0400
message:
  * src/keymap.c (Fmake_composed_keymap): Move to subr.el.
  * lisp/subr.el (make-composed-keymap): Move from C.  Change calling
  convention, and improve docstring to bring attention to a subtle point.
  * lisp/minibuffer.el (completing-read-default): Adjust accordingly.
modified:
  lisp/ChangeLog
  lisp/minibuffer.el
  lisp/subr.el
  src/ChangeLog
  src/keymap.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-08-03 19:31:18 +0000
+++ b/lisp/ChangeLog    2011-08-03 21:40:06 +0000
@@ -1,3 +1,9 @@
+2011-08-03  Stefan Monnier  <address@hidden>
+
+       * subr.el (make-composed-keymap): Move from C.  Change calling
+       convention, and improve docstring to bring attention to a subtle point.
+       * minibuffer.el (completing-read-default): Adjust accordingly.
+
 2011-08-03  Michael Albinus  <address@hidden>
 
        * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell)

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2011-07-02 16:07:30 +0000
+++ b/lisp/minibuffer.el        2011-08-03 21:40:06 +0000
@@ -2754,15 +2754,12 @@
                      base-keymap
                    ;; Layer minibuffer-local-filename-completion-map
                    ;; on top of the base map.
-                   ;; Use make-composed-keymap so that set-keymap-parent
-                   ;; doesn't modify minibuffer-local-filename-completion-map.
-                   (let ((map (make-composed-keymap
-                               minibuffer-local-filename-completion-map)))
-                     ;; Set base-keymap as the parent, so that nil bindings
-                     ;; in minibuffer-local-filename-completion-map can
-                     ;; override bindings in base-keymap.
-                     (set-keymap-parent map base-keymap)
-                     map)))
+                   (make-composed-keymap
+                    minibuffer-local-filename-completion-map
+                    ;; Set base-keymap as the parent, so that nil bindings
+                    ;; in minibuffer-local-filename-completion-map can
+                    ;; override bindings in base-keymap.
+                    base-keymap)))
          (result (read-from-minibuffer prompt initial-input keymap
                                        nil hist def inherit-input-method)))
     (when (and (equal result "") def)

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2011-07-15 23:59:25 +0000
+++ b/lisp/subr.el      2011-08-03 21:40:06 +0000
@@ -526,6 +526,20 @@
          (define-key map (char-to-string loop) 'digit-argument)
          (setq loop (1+ loop))))))
 
+(defun make-composed-keymap (maps &optional parent)
+  "Construct a new keymap composed of MAPS and inheriting from PARENT.
+When looking up a key in the returned map, the key is looked in each
+keymap of MAPS in turn until a binding is found.
+If no binding is found in MAPS, the lookup continues in PARENT, if non-nil.
+As always with keymap inheritance, a nil binding in MAPS overrides
+any corresponding binding in PARENT, but it does not override corresponding
+bindings in other keymaps of MAPS.
+MAPS can be a list of keymaps or a single keymap.
+PARENT if non-nil should be a keymap."
+  `(keymap
+    ,@(if (keymapp maps) (list maps) maps)
+    ,@parent))
+
 (defun define-key-after (keymap key definition &optional after)
   "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding.
 This is like `define-key' except that the binding for KEY is placed

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-08-03 19:54:12 +0000
+++ b/src/ChangeLog     2011-08-03 21:40:06 +0000
@@ -1,3 +1,7 @@
+2011-08-03  Stefan Monnier  <address@hidden>
+
+       * keymap.c (Fmake_composed_keymap): Move to subr.el.
+
 2011-08-03  Paul Eggert  <address@hidden>
 
        * fontset.c (dump_fontset) [FONTSET_DEBUG]: Declare EXTERNALLY_VISIBLE
@@ -19,8 +23,8 @@
        non-zero.
 
        * bidi.c (bidi_fetch_char): Accept an additional argument
-       DISP_PROP_P, and pass it to compute_display_string_pos.  Only
-       handle text covered by a display string if DISP_PROP_P is returned
+       DISP_PROP_P, and pass it to compute_display_string_pos.
+       Only handle text covered by a display string if DISP_PROP_P is returned
        non-zero.  All callers of bidi_fetch_char changed.
 
 2011-08-02  Stefan Monnier  <address@hidden>
@@ -366,8 +370,8 @@
 
        * xdisp.c (move_it_in_display_line_to): Record the best matching
        position for TO_CHARPOS while scanning the line, and restore it on
-       exit if none of the characters scanned was an exact match.  Fixes
-       vertical-motion and pos-visible-in-window-p under bidi redisplay
+       exit if none of the characters scanned was an exact match.
+       Fixes vertical-motion and pos-visible-in-window-p under bidi redisplay
        when exact match is impossible due to invisible text, and the
        lines are truncated.
 
@@ -552,8 +556,8 @@
        (reseat_to_string): Initialize bidi_it->string.s and
        bidi_it->string.schars.
        (Fcurrent_bidi_paragraph_direction): Initialize itb.string.s to
-       NULL (avoids a crash in bidi_paragraph_init).  Initialize
-       itb.string.lstring.
+       NULL (avoids a crash in bidi_paragraph_init).
+       Initialize itb.string.lstring.
        (init_iterator): Call bidi_init_it only of a valid
        buffer position was specified.  Initialize paragraph_embedding to
        L2R.
@@ -569,12 +573,12 @@
        (init_iterator, reseat_1, reseat_to_string): Initialize the
        string.bufpos member to 0 (zero, for compatibility with IT_CHARPOS
        when iterating on a string not from display properties).
-       (compute_display_string_pos, compute_display_string_end): Fix
-       calculation of the object to scan.  Fixes an error when using
+       (compute_display_string_pos, compute_display_string_end):
+       Fix calculation of the object to scan.  Fixes an error when using
        arrow keys.
        (next_element_from_buffer): Don't abort when IT_CHARPOS is before
-       base_level_stop; instead, set base_level_stop to BEGV.  Fixes
-       crashes in vertical-motion.
+       base_level_stop; instead, set base_level_stop to BEGV.
+       Fixes crashes in vertical-motion.
        (next_element_from_buffer): Improve commentary for when
        the iterator is before prev_stop.
        (init_iterator): Initialize bidi_p from the default value of
@@ -587,8 +591,8 @@
        (next_element_from_string): Support bidi reordering of Lisp
        strings.
        (handle_stop_backwards): Support Lisp strings as well.
-       (display_string): Support display of R2L glyph rows.  Use
-       IT_STRING_CHARPOS when displaying from a Lisp string.
+       (display_string): Support display of R2L glyph rows.
+       Use IT_STRING_CHARPOS when displaying from a Lisp string.
        (init_iterator): Don't initialize it->bidi_p for strings
        here.
        (reseat_to_string): Initialize it->bidi_p for strings here.
@@ -670,8 +674,8 @@
        displayed in margins.  (Bug#8133) (Bug#8867)
        Return MOVE_POS_MATCH_OR_ZV only if iterator position is past
        TO_CHARPOS.
-       (pos_visible_p): Support positions in bidi-reordered lines.  Save
-       and restore bidi cache.
+       (pos_visible_p): Support positions in bidi-reordered lines.
+       Save and restore bidi cache.
 
        * bidi.c (bidi_level_of_next_char): clen should be EMACS_NT, not int.
        (bidi_paragraph_info): Delete unused struct.
@@ -691,8 +695,8 @@
        `len' according to what STRING_CHAR_AND_LENGTH expects.
        (bidi_paragraph_init, bidi_resolve_explicit_1)
        (bidi_resolve_explicit, bidi_resolve_weak)
-       (bidi_level_of_next_char, bidi_move_to_visually_next): Support
-       iteration over a string.
+       (bidi_level_of_next_char, bidi_move_to_visually_next):
+       Support iteration over a string.
        (bidi_set_sor_type, bidi_resolve_explicit_1)
        (bidi_resolve_explicit, bidi_type_of_next_char): ignore_bn_limit
        can now be zero (for strings); special values 0 and -1 were
@@ -723,20 +727,20 @@
        (bidi_cache_fetch_state, bidi_cache_search)
        (bidi_cache_find_level_change, bidi_cache_ensure_space)
        (bidi_cache_iterator_state, bidi_cache_find)
-       (bidi_find_other_level_edge, bidi_cache_start_stack): All
-       variables related to cache indices are now EMACS_INT.
+       (bidi_find_other_level_edge, bidi_cache_start_stack):
+       All variables related to cache indices are now EMACS_INT.
 
        * dispextern.h (struct bidi_string_data): New structure.
        (struct bidi_it): New member `string'.  Make flag members be 1-bit
        fields, and put them last in the struct.
-       (compute_display_string_pos, compute_display_string_end): Update
-       prototypes.
+       (compute_display_string_pos, compute_display_string_end):
+       Update prototypes.
        (bidi_push_it, bidi_pop_it): Add prototypes.
        (struct iterator_stack_entry): New members bidi_p,
        paragraph_embedding, and from_disp_prop_p.
        (struct it): Member bidi_p is now a bit field 1 bit wide.
-       (bidi_shelve_cache, bidi_unshelve_cache): Declare
-       prototypes.
+       (bidi_shelve_cache, bidi_unshelve_cache):
+       Declare prototypes.
 
        * .gdbinit (xvectype, xvector, xcompiled, xchartable, xboolvector)
        (xpr, xfont, xbacktrace): Use "header.size" when accessing vectors
@@ -1018,7 +1022,7 @@
        (char_table_set_range): Adjuted for the above change.
        (map_sub_char_table): Delete args default_val and parent.  Add arg
        top.  Give decoded values to a Lisp function.
-       (map_char_table): Adjusted for the above change.  Give decoded
+       (map_char_table): Adjust for the above change.  Give decoded
        values to a Lisp function.  Gcpro more variables.
        (uniprop_table_uncompress)
        (uniprop_decode_value_run_length): New functions.
@@ -1035,10 +1039,10 @@
        and Sput_unicode_property_internal. Defvar_lisp
        char-code-property-alist.
 
-       * composite.c (CHAR_COMPOSABLE_P): Adjusted for the change of
+       * composite.c (CHAR_COMPOSABLE_P): Adjust for the change of
        Vunicode_category_table.
 
-       * font.c (font_range): Adjusted for the change of
+       * font.c (font_range): Adjust for the change of
        Vunicode_category_table.
 
 2011-07-07  Dan Nicolaescu  <address@hidden>
@@ -1067,14 +1071,14 @@
        (store_monospaced_changed): Add comment. Call dpyinfo_valid.
        (struct xsettings): Move font inside HAVE_XFT.
        (GSETTINGS_TOOL_BAR_STYLE, GSETTINGS_FONT_NAME): New defines.
-       (GSETTINGS_MONO_FONT): Renamed from SYSTEM_MONO_FONT.
+       (GSETTINGS_MONO_FONT): Rename from SYSTEM_MONO_FONT.
        Move inside HAVE_XFT.
-       (something_changed_gsettingsCB): Renamed from something_changedCB.
+       (something_changed_gsettingsCB): Rename from something_changedCB.
        Check for changes in GSETTINGS_TOOL_BAR_STYLE and GSETTINGS_FONT_NAME
        also.
        (GCONF_TOOL_BAR_STYLE, GCONF_FONT_NAME): New defines.
-       (GCONF_MONO_FONT): Renamed from SYSTEM_MONO_FONT. Move inside HAVE_XFT.
-       (something_changed_gconfCB): Renamed from something_changedCB.
+       (GCONF_MONO_FONT): Rename from SYSTEM_MONO_FONT. Move inside HAVE_XFT.
+       (something_changed_gconfCB): Rename from something_changedCB.
        Check for changes in GCONF_TOOL_BAR_STYLE and GCONF_FONT_NAME also.
        (parse_settings): Move check for font inside HAVE_XFT.
        (read_settings, apply_xft_settings): Add comment.
@@ -1087,8 +1091,8 @@
        (init_gconf): Add comment.  Get values for GCONF_TOOL_BAR_STYLE
        and GCONF_FONT_NAME.  Move check for fonts within HAVE_XFT.
        (xsettings_initialize): Call init_gsettings last.
-       (xsettings_get_system_font, xsettings_get_system_normal_font): Add
-       comment.
+       (xsettings_get_system_font, xsettings_get_system_normal_font):
+       Add comment.
 
 2011-07-05  Paul Eggert  <address@hidden>
 
@@ -1271,7 +1275,7 @@
        (syms_of_xsettings): Initialize gsettings_client, gsettings_obj
        to NULL.
 
-       * Makefile.in (SETTINGS_CFLAGS, SETTINGS_LIBS): Renamed from
+       * Makefile.in (SETTINGS_CFLAGS, SETTINGS_LIBS): Rename from
        GCONF_CFLAGS/LIBS.
 
 2011-06-29  Martin Rudalics  <address@hidden>
@@ -2018,7 +2022,7 @@
 
        * character.c, coding.c, doprnt.c, editfns.c, eval.c:
        All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND.
-       * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX.
+       * lisp.h (STRING_BYTES_BOUND): Rename from STRING_BYTES_MAX.
 
        * character.c (string_escape_byte8): Fix nbytes/nchars typo.
 
@@ -2127,8 +2131,8 @@
        Qclone_number.  Remove external declaration of Qdelete_window.
        (Fbuffer_list): Rewrite doc-string.  Minor restructuring of
        code.
-       (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run
-       Qbuffer_list_update_hook if allowed.
+       (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer):
+       Run Qbuffer_list_update_hook if allowed.
        (Fother_buffer): Rewrite doc-string.  Major rewrite for new
        buffer list implementation.
        (other_buffer_safely): New function.
@@ -2139,8 +2143,8 @@
        (record_buffer): Inhibit quitting and rewrite using quittable
        functions.  Run Qbuffer_list_update_hook if allowed.
        (Frecord_buffer, Funrecord_buffer): New functions.
-       (switch_to_buffer_1, Fswitch_to_buffer): Remove.  Move
-       switch-to-buffer to window.el.
+       (switch_to_buffer_1, Fswitch_to_buffer): Remove.
+       Move switch-to-buffer to window.el.
        (bury-buffer): Move to window.el.
        (Vbuffer_list_update_hook): New variable.
 
@@ -2168,8 +2172,8 @@
        (select_window_norecord, select_frame_norecord): Move in front
        of run_window_configuration_change_hook.  Remove now obsolete
        declarations.
-       (Fset_window_buffer): Rewrite doc-string.  Call
-       Qrecord_window_buffer.
+       (Fset_window_buffer): Rewrite doc-string.
+       Call Qrecord_window_buffer.
        (keys_of_window): Move binding for other-window to window.el.
 
 2011-06-11  Chong Yidong  <address@hidden>
@@ -2251,8 +2255,8 @@
        orig_total_lines.
        (Fdelete_window, delete_window): Remove.  Window deletion is
        handled by window.el.
-       (window_loop): Remove DELETE_OTHER_WINDOWS case.  Replace
-       Fdelete_window calls with calls to Qdelete_window.
+       (window_loop): Remove DELETE_OTHER_WINDOWS case.
+       Replace Fdelete_window calls with calls to Qdelete_window.
        (Fdelete_other_windows): Remove.  Deleting other windows is
        handled by window.el.
        (window_fixed_size_p): Remove.  Fixed-sizeness of windows is
@@ -2275,8 +2279,8 @@
        (grow_mini_window, shrink_mini_window): Implement by calling
        Qresize_root_window_vertically, resize_window_check and
        resize_window_apply.
-       (saved_window, Fset_window_configuration, save_window_save): Do
-       not handle orig_top_line, orig_total_lines, and
+       (saved_window, Fset_window_configuration, save_window_save):
+       Do not handle orig_top_line, orig_total_lines, and
        resize_proportionally.
        (window_min_height, window_min_width): Move to window.el.
        (keys_of_window): Move bindings for delete-other-windows,
@@ -2296,8 +2300,8 @@
        * xdisp.c (init_xdisp): Don't use set_window_height but set
        heights directly.
 
-       * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): Use
-       resize_frame_windows instead of change_window_heights and run
+       * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines):
+       Use resize_frame_windows instead of change_window_heights and run
        run_window_configuration_change_hook.
 
        * w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows
@@ -2319,8 +2323,8 @@
        (Frun_window_configuration_change_hook, make_parent_window)
        (resize_window_check, resize_window_apply, Fresize_window_apply)
        (resize_frame_windows, Fsplit_window_internal)
-       (Fdelete_window_internal, Fresize_mini_window_internal): New
-       functions.
+       (Fdelete_window_internal, Fresize_mini_window_internal):
+       New functions.
        (syms_of_window): New variables Vwindow_splits and Vwindow_nest.
 
 2011-06-08  Martin Rudalics  <address@hidden>
@@ -2340,8 +2344,8 @@
        (Fwindow_nest, Fset_window_nest, Fwindow_new_total)
        (Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers)
        (Fset_window_prev_buffers, Fwindow_next_buffers)
-       (Fset_window_next_buffers, Fset_window_clone_number): New
-       functions.
+       (Fset_window_next_buffers, Fset_window_clone_number):
+       New functions.
        (Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start)
        (Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p):
        Doc-string fixes.
@@ -2367,10 +2371,10 @@
        (Fwindow_top_line, window_body_lines, Fwindow_body_size)
        (Fwindow_list_1): New functions.
        (window_box_text_cols): Replace with window_body_cols.
-       (Fwindow_width, Fscroll_left, Fscroll_right): Use
-       window_body_cols instead of window_box_text_cols.
-       (delete_window, Fset_window_configuration): Call
-       delete_all_subwindows with window as argument.
+       (Fwindow_width, Fscroll_left, Fscroll_right):
+       Use window_body_cols instead of window_box_text_cols.
+       (delete_window, Fset_window_configuration):
+       Call delete_all_subwindows with window as argument.
        (delete_all_subwindows): Take a window as argument and not a
        structure.  Rewrite.
        (window_loop): Remove handling of GET_LRU_WINDOW and
@@ -2381,8 +2385,8 @@
        window_box_text_cols.  delete_all_subwindows now takes a
        Lisp_Object as argument.
 
-       * indent.c (compute_motion, Fcompute_motion): Use
-       window_body_cols instead of window_box_text_cols.
+       * indent.c (compute_motion, Fcompute_motion):
+       Use window_body_cols instead of window_box_text_cols.
 
        * frame.c (delete_frame): Call delete_all_subwindows with root
        window as argument.

=== modified file 'src/keymap.c'
--- a/src/keymap.c      2011-08-02 16:02:52 +0000
+++ b/src/keymap.c      2011-08-03 21:40:06 +0000
@@ -150,17 +150,6 @@
   return Fcons (Qkeymap, Qnil);
 }
 
-DEFUN ("make-composed-keymap", Fmake_composed_keymap, Smake_composed_keymap,
-       0, MANY, 0,
-       doc: /* Construct and return a new keymap composed of KEYMAPS.
-When looking up a key in the returned map, the key is looked in each
-keymap in turn until a binding is found.
-usage: (make-composed-keymap &rest KEYMAPS)  */)
-  (ptrdiff_t nargs, Lisp_Object *args)
-{
-  return Fcons (Qkeymap, Flist (nargs, args));
-}
-
 /* This function is used for installing the standard key bindings
    at initialization time.
 
@@ -3761,7 +3750,6 @@
   defsubr (&Sset_keymap_parent);
   defsubr (&Smake_keymap);
   defsubr (&Smake_sparse_keymap);
-  defsubr (&Smake_composed_keymap);
   defsubr (&Smap_keymap_internal);
   defsubr (&Smap_keymap);
   defsubr (&Scopy_keymap);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]