summaryrefslogtreecommitdiff
path: root/src/search.c
Commit message (Collapse)AuthorAge
* (Freplace_match): Fix bug#65451Stefan Monnier2024-04-07
| | | | | | | | | | | | | | | * src/search.c (Freplace_match): For ordering of *-change-functions. * test/src/editfns-tests.el (editfns-tests--before/after-change-functions): New test. (sanity-check--message, sanity-check-change-functions-error) (sanity-check-change-functions-check-size) (sanity-check-change-functions-before) (sanity-check-change-functions-after): New functions. (sanity-check--verbose, sanity-check-change-functions-beg) (sanity-check-change-functions-end) (sanity-check-change-functions-buffer-size) (sanity-check-change-functions-errors): New vars.
* Merge from savannah/emacs-29Po Lu2024-01-02
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-02
| |
* | Improve performance let-binding `case-fold-search' (bug#66117)Ihor Radchenko2023-12-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h: Remove case_fold_search_ buffer object slot. * src/buffer.c (bset_case_fold_search): Remove - no longer needed. (init_buffer_once): Remove removed buffer slot init. (syms_of_buffer): Use DEFVAR_LISP to define `case-fold-search' and declare it buffer-local. * src/minibuf.c (syms_of_minibuf): Remove DEFSYM call for `case-fold-search' symbol. It now lives in `syms_of_buffer'. * src/editfns.c (Fcompare_buffer_substrings): (Fchar_equal): * src/search.c (looking_at_1): (string_match_1): (search_command): (Fre__describe_compiled): Adjust C queries to `case-fold-search' value to use C globals instead of BVAR macro. * doc/lispref/internals.texi (Buffer Internals): Do not list `case_fold_search' slot. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66117#259 When used as buffer slot, let-binding `case-fold-search' would scale with the number of live buffers and can be slow. This change makes let-binding much faster at the cost of slightly slower `set-buffer'.
* | (update_search_regs): Install better fix for bug#67124Stefan Monnier2023-11-18
| | | | | | | | | | | | | | | | | | | | The recent fix for the bug in `replace-match-maybe-edit` was basically a refinement of a previously installed workaround, whereas the bug was really in `update_search_regs`. * src/search.c (update_search_regs): Improve handling of `start` positions. * lisp/replace.el (replace-match-maybe-edit): Remove workaround. * test/src/search-tests.el (search-test--replace-match-update-data): New test.
* | Add 'case-symbols-as-words' to configure symbol case behaviorSpencer Baugh2023-10-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some programming languages and styles, a symbol (or every symbol in a sequence of symbols) might be capitalized, but the individual words making up the symbol should never be capitalized. For example, in OCaml, type names Look_like_this and variable names look_like_this, but it is basically never correct for something to Look_Like_This. And one might have "aa_bb cc_dd ee_ff" or "Aa_bb Cc_dd Ee_ff", but never "Aa_Bb Cc_Dd Ee_Ff". To support this, the new variable 'case-symbols-as-words' causes symbol constituents to be treated as part of words only for case operations. * src/casefiddle.c (case_ch_is_word): New function. (case_character_impl, case_character): Use 'case_ch_is_word'. (syms_of_casefiddle): Define 'case-symbols-as-words'. * src/search.c (Freplace_match): Use 'case-symbols-as-words' when calculating case pattern. * test/src/casefiddle-tests.el (casefiddle-tests--check-syms) (casefiddle-case-symbols-as-words): Test 'case-symbols-as-words'. * etc/NEWS: Announce 'case-symbols-as-words'. * doc/lispref/strings.texi (Case Conversion): Document 'case-symbols-as-words'. (Bug#66614)
* | Fix last changePo Lu2023-09-30
| | | | | | | | | | * src/search.c (Fre__describe_compiled): Correct typos and pointer signedness missmatch.
* | search.c (re--describe-compiled): New function (bug#66261)Stefan Monnier2023-09-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provides a fairly primitive but handy way to see what a regexp compiles to without having to enable REGEX_EMACS_DEBUG and wade through tons of stderr output. * doc/lispref/searching.texi (Regexp Problems): Mention `re--describe-compiled`. * src/regex-emacs.c (debug_putchar, print_fastmap) (print_partial_compiled_pattern, print_compiled_pattern): Add `dest` argument, and compile also when `ENABLE_CHECKING` is set. (DEBUG_PRINT_COMPILED_PATTERN, print_double_string, regex_compile): Adjust to additional argument. * src/regex-emacs.h (print_compiled_pattern): Declare. * src/search.c (Fre__describe_compiled): New function. (syms_of_search): Defsubr it.
* | Merge from origin/emacs-29Jim Porter2023-08-21
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3296031ad74 ; Another improvement for documentation of pixelwise scro... baeb2d71ae7 Support defun navigation for DEFUN in c-ts-mode (bug#64442) 781ddd7e7d8 Fix touchpad scrolling on MS-Windows c125bd060e2 Fix order in which package-vc dependencies are resolved 500ced133ad Fix building of VC package manuals with relative org link... 456ecabe9e8 Fix the documentation of 'cl-flet' f6ebd1ef0d0 ; * src/treesit.c (Ftreesit_node_parent): Improve comment... fac0e2d5334 Avoid false "wrong passphrase" messages in EPA 8f683b51d8b Fix jsx font-lock in older tree-sitter-js grammars d9af79ae39d Fix cloning 'face-remapping-alist' for indirect buffers 636fb267c46 Improve documentation of case transfer in replacement com... 7856d51436b Fix horizontal scrolling of images with C-f 8cf5659ec2f ; Fix defcustom in completion.el a8c8a4e3680 ; * src/fns.c (Fcopy_sequence): Doc fix. (Bug#64960) 205d87cdca0 Fix unpacking ZIP archives on MS-Windows 3712e8bc385 ; Fix typos in lisp/keymap.el doc strings (bug#65329). 21b2ecee661 Fix command example in Eshell manual 26949819df0 ; lisp/progmodes/csharp-mode.el (treesit-query-capture): ... 221ed70b90a ; Improve documentation of 'define-alternatives' 32280205e27 Add user options mentioned in the Eshell manual to the va... cf3145a486b * Add missing alias to `native-comp-enable-subr-trampolin... 922b6490286 * Add missing alias to `native-comp-enable-subr-trampolin... 6962823c83c ; * etc/PROBLEMS: Fix typo and clarify wording. # Conflicts: # doc/misc/eshell.texi
| * Improve documentation of case transfer in replacement commandsEli Zaretskii2023-08-17
| | | | | | | | | | | | | | | | * doc/emacs/search.texi (Replacement and Lax Matches): * src/search.c (Freplace_match): * lisp/replace.el (query-replace, query-replace-regexp): Clarify in the doc string and the manual how letter-case is transferred from the replaced text to the replacement text. (Bug#65347)
* | Use BASE_EQ instead of EQ in search.cMattias Engdegård2023-07-21
| | | | | | | | | | * src/search.c (clear_regexp_cache, compile_pattern, Fmatch_data): Use BASE_EQ where appropriate.
* | Minor search_buffer cleanupBasil L. Contovounesios2023-07-08
|/ | | | | | | | * src/search.c: Move commentary that used to precede search_buffer to that location once more. Update it for the current arglist. (search_command, search_buffer_non_re, search_buffer): * src/lisp.h (search_buffer): Turn RE flag/argument from an int into a bool. All callers changed (bug#64049).
* (treesit_predicate_match): Match node text against regexp without consingDmitry Gutov2023-02-02
| | | | | | | | | | | | | | * src/treesit.c (treesit_predicate_match): Match node text against regexp without creating a new string object (bug#60953). * src/search.c (search_buffer): Make not static. Delete declaration near the beginning of the file. * src/lisp.h: Declare it here. * lisp/progmodes/ruby-ts-mode.el (ruby-ts--builtin-method-p): Remove function. (ruby-ts--font-lock-settings): Use the regexp with :match directly.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-01
|
* Merge remote-tracking branch 'savannah/master' into feature/tree-sitterYuan Fu2022-11-21
|\
| * Remove unused local in simple_searchPaul Eggert2022-11-01
| | | | | | | | * src/search.c (simple_search): Remove unused local.
| * Merge from origin/emacs-28Stefan Kangas2022-11-01
| |\ | | | | | | | | | | | | | | | | | | | | | | | | 1862df834c ; * src/search.c (Fmatch_data): Doc fix. 15fc5225b1 ; * lisp/whitespace.el (whitespace-trailing): Fix a typo. 9f3c896f7c ; * doc/emacs/text.texi (Quotation Marks): Typo fix. (Bug... # Conflicts: # src/search.c
| | * ; * src/search.c (Fmatch_data): Doc fix.Eli Zaretskii2022-10-30
| | |
* | | New function fast_c_string_match and fast_c_string_match_internalYuan Fu2022-11-09
|/ / | | | | | | | | | | | | | | | | | | | | Generalize fast_c_string_match_ignore_case into fast_c_string_match_internal. And Make fast_c_string and fast_c_string_match_ignore_case use fast_c_string_match_internal. * src/lisp.h (fast_c_string_match_internal) (fast_c_string_match): New declaration. (fast_c_string_match_ignore_case): Change to thin wrapper. * src/search.c (fast_c_string_match_internal): New function.
* | Improvements to long lines handling.Gregory Heytings2022-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h (struct buffer): New field 'long_line_optimizations_p'. * src/buffer.c (syms_of_buffer): New variable 'long-line-threshold'. (reset_buffer): Initialize the 'long_line_optimizations_p' field. (Fbuffer_swap_text): Handle it. * src/xdisp.c (redisplay_window): Set 'long_line_optimizations_p' when a buffer contains long lines. (init_iterator): Use 'long_line_optimizations_p'. (get_narrowed_begv): Update. (SET_WITH_NARROWED_BEGV): New macro. (unwind_narrowed_begv): New internal function used by the new macro. (back_to_previous_line_start, get_visually_first_element, move_it_vertically_backward): Use the new macro. * src/search.c (find_newline1): Make it externally visible. * src/lisp.h: Make 'find_newline1' externally visible. * src/dispextern.h (struct it): Update comment. Remove the 'WITH_NARROWED_BEGV' macro. * etc/NEWS: Mention the 'long-line-threshold' variable.
* | Prevent regexp cache entries from being GC'ed in more casesGerd Möllmann2022-06-27
| | | | | | | | | | | | * src/search.c (string_match_1, fast_string_match_internal) (fast_c_string_match_ignore_case): Use freeze_pattern. (Bug#56108)
* | Replace ptrdiff_t with new specpdl_ref type for specpdl referencesMattias Engdegård2022-02-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Clarify Fmatch_data doc stringLars Ingebrigtsen2022-01-29
| | | | | | | | | | * src/search.c (Fmatch_data): Note quirk about non-matching optional groups in the doc string (bug#29343).
* | Merge from origin/emacs-28Eli Zaretskii2022-01-01
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-01
| |
* | Make 'inhibit-changing-match-data' obsolete and adjust callersLars Ingebrigtsen2021-10-07
|/ | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/searching.texi (Regexp Search): (POSIX Regexps): Document this. * lisp/subr.el (inhibit-changing-match-data): Make obsolete. (looking-at-p): Adjust call. * lisp/vc/vc-hg.el (vc-hg--raw-dirstate-search): (vc-hg--ignore-patterns-ignored-p): (vc-hg--cached-dirstate-search): Don't use `inhibit-changing-match-data'. * src/minibuf.c (Ftry_completion): (Fall_completions): (Ftest_completion): Adjust Fstring_match calls. * src/search.c (looking_at_1): Pass in modify_data. (Flooking_at): Add optional inhibit-modify parameter. (string_match_1): Pass in modify_data. (Fstring_match): (Fposix_looking_at, Fposix_string_match): Add optional inhibit-modify parameter.
* Speed up `replace-match' slightlyLars Ingebrigtsen2021-09-22
| | | | | | | | | | | | | | * src/search.c (Freplace_match): Speed up non-literal (but actually literal) common case. This makes (benchmark-run 1000000 (replace-regexp-in-string "a+" "foo" "ogihdipofdhookfdohkfdpokhpokhfdpokfdhpokfdhkdfkhgoadfphokfkhpofdkhkdpokf")) about 10% faster.
* Adjust how `replace-match' runs modification hooksLars Ingebrigtsen2021-07-31
| | | | | | | | | | | | * src/editfns.c (Fsubst_char_in_region) (Ftranslate_region_internal): * src/cmds.c (internal_self_insert): Update callers. * src/insdel.c (replace_range): Allow inhibiting signal_after_change/update_compositions. * src/lisp.h: Update. * src/search.c (Freplace_match): Run the modification hooks at the end instead of before adjusting point (bug#42424).
* Remove unreliable test for match data clobberingNoam Postavsky2021-05-16
| | | | | | * src/search.c (Freplace_match): Don't test for change in search_regs start and end, this is unreliable if change hooks modify text earlier in the buffer (bug#35264).
* Update copyright year to 2021Paul Eggert2021-01-01
| | | | Run "TZ=UTC0 admin/update-copyright".
* Speed up match-substitute-replacementMattias Engdegård2020-12-04
| | | | | | * lisp/subr.el (match-substitute-replacement): Use match-data--translate. * src/search.c (Fmatch_data__translate): Remove string restriction. * test/lisp/subr-tests.el (subr-match-substitute-replacement): New test.
* Fix replace-regexp-in-string substring match data translationMattias Engdegård2020-11-26
| | | | | | | | | | | | | | | | | | | For certain patterns, re-matching the same regexp on the matched substring does not produce correctly translated match data (bug#15107 and bug#44861). Using a new builtin function also improves performance since the number of calls to string-match is halved. Reported by Kevin Ryde and Shigeru Fukaya. * lisp/subr.el (replace-regexp-in-string): Translate the match data using match-data--translate instead of trusting a call to string-match on the matched string to do the job. * test/lisp/subr-tests.el (subr-replace-regexp-in-string): Add test cases. * src/search.c (Fmatch_data__translate): New internal function. (syms_of_search): Register it as a subroutine.
* Fix a misleading comment in Freplace_matchLars Ingebrigtsen2020-10-18
| | | | | * src/search.c (Freplace_match): Fix a misleading comment (bug#42424).
* Prefer Fvector to make_uninit_vectorPaul Eggert2020-08-15
| | | | | | | | | | | | | | | | | | | | | | | | Fvector is less error-prone than make_uninit_vector, as it avoids the possibility of a GC crash due to an uninitialized vector. So prefer Fvector to make_uninit_vector when this is easy (and when there's no significant performance difference). Inspired by a suggestion by Pip Cet in: https://lists.gnu.org/r/emacs-devel/2020-08/msg00313.html * src/ccl.c (Fregister_ccl_program): * src/ccl.c (Fregister_ccl_program): * src/charset.c (Fdefine_charset_internal): * src/font.c (Fquery_font, Ffont_info, syms_of_font): * src/fontset.c (font_def_new, Fset_fontset_font): * src/ftfont.c (ftfont_shape_by_flt): * src/hbfont.c (hbfont_shape): * src/macfont.m (macfont_shape): * src/search.c (Fnewline_cache_check): * src/xfaces.c (Fx_family_fonts): * src/xfns.c (Fx_window_property_attributes): Prefer Fvector to make_uninit_vector when either is easy. * src/fontset.c (font_def_new): Now a function with one less arg instead of a do-while macro, and renamed from FONT_DEF_NEW. All uses changed.
* Fix GC bugs related to uninitialized vectorsPaul Eggert2020-08-15
| | | | | | | | | | | | | | | | | | | | | | Avoid problems if GC occurs while initializing a vector. Problem with Fdelete reported by Pip Cet in: https://lists.gnu.org/r/emacs-devel/2020-08/msg00313.html I looked for similar problems elsewhere and found quite a few. * src/coding.c (make_subsidiaries): * src/composite.c (syms_of_composite): * src/font.c (build_style_table, Ffont_get_glyphs): * src/nsselect.m (clean_local_selection_data): * src/nsxwidget.m (js_to_lisp): * src/syntax.c (init_syntax_once): * src/window.c (Fcurrent_window_configuration): * src/xselect.c (selection_data_to_lisp_data) (clean_local_selection_data): Use make_nil_vector instead of make_uninit_vector. * src/fns.c (Fdelete): * src/xwidget.c (webkit_js_to_lisp): Use allocate_nil_vector instead of allocate_vector. * src/search.c (Fnewline_cache_check): Use make_vector instead of make_uninit_vector.
* Simplify use of __lsan_ignore_objectPaul Eggert2020-08-03
| | | | | | | | | * configure.ac: Use AC_CHECK_FUNCS_ONCE for __lsan_ignore_object. * src/buffer.c, src/data.c, src/emacs-module.c, src/regex-emacs.c: * src/search.c: Use __lsan_ignore_object unconditionally, and don’t include sanitizer/lsan_interface.h. * src/lisp.h (__lsan_ignore_object): Provide a dummy in the typical case where leak sanitization is not available.
* Use a more precise check for '__lsan_ignore_object'Philipp Stephani2020-08-01
| | | | | | | | | | * configure.ac: Add check for __lsan_ignore_object. * src/buffer.c (enlarge_buffer_text): * src/data.c (make_blv): * src/emacs-module.c (Fmodule_load, initialize_environment): * src/regex-emacs.c (regex_compile): * src/search.c (newline_cache_on_off): Use new configuration macro.
* Suppress leak sanitizer in a few more placesPhilipp Stephani2020-08-01
| | | | | * src/regex-emacs.c (regex_compile): src/search.c (newline_cache_on_off): Suppress leak sanitizer.
* Improve accuracy of apropos commands that search doc stringsEli Zaretskii2020-05-03
| | | | | | | | | | | | | | | | | | It is conceptually wrong for apropos commands that search doc strings to look for matches of several words only on the same line, because division of doc strings between lines is ephemeral. * lisp/apropos.el (apropos-parse-pattern): Accept an optional argument MULTILINE-P, and if that is non-nil, produce regexps that match words in the list even if they are separated by line boundaries. (apropos-value, apropos-local-value, apropos-documentation): Use the new optional argument in apropos commands that search multiline text, such as doc strings. * src/search.c (Fposix_looking_at, Fposix_string_match) (Fposix_search_backward, Fposix_search_forward): Make sure Posix appears in the doc strings near REGEXP, for better matches.
* Prefer more inline functions in character.hPaul Eggert2020-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h (fetch_char_advance, fetch_char_advance_no_check) (buf_next_char_len, next_char_len, buf_prev_char_len) (prev_char_len, inc_both, dec_both): New inline functions, replacing the old character.h macros FETCH_CHAR_ADVANCE, FETCH_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS, INC_POS, BUF_DEC_POS, DEC_POS, INC_BOTH, DEC_BOTH respectively. All callers changed. These new functions all assume buffer primitives and so need to be here rather than in character.h. * src/casefiddle.c (make_char_unibyte): New static function, replacing the old MAKE_CHAR_UNIBYTE macro. All callers changed. (do_casify_unibyte_string): Use SINGLE_BYTE_CHAR_P instead of open-coding it. * src/ccl.c (GET_TRANSLATION_TABLE): New static function, replacing the old macro of the same name. * src/character.c (string_char): Omit 2nd arg. 3rd arg can no longer be NULL. All callers changed. * src/character.h (SINGLE_BYTE_CHAR_P): Move up. (MAKE_CHAR_UNIBYTE, MAKE_CHAR_MULTIBYTE, PREV_CHAR_BOUNDARY) (STRING_CHAR_AND_LENGTH, STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE) (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE) (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH) (DEC_BOTH, BUF_INC_POS, BUF_DEC_POS): Remove. (make_char_multibyte): New static function, replacing the old macro MAKE_CHAR_MULTIBYTE. All callers changed. (CHAR_STRING_ADVANCE): Remove; all callers changed to use CHAR_STRING. (NEXT_CHAR_BOUNDARY): Remove; it was unused. (raw_prev_char_len): New inline function, replacing the old PREV_CHAR_BOUNDARY macro. All callers changed. (string_char_and_length): New inline function, replacing the old STRING_CHAR_AND_LENGTH macro. All callers changed. (STRING_CHAR): Rewrite in terms of string_char_and_length. (string_char_advance): New inline function, replacing the old STRING_CHAR_ADVANCE macro. All callers changed. (fetch_string_char_advance): New inline function, replacing the old FETCH_STRING_CHAR_ADVANCE macro. All callers changed. (fetch_string_char_as_multibyte_advance): New inline function, replacing the old FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE macro. All callers changed. (fetch_string_char_advance_no_check): New inline function, replacing the old FETCH_STRING_CHAR_ADVANCE_NO_CHECK macro. All callers changed. * src/regex-emacs.c (HEAD_ADDR_VSTRING): Remove; no longer used. * src/syntax.c (scan_lists): Use dec_bytepos instead of open-coding it. * src/xdisp.c (string_char_and_length): Rename from string_char_and_length to avoid name conflict with new function in character.h. All callers changed.
* Improve integer range checkingPaul Eggert2020-04-05
| | | | | | | | | | | | | | | | | | * src/bignum.c (check_integer_range, check_uinteger_max) (check_int_nonnegative): New functions. * src/frame.c (check_frame_pixels): New function. (Fset_frame_height, Fset_frame_width, Fset_frame_size): Use it. * src/lisp.h (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER): Remove these macros. Unless otherwise specified, all callers replaced by calls to check_integer_range, check_uinteger_range, check_int_nonnegative. * src/frame.c (gui_set_right_divider_width) (gui_set_bottom_divider_width): * src/nsfns.m (ns_set_internal_border_width): * src/xfns.c (x_set_internal_border_width): Using check_int_nonnegative means these functions no longer incorrectly reject negative bignums; they treat them as 0, just like negative fixnums.
* Treat out-of-range positions consistentlyPaul Eggert2020-03-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a position argument to get-byte etc. is an out-of-range integer, treat it the same regardless of whether it is a fixnum or a bignum. * src/buffer.c (fix_position): New function. * src/buffer.c (validate_region): * src/character.c (Fget_byte): * src/coding.c (Ffind_coding_systems_region_internal) (Fcheck_coding_systems_region): * src/composite.c (Ffind_composition_internal): * src/editfns.c (Fposition_bytes, Fchar_after, Fchar_before) (Finsert_buffer_substring, Fcompare_buffer_substrings) (Fnarrow_to_region): * src/fns.c (Fsecure_hash_algorithms): * src/font.c (Finternal_char_font, Ffont_at): * src/fringe.c (Ffringe_bitmaps_at_pos): * src/search.c (search_command): * src/textprop.c (get_char_property_and_overlay): * src/window.c (Fpos_visible_in_window_p): * src/xdisp.c (Fwindow_text_pixel_size): Use it instead of CHECK_FIXNUM_COERCE_MARKER, so that the code is simpler and treats bignums consistently with fixnums. * src/buffer.h (CHECK_FIXNUM_COERCE_MARKER): Define here rather than in lisp.h, and reimplement in terms of fix_position so that it treats bignums consistently with fixnums. * src/lisp.h (CHECK_FIXNUM_COERCE_MARKER): Move to buffer.h. * src/textprop.c (validate_interval_range): Signal with original bounds rather than modified ones.
* Update copyright year to 2020Paul Eggert2020-01-01
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Allow regexp-quote to return its argumentMattias Engdegård2019-09-25
| | | | | | * src/search.c (Fregexp_quote): Only allocate a new string if needed. * doc/lispref/searching.texi (Regexp Functions): * etc/NEWS (Incompatible Lisp Changes): Document.
* Avoid crashes when casifying noncontiguous regionsPaul Eggert2019-09-22
| | | | | | | | | | | | | | | | | | | | This is a followon fix for Bug#37477. * lisp/simple.el (region-extract-function): Use setq here, since the var is now defined in C code. * src/casefiddle.c (casify_pnc_region): New function. (Fupcase_region, Fdowncase_region, Fcapitalize_region) (Fupcase_initials_region): Use it. (Fupcase_initials_region): Add region-noncontiguous-p flag for consistency with the others. All uses changed. (syms_of_casefiddle): Define Qbounds, Vregion_extract_function. * src/insdel.c (prepare_to_modify_buffer_1): * src/keyboard.c (command_loop_1): Use Vregion_extraction_function. * src/insdel.c (syms_of_insdel): No need to define Qregion_extract_function. * test/src/casefiddle-tests.el (casefiddle-oldfunc): New var. (casefiddle-loopfunc, casefiddle-badfunc): New functions. (casefiddle-invalid-region-extract-function): New test.
* Fix rare undefined behaviors in replace-matchPaul Eggert2019-08-03
| | | | | | | | | | | * src/search.c (Freplace_match): Simplify by caching search_regs components. Fix sanity check for out-of-range subscripts; it incorrectly allowed negative subscripts, subscripts equal to search_regs.num_regs, and it had undefined behavior for subscripts outside ptrdiff_t range. Improve wording of newly-introduced replace-match diagnostic. Rework use of opoint, to avoid setting point to an out-of-range value in rare cases involving modification hooks.
* Fix error message in replace-match for subexpressionsLars Ingebrigtsen2019-08-03
| | | | | * src/search.c (Freplace_match): Output a more understandable error message when replacing a subexpression (bug#19208).
* Clarify Freplace_match logicLars Ingebrigtsen2019-08-03
| | | | | * src/search.c (Freplace_match): Add some doc strings to clarify the logic and do a minor clean up (bug#19208).
* Don't bind search-spaces-regexp around possible autoload (Bug#35802)Noam Postavsky2019-06-25
| | | | | | | | | | | | | | | * lisp/isearch.el (isearch-search-fun-default): Move possible autoload trigger outside let-binding of search-spaces-regexp. * lisp/char-fold.el (char-fold-make-table): Remove no longer needed workaround. * lisp/info.el (Info-search-whitespace-regexp): * lisp/isearch.el (search-whitespace-regexp): * src/search.c (syms_of_search) <search-spaces-regexp>: Add warning about adding capturing groups to the value. * test/lisp/char-fold-tests.el: Remove, binding search-spaces-regexp to a different should be considered a bug.
* Merge from origin/emacs-26Glenn Morris2019-05-22
|\ | | | | | | | | | | | | | | 5d24af8 Remove from docs references to obsolete MULE variables 2bdc419 Do potentially destructive operations in prepare-commit-msg # Conflicts: # src/search.c