aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge from savannah/emacs-29Po Lu2024-01-021-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dc4e6b13296 ; Update copyright years in more files 64b37776318 ; Run set-copyright from admin.el 8e1c56ae467 ; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
| * ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
| |
* | Split safe_call between redisplay and non-redisplay versionsStefan Monnier2023-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `safe_call/eval` family of functions started its life in `xdisp.c` for the needs of redisplay but quickly became popular outside of it. This is not ideal because despite their name, they are somewhat specific to the needs of redisplay. So we split them into `safe_call/eval` (in `eval.c`) and `dsafe_call/eval` (in `xdisp.c`). We took this opportunity to slightly change their calling convention to be friendly to the CALLN-style macros. While at it, we introduce a new `calln` macro as well which does all that `call[1-8]` used to do. * src/eval.c (safe_eval_handler, safe_funcall, safe_eval): New functions, Copied from `xdisp.c`. Don't obey `inhibit_eval_during_redisplay` any more. Adjust error message to not claim it happened during redisplay. * src/lisp.h (calln): New macro. (call1, call2, call3, call4, call5, call6, call7, call8): Turn them into aliases of `calln`. (safe_funcall): Declare. (safe_calln): New macro. (safe_call1, safe_call2): Redefine as compatibility macros. (safe_call, safe_call1, safe_call2): Delete. Replace all callers with calls to `safe_calln`. * src/xdisp.c (dsafe_eval_handler): Rename from `safe_eval_handler`. Adjust all users. (dsafe__call): Rename from `safe_call` and change calling convention to work with something like CALLMANY. Adjust all users. (safe_call, safe__call1, safe_call2): Delete functions. (SAFE_CALLMANY, dsafe_calln): New macros. (dsafe_call1, dsafe_eval): Rename from `safe_call1` and `safe_eval`, and rewrite using them. Adjust all users. (clear_message, prepare_menu_bars, redisplay_window): Use `dsafe_calln`. (run_window_scroll_functions): Don't let-bind `Qinhibit_quit` since `safe_run_hooks_2` does it for us.
* | Rename describe-map-tree to help--describe-map-treeStefan Kangas2023-09-171-12/+12
| | | | | | | | | | | | | | This function should have been made internal in the first place. * lisp/help.el (help--describe-map-tree): Rename from 'describe-map-tree'. Keep old name as an obsolete alias, and update all callers.
* | Merge from origin/emacs-29Eli Zaretskii2023-08-041-1/+5
|\ \ | |/ | | | | | | | | | | | | 0f183770c56 Fix byte-compiled files that use 'bind-key' from use-package acfcf7f3690 Fix "Paste from Kill Menu" in non X toolkit builds 04996b21241 Handle tabs in the SQL shown in the column listing 573fcf27122 Add new keyword to 'typescript-ts-mode' db7d70d3cad ; Add commentary to 'describe-function's completion
| * Fix "Paste from Kill Menu" in non X toolkit buildsEli Zaretskii2023-08-041-1/+5
| | | | | | | | | | | | * src/keymap.c (possibly_translate_key_sequence): Don't signal an error if 'key-valid-p' returns nil. Suggested by Stefan Monnier <monnier@iro.umontreal.ca>. (Bug#64927)
* | Prefer C23 ckd_* to Gnulib *_WRAPV macrosPaul Eggert2023-05-171-3/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C23 has added ckd_add etc. macros with functionality equivalent to the older Gnulib INT_ADD_WRAPV macros, so switch to the more-standard names. * admin/merge-gnulib (GNULIB_MODULES): Add stdckdint. This merely makes the dependency explicit, as we were already using this Gnulib module indirectly. * lib-src/etags.c, src/lisp.h: Include stdckdint.h. * lib-src/etags.c (xnmalloc, xnrealloc): * src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string) (mark_memory): * src/bignum.c (emacs_mpz_pow_ui): * src/buffer.c (record_overlay_string, overlay_strings): * src/bytecode.c (exec_byte_code): * src/casefiddle.c (do_casify_multibyte_string): * src/ccl.c (ccl_driver, Fccl_execute_on_string): * src/character.c (char_width, c_string_width) (lisp_string_width, count_size_as_multibyte) (string_escape_byte8): * src/cmds.c (internal_self_insert): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display_interactive): * src/doprnt.c (parse_format_integer): * src/editfns.c (Freplace_buffer_contents, str2num) (styled_format): * src/emacs-module.c (module_global_reference_p) (module_make_global_ref, module_funcall): * src/eval.c (max_ensure_room): * src/fileio.c (blocks_to_bytes): * src/fns.c (Ffillarray): * src/font.c (font_intern_prop): * src/frame.c (check_frame_pixels): * src/gnutls.c (gnutls_hex_string, gnutls_symmetric_aead): * src/gtkutil.c (get_utf8_string): * src/haikuterm.c (haiku_term_init): * src/image.c (xbm_scan, image_to_emacs_colors) (image_detect_edges, png_load_body): * src/keyboard.c (Frecursion_depth): * src/keymap.c (Flookup_key, Fkey_description): * src/lisp.h (modiff_incr, SAFE_ALLOCA_LISP_EXTRA): * src/lread.c (read_bool_vector): * src/pgtkterm.c (pgtk_term_init): * src/regex-emacs.c (regex_compile): * src/term.c (encode_terminal_code): * src/termcap.c (tputs): * src/textconv.c (textconv_query): * src/timefns.c (timespec_ticks, lisp_time_hz_ticks) (Fdecode_time, check_tm_member): * src/tparam.c (tparam1): * src/w32term.c (w32_initialize_display_info): * src/xdisp.c (fill_column_indicator_column, decode_mode_spec): * src/xselect.c (selection_data_size, x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (xm_setup_dnd_targets, x_sync_get_monotonic_time) (x_sync_current_monotonic_time, x_sync_note_frame_times) (x_display_set_last_user_time, x_term_init): Prefer the C23 stdckdint macros to their Gnulib intprops.h counterparts, since C23 is standard.
* Avoid crashes in 'describe-keymap' due to shadowingEli Zaretskii2023-04-161-7/+12
| | | | | * src/keymap.c (describe_vector): Handle shadowing by something other than a symbol. (Bug#62867)
* Don't add a key binding when REMOVE is non-nilRobert Pluim2023-03-171-15/+16
| | | | | * src/keymap.c (store_in_keymap): Don't add a nil keybinding if we've been asked to remove a non-existent binding. (Bug#62207)
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* * src/keymap.c (Fcopy_keymap): Document using defvar-keymap.Stefan Kangas2022-07-041-2/+8
|
* Filter out NS non-key events from `where-is-internal'Lars Ingebrigtsen2022-06-181-2/+12
| | | | | | | | | | | * doc/lispref/keymaps.texi (Scanning Keymaps): Document it. * lisp/keymap.el (make-non-key-event): New function. * lisp/term/common-win.el (x-setup-function-keys): Mark ns events as not being keys (bug#55940). * src/keymap.c (Fwhere_is_internal): Filter out key sequences that are marked as being non-keys.
* Use BASE_EQ when comparing with QunboundMattias Engdegård2022-06-121-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qunbound is uninterned and can therefore never be EQ to any symbol with position. * src/buffer.c (Fbuffer_local_value, buffer_lisp_local_variables) (buffer_local_variables_1): * src/bytecode.c (exec_byte_code): * src/comp.c (compile_function, Fcomp__compile_ctxt_to_file): * src/composite.c (composition_gstring_cache_clear_font): * src/data.c (Fboundp, Fsymbol_value, set_internal) (Fdefault_boundp, Fdefault_value, Fmake_variable_buffer_local): * src/emacs-module.c (module_global_reference_p): * src/eval.c (Fdefault_toplevel_value, defvar) (run_hook_with_args): * src/fns.c (hash_put, Fmaphash): * src/font.c (font_put_extra): * src/frame.c (gui_set_frame_parameters) (gui_frame_get_and_record_arg, gui_default_parameter) (gui_figure_window_size): * src/haikufns.c (get_geometry_from_preferences) (haiku_create_frame, haiku_create_tip_frame): * src/haikuterm.c (haiku_draw_text_decoration) (haiku_default_font_parameter): * src/json.c (lisp_to_json_nonscalar_1): * src/keymap.c (access_keymap_1, access_keymap, current_minor_maps): * src/lread.c (readevalloop, define_symbol): * src/minibuf.c (read_minibuf, Ftry_completion): (Fall_completions, Ftest_completion): * src/pgtkfns.c (pgtk_default_font_parameter, Fx_create_frame) (x_create_tip_frame): * src/pgtkselect.c (Fpgtk_own_selection_internal): * src/print.c (print): * src/profiler.c (evict_lower_half, record_backtrace): * src/terminal.c (create_terminal): * src/textprop.c (set_properties): * src/w32fns.c (my_create_window, w32_icon) (w32_default_font_parameter, Fx_create_frame) (w32_create_tip_frame): * src/w32term.c (w32_draw_glyph_string): * src/xdisp.c (handle_single_display_spec) (cursor_row_fully_visible_p, calc_pixel_width_or_height): * src/xfns.c (x_default_scroll_bar_color_parameter, x_icon_verify) (x_icon, x_default_font_parameter, Fx_create_frame) (x_create_tip_frame): * src/xselect.c (x_handle_selection_request): * src/xterm.c (x_draw_glyph_string, x_term_init): Use BASE_EQ instead of EQ when comparing with Qunbound.
* Make :filters run in the correct buffer in describe-buffer-bindingsLars Ingebrigtsen2022-04-171-10/+10
| | | | | | | | | | * lisp/help.el (describe-map-tree): Take an optional buffer parameter. (describe-map): Ditto, and use it to run `lookup-key' in the correct buffer. This fixes problems of filters being run in the wrong buffer (bug#39149). * src/keymap.c (Fdescribe_buffer_bindings): Pass in BUFFER to describe-map-tree.
* Replace ptrdiff_t with new specpdl_ref type for specpdl referencesMattias Engdegård2022-02-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The specpdl_ref type is just an alias for ptrdiff_t; the compiled code remains the same. All operations on specpdl_ref (arithmetic, comparison etc) now go through inline functions. The bulk of the change is almost completely mechanical. It is done to prepare for a type-safe representation and subsequent performance improvement. * src/lisp.h (specpdl_ref, specpdl_count_to_ref, specpdl_ref_to_count) (specpdl_ref_eq, specpdl_ref_lt, specpdl_ref_valid_p) (make_invalid_specpdl_ref, specpdl_ref_add, specpdl_ref_to_ptr): New. (SPECPDL_INDEX, struct handler, USE_SAFE_ALLOCA, safe_free) (safe_free_unbind_to): * src/alloc.c (run_finalizer_function, inhibit_garbage_collection) (garbage_collect, Fgarbage_collect, which_symbols): * src/bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start): * src/buffer.c (Fkill_buffer, Fset_buffer_major_mode, Fmove_overlay) (Fdelete_overlay): * src/bytecode.c (exec_byte_code): * src/callint.c (Ffuncall_interactively, Fcall_interactively): * src/callproc.c (Fcall_process, call_process, create_temp_file) (Fcall_process_region): * src/charset.c (load_charset_map_from_file): * src/coding.c (decode_coding_gap, decode_coding_object) (encode_coding_object, Fread_coding_system): * src/comp.c (emit_static_object, helper_unbind_n, load_comp_unit): * src/composite.c (update_compositions, autocmp_chars): * src/cygw32.c (conv_filename_to_w32_unicode) (conv_filename_from_w32_unicode): * src/data.c (notify_variable_watchers): * src/decompress.c (Fzlib_decompress_region): * src/dired.c (directory_files_internal, file_name_completion) (file_attributes): * src/dispnew.c (Fredisplay): * src/doc.c (get_doc_string, Fsnarf_documentation): * src/editfns.c (Fsave_excursion, Fsave_current_buffer) (Freplace_buffer_contents, Fsubst_char_in_region, Fsave_restriction) (styled_format): * src/emacs-module.c (Fmodule_load, funcall_module): * src/emacs.c (init_cmdargs, Fdump_emacs): * src/eval.c (call_debugger, do_debug_on_call, FletX, Flet) (Ffuncall_with_delayed_message, Funwind_protect) (internal_lisp_condition_case, signal_or_quit) (load_with_autoload_queue, Feval, grow_specpdl_allocation) (record_in_backtrace, eval_sub, Ffuncall, apply_lambda) (funcall_lambda, clear_unwind_protect, set_unwind_protect) (set_unwind_protect_ptr, unbind_to, Fbacktrace_eval): * src/fileio.c (Fmake_temp_file_internal, Fcopy_file, Frename_file) (Finsert_file_contents, write_region, Fdo_auto_save): * src/fns.c (Fyes_or_no_p, Frequire, hash_table_user_defined_call): * src/fringe.c (update_window_fringes): * src/gtkutil.c (xg_dialog_run): * src/haiku_io.c (c_specpdl_idx_from_cxx): * src/haiku_support.cc (be_popup_file_dialog): * src/haiku_support.h (c_specpdl_idx_from_cxx): * src/haikufns.c (haiku_create_frame, haiku_create_tip_frame) (haiku_hide_tip, Fx_show_tip, Fhaiku_read_file_name): * src/haikumenu.c (haiku_popup_dialog, set_frame_menubar): * src/image.c (slurp_file): * src/indent.c (line_number_display_width, Fvertical_motion): * src/insdel.c (signal_before_change, signal_after_change) (Fcombine_after_change_execute): * src/intervals.c (get_local_map): * src/json.c (lisp_to_json_nonscalar_1, Fjson_serialize, Fjson_insert) (Fjson_parse_string, Fjson_parse_buffer): * src/keyboard.c (recursive_edit_1, Frecursive_edit, cmd_error) (Finternal_track_mouse, command_loop_1, read_menu_command) (safe_run_hooks, read_event_from_main_queue, read_char, timer_check_2) (menu_item_eval_property, read_key_sequence, read_key_sequence_vs) (Fsuspend_emacs): * src/keymap.c (Fcurrent_active_maps, Fdescribe_vector) (Fhelp__describe_vector): * src/lread.c (Fload, save_match_data_load, readevalloop) (Feval_buffer, Feval_region, grow_read_buffer, read_integer, read1): * src/macros.c (Fexecute_kbd_macro): * src/menu.c (x_popup_menu_1): * src/minibuf.c (read_minibuf, set_minibuffer_mode) (read_minibuf_unwind, Fread_string, Fread_buffer): * src/nsfns.m (Fx_create_frame, Fx_show_tip): * src/nsmenu.m (ns_update_menubar, ns_menu_show, ns_popup_dialog): * src/pdumper.c (Fdump_emacs_portable): * src/pgtkfns.c (Fx_create_frame, x_create_tip_frame, x_hide_tip) (Fx_show_tip, Fpgtk_print_frames_dialog, Fx_file_dialog, Fx_select_font): * src/pgtkmenu.c (set_frame_menubar, create_and_show_popup_menu) (pgtk_menu_show, create_and_show_dialog, pgtk_dialog_show) (pgtk_popup_dialog): * src/pgtkterm.c (pgtk_cr_export_frames): * src/print.c (PRINTPREPARE, temp_output_buffer_setup) (Fprin1_to_string, print_vectorlike): * src/process.c (Fmake_process, create_process, Fmake_pipe_process) (Fmake_serial_process, connect_network_socket, Fmake_network_process) (network_interface_info, server_accept_connection) (wait_reading_process_output, read_process_output, exec_sentinel): * src/regex-emacs.c (re_match_2_internal): * src/search.c (looking_at_1, fast_looking_at, search_buffer_re): * src/sound.c (Fplay_sound_internal): * src/sysdep.c (system_process_attributes): * src/term.c (tty_menu_show): * src/textprop.c (Fnext_single_char_property_change) (Fprevious_single_char_property_change, add_text_properties_1) (set_text_properties, set_text_properties_1, Fremove_text_properties) (Fremove_list_of_text_properties): * src/thread.c (Fmutex_lock, invoke_thread_function): * src/undo.c (truncate_undo_list): * src/w32fns.c (Fx_create_frame, w32_create_tip_frame, w32_hide_tip) (Fx_show_tip, Fx_file_dialog): * src/w32font.c (Fx_select_font): * src/w32menu.c (set_frame_menubar): * src/window.c (window_list, next_window, window_list_1) (run_window_configuration_change_hook, Frun_window_scroll_functions) (run_window_change_functions, set_window_buffer) (temp_output_buffer_show, window_scroll, scroll_command) (Fscroll_other_window, Fscroll_other_window_down): * src/xdisp.c (safe__call, handle_fontified_prop, handle_face_prop) (handle_single_display_spec, Fbuffer_text_pixel_size) (message_dolog, with_echo_area_buffer, setup_echo_area_for_printing) (display_echo_area, set_message, clear_message, echo_area_display) (gui_consider_frame_title, prepare_menu_bars, update_menu_bar) (update_tab_bar, update_tool_bar, redisplay_internal) (redisplay_preserve_echo_area, run_window_scroll_functions) (redisplay_window, extend_face_to_end_of_line) (display_count_lines_logically, display_count_lines_visually) (display_mode_lines, display_mode_line, Fformat_mode_line) (decode_mode_spec): * src/xfns.c (Fx_create_frame, x_create_tip_frame, x_hide_tip) (Fx_show_tip, Fx_file_dialog, Fx_select_font, Fx_print_frames_dialog): * src/xmenu.c (set_frame_menubar, create_and_show_popup_menu) (x_menu_show, create_and_show_dialog, x_dialog_show) (xw_popup_dialog): * src/xselect.c (x_get_local_selection, x_reply_selection_request) (x_handle_selection_request, wait_for_property_change): * src/xterm.c (x_cr_export_frames, x_connection_closed): Replace ptrdiff_t with specpdl_ref for referencing specpdl and use the corresponding functions instead of direct arithmetic.
* Merge from origin/emacs-28Eli Zaretskii2022-01-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
| |
| * Avoid signaling errors in lookup-keyEli Zaretskii2021-10-311-16/+22
| | | | | | | | | | * src/keymap.c (Flookup_key): Handle KEY vectors where not all components are symbols. (Bug#51527) Do not merge to master.
| * Avoid assertion violations in 'lookup-key'Eli Zaretskii2021-10-281-2/+2
| | | | | | | | | | * src/keymap.c (Flookup_key): Don't call ASIZE unless KEY is a vector. This avoids assertion violations when KEY is a string.
| * Be more allowing when looking for menu-bar itemsStefan Kangas2021-10-281-21/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | Don't merge to master. This is a safe-for-release fix for Bug#50752. * src/keymap.c (lookup_key_1): Factor out function from Flookup_key. (Flookup_key): Be case insensitive when looking for Qmenu_bar items. (Bug#50752) * test/src/keymap-tests.el (keymap-lookup-key/mixed-case) (keymap-lookup-key/mixed-case-multibyte): New tests.
* | Fix compilation error in previous keymap.c changeLars Ingebrigtsen2021-11-161-2/+2
| | | | | | | | | | * src/keymap.c (initial_define_lispy_key, define_as_prefix): Fix --enable-checking error.
* | Add new 'keymap-*' functionsLars Ingebrigtsen2021-11-161-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/keymap.el: New file with all the new keymap-* functions. * lisp/loadup.el ("keymap"): Load. * lisp/subr.el (kbd): Refactor out all the code to key-parse. (define-key-after, keyboard-translate, global-set-key) (local-set-key, global-unset-key, local-unset-key) (local-key-binding, global-key-binding) (substitute-key-definition): Note in doc strings that these are legacy functions. (define-keymap--define): Use keymap-set. * lisp/emacs-lisp/byte-opt.el: Remove the optimizations for defvar-keymap and define-keymap since the macros now only understand the kbd syntax. * lisp/emacs-lisp/bytecomp.el (byte-compile-define-keymap) (byte-compile-define-keymap--define): Warn about invalid key definitions in all keymap-* functions. * lisp/emacs-lisp/shortdoc.el (keymaps): Add shortdocs form keymap* functions. * src/keymap.c (possibly_translate_key_sequence): Adjust callers to key-valid-p and key-parse. (syms_of_keymap): Adjust defs.
* | Allow removing keymap definitionsLars Ingebrigtsen2021-11-161-15/+43
| | | | | | | | | | | | | | | | | | | | * src/keymap.c (initial_define_lispy_key): Adjust caller. (store_in_keymap): Allow removing definitions in addition to setting them to nil. (Fdefine_key): Ditto. (define_as_prefix): Adjust caller. * src/term.c (term_get_fkeys_1): Adjust caller.
* | Include the major mode name in the `C-h b' outputLars Ingebrigtsen2021-11-011-1/+4
| | | | | | | | | | | | | | | | | | * lisp/calc/calc-help.el (calc-describe-bindings): Don't add the name since it's there now. * src/keymap.c (Fdescribe_buffer_bindings): Include the major mode name for symmetry with the minor modes (and because it's easy to forget).
* | Avoid signaling errors in lookup-keyEli Zaretskii2021-10-311-27/+39
| | | | | | | | | | * src/keymap.c (Flookup_key): Handle KEY vectors where not all components are symbols. (Bug#51527
* | Fix bootstrapping broken by a recent changeEli Zaretskii2021-10-291-0/+3
| | | | | | | | | | * src/keymap.c (Flookup_key): Avoid crashes during bootstrap when uni-lowercase.el is not available yet.
* | Be more allowing when looking for menu-bar itemsStefan Kangas2021-10-281-21/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/keymap.c (lookup_key_1): Factor out function from Flookup_key. (Flookup_key): Be case insensitive, and treat spaces as dashes, when looking for Qmenu_bar items. (Bug#50752) * test/src/keymap-tests.el (keymap-lookup-key/mixed-case) (keymap-lookup-key/mixed-case-multibyte) (keymap-lookup-keymap/with-spaces) (keymap-lookup-keymap/with-spaces-multibyte) (keymap-lookup-keymap/with-spaces-multibyte-lang-env): New tests.
* | Merge from origin/emacs-28Glenn Morris2021-10-241-0/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c7f53824a8 (origin/emacs-28) Update publicsuffix.txt from upstream 9a50f760e9 ; * doc/lispref/modes.texi (Hooks): Clarify wording. (Bug... e154fd9119 Refer to the info node on keymaps in map-keymap docstring 4fd5c8df67 Clarify abnormal hook documentation 6fa5206770 Update to Org 9.5-59-g52e6f1 39413a45bf ; * doc/lispref/functions.texi (Calling Functions): Fix la... 43914ab01f Improve documentation of cl-reduce ef37a86cac Improve documentation of apply-partially 1e8be48738 Fix typos 8c5fbd712b Revert commit 225ca617b7, and apply another fix cdbd03345d Fix documentation of posn-at-x-y 598732c899 ; * src/vm-limit.c (get_lim_data): Fix a typo. (Bug#18238) efdffd86c5 ; * etc/refcards/README: Prefer HTTPS in link. # Conflicts: # etc/NEWS
| * Refer to the info node on keymaps in map-keymap docstringStefan Kangas2021-10-241-0/+3
| | | | | | | | | | * src/keymap.c (Fmap_keymap): Doc fix; add a reference to the Info node '(elisp) Keymaps'. (Bug#30958)
* | Make `lookup-key' understand the new key sequence syntaxLars Ingebrigtsen2021-10-191-15/+25
| | | | | | | | | | | | | | * src/keymap.c (possibly_translate_key_sequence): Factored out into own function. (Fdefine_key): (Flookup_key): Use it.
* | Support a new ["..."] key binding syntaxLars Ingebrigtsen2021-10-171-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/keymaps.texi (Key Sequences): (Changing Key Bindings): Document the various key syntaxes. * lisp/emacs-lisp/byte-opt.el (byte-optimize-define-key) (byte-optimize-define-keymap) (byte-optimize-define-keymap--define): New functions to check and expand ["..."] syntax at compile time. * src/keymap.c (Fdefine_key): Understand the ["..."] syntax. (syms_of_keymap): Define `kbd' symbols.
* | define-key doc string improvementLars Ingebrigtsen2021-10-141-1/+3
|/ | | | | | | | | | * src/keymap.c (Fdefine_key): Explain what the STRING is used for. (local-set-key "\C-c\C-c" (define-keymap :name "Zot" "a" '("foo" . ignore) "b" '("gazonk" . ignore)))
* Fix performance degradation in commands that describe key bindingsEli Zaretskii2021-09-181-22/+39
| | | | | | | | | | | | | * src/keymap.c (syms_of_keymap) <describe-bindings-check-shadowing-in-ranges>: New variable. (describe_vector): Check shadowing of consecutive keys only if 'describe-bindings-check-shadowing-in-ranges' is non-nil. Remove redundant second loop when VECTOR is a char-table. Improve comments. Patch by Stefan Kangas <stefan@marxist.se>. (Bug#45379) * test/src/keymap-tests.el (help--describe-vector/bug-9293-one-shadowed-in-range): Adapt the test case for the new variable.
* * src/minibuf.c (Fread_no_blanks_input): Move to `minibuffer.el`Stefan Monnier2021-04-201-6/+0
| | | | | | | * src/keymap.c (syms_of_keymap): * lisp/minibuffer.el (minibuffer-local-ns-map): Move declaration to initialization. (read-no-blanks-input): Move from `minibuf.c`.
* Add new face 'help-key-binding' for keybindings in helpStefan Kangas2021-03-081-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/faces.el (help-key-binding): New face. * lisp/help.el (help-for-help): Rename from 'help-for-help-internal'. Use 'substitute-command-keys' syntax. (help): Make into alias for 'help-for-help'. (help-for-help-internal): Make into obsolete alias for 'help-for-help'. (help--key-description-fontified): New function to add the 'help-key-binding' face. (help-key-description, substitute-command-keys) (describe-map-tree, help--describe-command) (help--describe-translation, describe-map): * lisp/help-fns.el (help-fns--key-bindings, describe-mode): Use above new function. * lisp/isearch.el (isearch-help-for-help-internal): Use `substitute-command-keys' syntax. * lisp/help-macro.el (make-help-screen): Use 'substitute-command-keys' and 'help--key-description-fontified'. Simplify. * src/keymap.c (describe_key_maybe_fontify): New function to add the 'help-key-binding' face to keybindings. (describe_vector): Use above new keybinding. (syms_of_keymap) <Qfont_lock_face, Qhelp_key_binding>: New DEFSYMs. (fontify_key_properties): New static variable. * lisp/tooltip.el (tooltip-show): Avoid overriding faces in specified tooltip text. * test/lisp/help-tests.el (with-substitute-command-keys-test): Don't test for text properties. (help-tests-substitute-command-keys/add-key-face) (help-tests-substitute-command-keys/add-key-face-listing): New tests.
* Remove another variable obsolete since Emacs 23.2Stefan Kangas2021-02-011-9/+0
| | | | | | * src/keymap.c (syms_of_keymap, Fdefine_key): * lisp/subr.el (define-key-rebound-commands): Remove variable obsolete since Emacs 23.2.
* Lift {global,local}-key-binding to LispStefan Kangas2021-01-131-35/+0
| | | | | | | | * lisp/subr.el (local-key-binding, global-key-binding): New defuns. * src/keymap.c (Flocal_key_binding, Fglobal_key_binding): Remove DEFUNs. (syms_of_keymap): Remove defsubrs for above DEFUNs. * test/lisp/subr-tests.el (subr-test-local-key-binding) (subr-test-global-key-binding): New tests.
* Lift define-prefix-command to LispStefan Kangas2021-01-081-23/+0
| | | | | | | | * lisp/subr.el (define-prefix-command): New defun. * src/keymap.c (Fdefine_prefix_command): Remove DEFUN. (syms_of_keymap): Remove defsubr for Fdefine_prefix_command. * test/lisp/subr-tests.el (subr-test-define-prefix-command): New test.
* Pretty-print keys without <> around modifiers (bug#45536)Mattias Engdegård2021-01-051-5/+15
| | | | | | | | | | | | | | | Be consistent when pretty-printing keys: put modifiers outside <>, thus the more logical C-M-<return> instead of <C-M-return>. * src/keymap.c (Fsingle_key_description): Skip modifier prefix before adding <>. * doc/lispref/help.texi (Describing Characters): Update example. * doc/lispref/debugging.texi (Backtraces): * doc/lispref/minibuf.texi (Text from Minibuffer): Use @kbd instead of @key. * etc/NEWS: Announce the change. * test/src/keymap-tests.el (keymap--key-description): * test/lisp/subr-tests.el (subr--kbd): New tests.
* * lisp/subr.el (esc-map): Initialize inside declarationStefan Monnier2021-01-041-28/+0
| | | | | | | | | | | | | | | | * src/commands.h (meta_map): * src/keymap.c (meta_map): Delete variable. (syms_of_keymap): Don't initialize esc-map here. (initial_define_key): * src/keymap.h (initial_define_key): Delete function. * src/keyboard.c (keys_of_keyboard): Don't initialize esc-map here. * src/window.h (keys_of_window): * src/window.c (keys_of_window): Delete function. * src/lisp.h (keys_of_casefiddle): * src/casefiddle.c (keys_of_casefiddle): Delete function. * src/emacs.c (main): Don't call them.
* * lisp/subr.el (ctl-x-map): Initialize inside the declaration.Stefan Monnier2021-01-041-7/+0
| | | | | | | | | | | | | | * src/command.h (control_x_map): * src/keymap.c (control_x_map): Delete variable. (syms_of_keymap): * src/keyboard.c (keys_of_keyboard): * src/casefiddle.c (keys_of_casefiddle): * src/window.c (keys_of_window): Move initialization of ctl-x-map to subr.el. * src/lisp.h (syms_of_buffer): * src/buffer.c (keys_of_buffer): Delete function. * src/emacs.c (main): Don't call it.
* * lisp/subr.el (global-map): Initialize inside declaration.Stefan Monnier2021-01-041-14/+1
| | | | | | | | | | | | | * src/commands.h (global_map): * src/keymap.c (global_map): Delete variable. (syms_of_keymap): Don't initialize global_map here. (keys_of_keymap): Delete function. * src/lisp.h (keys_of_cmds): * src/cmds.c (keys_of_cmds): Delete function. * src/emacs.c (main): Don't call them. * src/window.c (keys_of_window): Don't initialize global_map here. * src/keyboard.c (keys_of_keyboard): Don't initialize global_map here.
* Fix backslash mistakes in doc strings in C codeMattias Engdegård2021-01-021-1/+1
| | | | | | | | These were found by an instrumented version of make-docfile. * src/gnutls.c (Fgnutls_available_p): * src/keymap.c (Fkey_description): * src/xdisp.c (syms_of_xdisp):
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Minor cleanup in keymap.cStefan Kangas2020-12-301-136/+72
| | | | | | | | | | * src/keymap.c (get_keymap, keymap_parent, Fset_keymap_parent) (store_in_keymap, Fdefine_key, Flookup_key, define_as_prefix) (silly_event_symbol_error, current_minor_maps) (Fcurrent_active_maps, Fkey_binding, Flocal_key_binding) (Fminor_mode_key_binding, Fdefine_prefix_command) (Faccessible_keymaps, Fdescribe_buffer_bindings) (describe_vector, Fwhere_is_internal): Minor cleanup.
* Convert apropos-internal from C to Lisp (Bug#44529)Stefan Kangas2020-12-191-39/+0
| | | | | | | | | | | | | | | | | | | | | This runs insignificantly faster in C, and is already fast enough on reasonably modern hardware. We might as well lift it to Lisp. This benchmark can be used to verify: (benchmark-run 10 (apropos-command "test")) => (0.12032415399999999 2 0.014772391999999995) ; C => (0.13513192100000002 2 0.017216643000000004) ; Lisp * lisp/subr.el (apropos-internal): New defun, converted from C. * src/keymap.c (Fapropos_internal): Remove defun. (apropos_accum): Remove function. (apropos_predicate, apropos_accumulate): Remove variables. (syms_of_keymap): Remove defsubr for Fapropos_internal, and definitions of the above variables. * test/src/keymap-tests.el (keymap-apropos-internal) (keymap-apropos-internal/predicate): Move tests from here... * test/lisp/subr-tests.el (apropos-apropos-internal) (apropos-apropos-internal/predicate): ...to here.
* Say which command shadows a key bindingStefan Kangas2020-11-221-1/+7
| | | | | | | | * src/keymap.c (describe_vector): Say which command shadows this binding. (Bug#9293) * test/src/keymap-tests.el (help--describe-vector/bug-9293-one-shadowed-in-range): Adapt test.
* Don't shadow bindings by the same commandStefan Kangas2020-11-221-1/+1
| | | | | | | | * src/keymap.c (describe_vector): Do not say binding is shadowed if the other key binding points to the same command. (Bug#9293) * test/src/keymap-tests.el (help--describe-vector/bug-9293-same-command-does-not-shadow): New test.
* Don't show key ranges if shadowed by different commandsStefan Kangas2020-11-221-4/+18
| | | | | | | | * src/keymap.c (describe_vector): Make sure found consecutive keys are either not shadowed or, if they are, that they are shadowed by the same command. (Bug#9293) * test/src/keymap-tests.el (help--describe-vector/bug-9293-one-shadowed-in-range): New test.
* Fix mistake in describe-buffer-bindingsStefan Kangas2020-11-121-1/+1
| | | | | | | * src/keymap.c (Fdescribe_buffer_bindings): Fix a call in describe-buffer-bindings. This fixes a mistake in my previous commit to prefer the Lisp version of describe-map-tree (8a1441310aa1), where 0 was accidentally converted to Qt in two places.