aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2026 to copyright years.Sean Whitton2026-01-011-1/+1
|
* December 2025 spelling fixesPaul Eggert2025-12-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the fixes are to continue to use American rather than British spelling. * doc/misc/modus-themes.org (my-modus-themes-engraved-faces): Fix misspelled ‘:foreground’s. * etc/themes/modus-themes.el (modus-themes-faces): Fix misspelled ‘modus-themes-bold’. * lisp/emacs-lisp/rx.el (rx--normalize-char-pattern): Rename from rx--normalise-char-pattern. (rx--optimize-or-args): Rename from rx--optimise-or-args. * lisp/frame.el (frame--special-parameters): Fix misspelled "right-divider-width". * lisp/net/tramp.el (tramp-fingerprint-prompt-regexp): Use American spelling “centered”, to match current libfprintf. * lisp/org/org-fold-core.el (org-fold-core--optimize-for-huge-buffers): Rename from org-fold-core--optimise-for-huge-buffers. (org-fold-core-update-optimization): Rename from org-fold-core-update-optimisation, leaving an alias behind. (org-fold-core-remove-optimization): Rename from org-fold-core-remove-optimisation, leaving an alias behind. * lisp/org/org.el (org-advertized-archive-subtree): This alias is now obsolete. * lisp/play/zone.el (zone-ignored-buffers): Fix misspelling of ‘zone--buffer-encrypted-p’. * lisp/progmodes/csharp-mode.el (csharp-ts-mode-faces): Fix misspelling of ‘csharp’ group. * lisp/vc/vc.el (vc-clonable-backends-custom-type): Rename from vc-cloneable-backends-custom-type, leaving an alias behind. * test/lisp/emacs-lisp/bytecomp-tests.el: (bytecomp-tests--warn-arity-non-compiled-callee): Rename from bytecomp-tests--warn-arity-noncompiled-callee. (bytecomp-test-defface-spec): Reword a deliberate misspelling of “default” that is so common I don’t want it to pollute the spelling dictionary. * test/lisp/emacs-lisp/package-vc-tests.el: (package-vc-tests-preserve-artifacts): Rename from package-vc-tests-preserve-artifacts. * test/lisp/eshell/em-prompt-tests.el: (em-prompt-test/forward-backward-paragraph-1): Reword a deliberate misspelling of “goodbye” that is so common I don’t want it to pollute the spelling dictionary.
* ; * src/editfns.c (styled_format): fix build for C99 compilersMattias Engdegård2025-12-221-1/+1
|
* Simplify new %b/%B code many years from nowPaul Eggert2025-12-221-1/+13
| | | | | | * src/editfns.c (styled_format): Do %b and %B with sprintf if sprintf is known to support them. This will let us simplify this code many years from now. (Bug#79990)
* Add binary format specifications '%b' and '%B'Jacob S. Gordon2025-12-221-12/+42
| | | | | | | | | | | | | | | | These produce the binary representation of a number. '%#b' and '%#B' prefix with '0b' and '0B', respectively. (bug#79990) * etc/NEWS: Announce change. * doc/lispref/strings.texi (Formatting Strings): Describe new format specs and add to comment on reconstructing the value with 'read'. * src/editfns.c (format): Update doc string. (styled_format): Add support for '%b' and '%B'. To remain portable, avoid use of 'sprintf' by converting by hand. * test/src/editfns-tests.el (format-binary-zero, format-binary-floats) (format-binary-nonzero-integers): Add tests. (read-large-integer): Add binary test cases. Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
* Remove binary-as-unsigned (bug#79990)Paul Eggert2025-12-211-25/+3
| | | | | | This experimental variable caused more trouble than it cured: it was rarely used, and when used it tended to be used incorrectly. * src/editfns.c (binary-as-unsigned): Remove. All uses removed.
* Improve handling of non-ASCII characters in 'transpose-regions'Jens Schmidt2025-12-201-62/+91
| | | | | | | | | | | * src/editfns.c (Ftranspose_regions): Separate code related to character semantics from that related to byte semantics and in that way leverage optimizations for regions of equal length with respect to both semantics. Move and update comments dating back to the initial implementation. * test/src/editfns-tests.el (editfns-tests--transpose-regions-tests) (editfns-tests--transpose-regions-markups) (editfns-tests--transpose-regions): New test and accompanying variables.
* Fix byte-vs-char length issue in 'transpose-regions'Jens Schmidt2025-12-201-7/+9
| | | | | | * src/editfns.c (Ftranspose_regions): Calculate length of range between regions both in units of bytes and characters and use these values as appropriate.
* ; Fix doc strings of the various 'insert-*' functionsEli Zaretskii2025-11-081-8/+13
| | | | | | | * src/editfns.c (Finsert_before_markers) (Finsert_and_inherit_before_markers, Finsert_char, Finsert_byte) (Finsert_buffer_substring): Clarify the effect on markers. (Bug#79692)
* Merge from origin/emacs-30Eli Zaretskii2025-10-111-2/+2
|\ | | | | | | | | | | | | | | 1895ba3ba3b ; Document %i format 85db0ac0d6e ; * doc/lispref/nonascii.texi (Explicit Encoding): Fix a ... c119a3600ed ; * doc/lispref/tips.texi (Documentation Tips): Document ... Also fix trailing whitespace in test files.
| * ; Document %i formatEli Zaretskii2025-10-111-2/+2
| | | | | | | | | | | | * src/editfns.c (Fformat): Doc fix. * doc/lispref/strings.texi (Formatting Strings): Document %i.
* | Merge from origin/emacs-30Eli Zaretskii2025-09-131-3/+3
|\ \ | |/ | | | | | | | | 47454566772 ; * lisp/dired-x.el (dired-find-subdir): Doc fix (bug#794... 0832e5fec56 ; * lisp/vc/vc.el (vc-print-root-log): Improve docstring ... 2fafcdbf6ac ; Minor copyedits in src/editfns.c
| * ; Minor copyedits in src/editfns.cEli Zaretskii2025-09-091-3/+3
| | | | | | | | | | | | * src/editfns.c (Fbuffer_string, Freplace_buffer_contents) (styled_format): Avoid using non-ASCII characters in doc strings and comments.
* | (Ftranspose_regions): Fix bug#76124Stefan Monnier2025-07-061-1/+3
| | | | | | | | | | | | | | * src/editfns.c (Ftranspose_regions): Be careful that ELisp code could move the gap from under our feet. * test/src/editfns-tests.el (editfns-tests--bug76124): New test.
* | Add line-column tracking for tree-sitterYuan Fu2025-05-031-6/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add line-column tracking for tree-sitter parsers. Copied from comments in treesit.c: Technically we had to send tree-sitter the line and column position of each edit. But in practice we just send it dummy values, because tree-sitter doesn't use it for parsing and mostly just carries the line and column positions around and return it when e.g. reporting node positions[1]. This has been working fine until we encountered grammars that actually utilizes the line and column information for parsing (Haskell)[2]. [1] https://github.com/tree-sitter/tree-sitter/issues/445 [2] https://github.com/tree-sitter/tree-sitter/issues/4001 So now we have to keep track of line and column positions and pass valid values to tree-sitter. (It adds quite some complexity, but only linearly; one can ignore all the linecol stuff when trying to understand treesit code and then come back to it later.) Eli convinced me to disable tracking by default, and only enable it for languages that needs it. So the buffer starts out not tracking linecol. And when a parser is created, if the language is in treesit-languages-require-line-column-tracking, we enable tracking in the buffer, and enable tracking for the parser. To simplify things, once a buffer starts tracking linecol, it never disables tracking, even if parsers that need tracking are all deleted; and for parsers, tracking is determined at creation time, if it starts out tracking/non-tracking, it stays that way, regardless of later changes to treesit-languages-require-line-column-tracking. To make calculating line/column positons fast, we store linecol caches for begv, point, and zv in the buffer (buf->ts_linecol_cache_xxx); and in the parser object, we store linecol cache for visible beg/end of that parser. In buffer editing functions, we need the linecol for start/old_end/new_end, those can be calculated by scanning newlines (treesit_linecol_of_pos) from the buffer point cache, which should be always near the point. And we usually set the calculated linecol of new_end back to the buffer point cache. We also need to calculate linecol for the visible_beg/end for each parser, and linecol for the buffer's begv/zv, these positions are usually far from point, so we have caches for all of them (in either the parser object or the buffer). These positions are far from point, so it's inefficient to scan newlines from point to there to get up-to-date linecol for them; but in the same time, because they're far and outside the changed region, we can calculate their change in line and column number by simply counting how much newlines are added/removed in the changed region (compute_new_linecol_by_change). * doc/lispref/parsing.texi (Using Parser): Mention line-column tracking in manual. * etc/NEWS: Add news. * lisp/treesit.el: (treesit-languages-need-line-column-tracking): New variable. * src/buffer.c: Include treesit.h (for TREESIT_EMPTY_LINECOL). (Fget_buffer_create): (Fmake_indirect_buffer): Initialize new buffer fields. (Fbuffer_swap_text): Add new buffer fields. * src/buffer.h (ts_linecol): New struct. (buffer): New buffer fields. (BUF_TS_LINECOL_BEGV): (BUF_TS_LINECOL_POINT): (BUF_TS_LINECOL_ZV): (SET_BUF_TS_LINECOL_BEGV): (SET_BUF_TS_LINECOL_POINT): (SET_BUF_TS_LINECOL_ZV): New inline functions. * src/casefiddle.c (casify_region): Record linecol info. * src/editfns.c (Fsubst_char_in_region): (Ftranslate_region_internal): (Ftranspose_regions): Record linecol info. * src/insdel.c (insert_1_both): (insert_from_string_1): (insert_from_gap_1): (insert_from_buffer): (replace_range): (del_range_2): Record linecol info. * src/treesit.c (TREESIT_BOB_LINECOL): (TREESIT_EMPTY_LINECOL): (TREESIT_TS_POINT_1_0): New constants. (treesit_debug_print_linecol): (treesit_buf_tracks_linecol_p): (restore_restriction_and_selective_display): (treesit_count_lines): (treesit_debug_validate_linecol): (treesit_linecol_of_pos): (treesit_make_ts_point): (Ftreesit_tracking_line_column_p): (Ftreesit_parser_tracking_line_column_p): New functions. (treesit_tree_edit_1): Accept real TSPoint and pass to tree-sitter. (compute_new_linecol_by_change): New function. (treesit_record_change_1): Rename from treesit_record_change, handle linecol if tracking is enabled. (treesit_linecol_maybe): New function. (treesit_record_change): New wrapper around treesit_record_change_1 that handles some boilerplate and sets buffer state. (treesit_sync_visible_region): Handle linecol if tracking is enabled. (make_treesit_parser): Setup parser's linecol cache if tracking is enabled. (Ftreesit_parser_create): Enable tracking if the parser's language requires it. (Ftreesit__linecol_at): (Ftreesit__linecol_cache_set): (Ftreesit__linecol_cache): New functions for debugging and testing. (syms_of_treesit): New variable Vtreesit_languages_require_line_column_tracking. * src/treesit.h (Lisp_TS_Parser): New fields. (TREESIT_BOB_LINECOL): (TREESIT_EMPTY_LINECOL): New constants. * test/src/treesit-tests.el (treesit-linecol-basic): (treesit-linecol-search-back-across-newline): (treesit-linecol-col-same-line): (treesit-linecol-enable-disable): New tests. * src/lisp.h: Declare display_count_lines. * src/xdisp.c (display_count_lines): Remove static keyword.
* | Update tree-sitter subroutine in Fsubst_char_in_regionYuan Fu2025-04-281-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some explanation: Fsubst_char_in_region used to have a branch, one branch path calls replace_range, one branch path modifies the buffer directly. replace_range already calls treesit_record_change within it, so we needed to make sure we only call treesit_record_change in the other branch path. After I added the call to treesit_record_change, some changes are made to Fsubst_char_in_region, and the branch was removed. So no wonder Stefan had the confusion and wrote the FIXME note. Now that the branch is gone, we can indeed call treesit_record_change in the end like signal_after_change. * src/editfns.c (Fsubst_char_in_region): Move to end.
* | Merge from savannah/emacs-30Yuan Fu2025-04-181-4/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | 01d4eb3dd42 ; Improve doc string of 'insert-char' 93ad8407ed8 * admin/notes/emba: Fix docker build instruction. b901290ae7f * doc/lispref/text.texi (Margins): Grammar fix. 16855c89dde Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/... 8792d3431b1 Backport: Fix tree-sitter tests on Emba # Conflicts: # test/infra/Dockerfile.emba
| * ; Improve doc string of 'insert-char'Eli Zaretskii2025-04-181-4/+9
| | | | | | | | | | * src/editfns.c (Finsert_char): Doc fix. Suggested by Lactose ‎ <lactose@allthingslinux.org> (bug#77889).
* | (Freplace_region_contents): Treat point as insert-before markerStefan Monnier2025-04-161-4/+5
| | | | | | | | | | | | | | | | | | | | | | Experience suggests that it's more often useful to keep point at the end of the replacement than it is to keep point at the beginning of the replacement. This also aligns the behavior of `replace-region-contents` with that of `insert`. * src/insdel.c (replace_range): Treat PT like an insert-before marker. * src/editfns.c (Freplace_region_contents): Adjust docstring accordingly.
* | ; * src/editfns.c (Freplace_region_contents): Doc fix (bug#76313).Eli Zaretskii2025-04-131-3/+7
| |
* | (replace-buffer-contents): Mark as obsolete, again.Stefan Monnier2025-04-121-1/+4
| | | | | | | | | | * lisp/subr.el (replace-buffer-contents): Mark as obsolete, again. * src/editfns.c (Freplace_region_contents): Add interactive form.
* | (Freplace_region_contents): Fix point preservation (bug#77607)Stefan Monnier2025-04-071-1/+1
| | | | | | | | | | | | * src/editfns.c (Freplace_region_contents): Save excursion around temporary restriction (bug#77607) and remove `record_unwind_protect_excursion` made redundant by commit 40d8650d5177.
* | Merge from origin/emacs-30Eli Zaretskii2025-04-051-0/+3
|\ \ | |/ | | | | | | 38fec86281e ; Improve the documentation of 'slice' display spec (bug#... 3f05b455f7e ; * src/editfns.c (Fmessage): Mention 'inhibit-message' (...
| * ; * src/editfns.c (Fmessage): Mention 'inhibit-message' (bug#77257).Eli Zaretskii2025-03-301-0/+3
| |
* | Pacify gcc -Wclobbered in Freplace_region_contentsPaul Eggert2025-04-021-4/+8
| | | | | | | | | | | | * src/editfns.c (Freplace_region_contents): Redo slightly to pacify gcc -Wclobbered, by hoisting the eassume out of SCHARS and into the caller later, where it’ll do more good anyway.
* | (replace-region-contents): Improve and promote (bug#76313)Stefan Monnier2025-03-291-48/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Swap the role of `replace-region-contents` and `replace-buffer-contents`, so `replace-region-contents` is the main function, implemented in C, and `replace-buffer-contents` is a mere wrapper (marked as obsolete). Also remove the need to rely on narrowing and on describing the new text as a function. Finally, allow MAX-SECS==0 to require a cheap replacement, and add an INHERIT argument. * src/editfns.c: Include `coding.h`. (Freplace_region_contents): Rename from `Freplace_buffer_contents`. Change calling convention to that of `replace-region-contents`. Add more options for the SOURCE argument. Add INHERIT argument. Skip the costly algorithm if MAX-SECS is 0. * src/insdel.c (replace_range): Allow NEW to be a buffer. * lisp/subr.el (replace-buffer-contents): New implementation. * lisp/emacs-lisp/subr-x.el (replace-region-contents): Delete. * doc/lispref/text.texi (Replacing): Document new API for `replace-region-contents`. Remove documentation of `replace-buffer-contents`. * test/src/editfns-tests.el (replace-buffer-contents-1) (replace-buffer-contents-2, replace-buffer-contents-bug31837): Use `replace-region-contents`. (editfns--replace-region): Delete. (editfns-tests--replace-region): Use `replace-region-contents`. Adds tests for new types of SOURCE args.
* | (Freplace_buffer_contents): Preserve markers more carefullyStefan Monnier2025-03-111-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Use `replace_range` rather than `delete+insert`. * src/insdel.c (replace_range): Allow NEW to specify a chunk of buffer text. * src/editfns.c (Freplace_buffer_contents): Use it. * test/src/editfns-tests.el (replace-buffer-contents-1): Remove incorrect check which happened to succeed because point was not preserved carefully enough. Make the replacement text share a bit more content to make the test a bit more strict. (editfns-tests--replace-region): Doesn't fail any more.
* | (replace_range): Delete argument `markers`Stefan Monnier2025-03-061-2/+2
| | | | | | | | | | | | | | | | * src/lisp.h (replace_range): * src/insdel.c (replace_range): Delete argument `markers`, always true. * src/editfns.c (Ftranslate_region_internal): * src/cmds.c (internal_self_insert): * src/search.c (Freplace_match): Adjust callers accordingly.
* | * test/src/editfns-tests.el (editfns--replace-region): New testStefan Monnier2025-02-281-0/+2
| | | | | | | | | | This test fails, sadly, because `replace-buffer-contents` is not careful enough to something like `replace_range`.
* | (Ftranspose_regions): Fix text-properties for len1==len2Stefan Monnier2025-02-231-140/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | When `len1_byte == len2_byte`, the code presumed that len1==len2 as well in its handling of text-properties. Fix that case. While at it, try and reduce code duplication by hoisting common code out of `if`s, and throw away the optimization for `len_mid == 0` which only saved 3 trivial function calls. * src/editfns.c (Ftranspose_regions): Shuffle the code a bit. * test/src/editfns-tests.el (editfns-tests--transpose-equal-but-not): New test.
* | (replace_range): Delete last arg, always the negation of the first boolStefan Monnier2025-02-181-3/+2
| | | | | | | | | | | | | | | | | | * src/insdel.c (replace_range): Merge last arg, with `prepare`. Rename `prepare` to `run-mode-hooks`. * src/lisp.h (replace_range): Adjust accordingly. * src/editfns.c (Ftranslate_region_internal): * src/cmds.c (internal_self_insert): * src/search.c (Freplace_match): Adjust callers.
* | * src/editfns.c (Fsubst_char_in_region): Delete left-over codeStefan Monnier2025-02-181-60/+5
| | | | | | | | This code was missed back in 2000 (commit 1b16afa45bb6).
* | Fix GC-related crashes in styled_format (bug#75754)Pip Cet2025-02-031-1/+2
| | | | | | | | | | | | | | | | | | This approach ensures we don't use an SSDATA pointer after GC, and that no Lisp callback code can modify the format string while we're working on it. * src/editfns.c (styled_format): Operate on a copy of the format string rather than the original. Ensure final NUL byte is copied.
* | Fix GC bug causing incorrect 'format' output (Bug#75754)Pip Cet2025-01-231-12/+13
| | | | | | | | | | | | | | | | This fixes the correctness bug discovered in bug#75754, but not the performance issue or excessive stack usage. * src/editfns.c (styled_format): Split 'info' array into two arrays, one of them allocated via SAFE_ALLOCA_LISP for GC protection.
* | Merge from origin/emacs-30Eli Zaretskii2025-01-041-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | 6468c3f7a74 Update doc string of 'insert' 6d8c3c0cbe4 Use `keymap*-set' over `global-set-key'/`define-key' in e... 4b2bb63b7ac Fix documentation and prompt in 'package-isolate' 55f43f5b220 ; Fix typo in treesit-explore-mode 921f454f508 Update fontification for attribute values in heex-ts-mode ae2589ea7a5 Add expression handling to heex-ts-mode 0cacf806391 ; * etc/NEWS: Document change of 'make-cursor-line-fully-... f47a29da5c4 * lisp/man.el (Man-mode): Improve docstring. # Conflicts: # etc/NEWS
| * Update doc string of 'insert'Ulrich Müller2025-01-041-2/+2
| | | | | | | | | | * src/editfns.c (Finsert): Mention 'decode-coding-string' instead of the obsolete 'string-as-multibyte' in doc string. (Bug#75345)
| * Update copyright year to 2025Stefan Kangas2025-01-021-1/+1
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | Update copyright year to 2025Paul Eggert2025-01-011-1/+1
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | Prefer static_assert to verifyStefan Kangas2024-08-221-2/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although static_assert is C11-specific, and Emacs remains on C99, it has been backported to older compilers by Gnulib. Gnulib has already changed to prefer static_assert, and we can do the same. * lib-src/asset-directory-tool.c (main_2): * src/alloc.c (BLOCK_ALIGN, aligned_alloc, lisp_align_malloc) (vectorlike_nbytes, allocate_pseudovector): * src/android.c (android_globalize_reference, android_set_dashes): * src/android.h: * src/androidfont.c (androidfont_draw, androidfont_text_extents): * src/androidvfs.c: * src/bidi.c (BIDI_CACHE_MAX_ELTS_PER_SLOT, bidi_find_bracket_pairs): * src/buffer.c (init_buffer_once): * src/casefiddle.c (do_casify_multibyte_string): * src/dispnew.c (scrolling_window, scrolling): * src/editfns.c (styled_format): * src/emacs-module.c (module_extract_big_integer): * src/fileio.c (Fdo_auto_save): * src/fns.c (next_almost_prime, hash_string): * src/fringe.c (init_fringe): * src/keyboard.h (kbd_buffer_store_event_hold): * src/keymap.c: * src/lisp.h (memclear, reduce_emacs_uint_to_hash_hash, modiff_incr): * src/lread.c (skip_lazy_string): * src/pdumper.c (dump_bignum, Fdump_emacs_portable) (dump_do_dump_relocation, pdumper_load): * src/process.c (make_process, Fmake_process, connect_network_socket): * src/regex-emacs.c: * src/sort.c (tim_sort): * src/sysdep.c (init_random, SSIZE_MAX): * src/thread.c: * src/timefns.c (trillion_factor): * src/unexelf.c: * src/xterm.c (x_send_scroll_bar_event): Prefer static_assert to Gnulib verify. Remove import of verify.h, except when used for other reasons.
* Port to certain Android environments with no GUIPo Lu2024-05-171-4/+3
| | | | | | | | | | * configure.ac (USER_FULL_NAME): Define to android_user_full_name only when a GUI system is being built. Otherwise, set to pw->pw_gecos or NULL consistently with the presence of pw->pw_gecos. * src/editfns.c (Fuser_full_name): Adjust to match. Accept NULL values from USER_FULL_NAME.
* Take fields into account during text conversionPo Lu2024-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cus-edit.el (Custom-mode): Enable text conversion, now that fields are correctly treated. * src/alloc.c (mark_frame): Mark f->conversion.field. * src/androidterm.c (android_update_selection): Adjust conversion region and selection position by the field start and end. * src/editfns.c (find_field): Export function. * src/frame.c (make_frame): Clear f->conversion.field. * src/frame.h (struct text_conversion_state) <field>: New field. * src/lisp.h (find_fields, reset_frame_conversion): Export functions. * src/minibuf.c (Fread_from_minibuffer): Reset frame conversion if Voverriding_text_conversion_style is set. * src/textconv.c (textconv_query): Narrow to field. (reset_frame_conversion): New function. (reset_frame_state): Clear conversion field. (really_delete_surrounding_text): Narrow to field. (locate_and_save_position_in_field): New function. (really_request_point_update, really_set_point_and_mark) (complete_edit_check, handle_pending_conversion_events_1) (handle_pending_conversion_events, get_conversion_field) (set_composing_region, textconv_set_point_and_mark, replace_text) (get_extracted_text, get_surrounding_text, report_point_change): Compute, narrow to and offset by the currently active field whenever point is updated or a command is received. (syms_of_textconv): Revise doc strings. * src/textconv.h (get_conversion_field): Export function.
* * src/editfns.c (Fget_pos_property): Fix thinko (bug#69358)Stefan Monnier2024-02-241-2/+5
|
* Prefer `ITREE_FOREACH` over `overlays_in`Stefan Monnier2024-02-051-56/+26
| | | | | | | | | | | | | | | | | | Use `ITREE_FOREACH` instead of `overlays_in` if that can save us from allocating an array. * src/buffer.c (overlays_in): Mark as static. (mouse_face_overlay_overlaps): Use `ITREE_FOREACH` instead of `overlays_in`. (disable_line_numbers_overlay_at_eob): Same, and also change return value to a boolean. * src/buffer.h (overlays_in): Don't declare. * src/editfns.c (overlays_around): Delete function. (Fget_pos_property): Use `ITREE_FOREACH` and keep the "best so far" instead of using `overlays_in` and sorting the elements. * src/lisp.h (disable_line_numbers_overlay_at_eob): Change return type to a boolean. * src/xdisp.c (should_produce_line_number): Adjust accordingly.
* Be more systematic about parens in C source codePaul Eggert2024-01-201-1/+1
| | | | | | | | | Be more systematic about putting space before paren in calls, and in avoiding unnecessary parentheses in macros. This was partly inspired by my wading through gcc -E output while debugging something else, and seeing too many parens. This patch does not change the generated .o files on my platform.
* Merge from origin/emacs-29Eli Zaretskii2024-01-201-1/+1
|\ | | | | | | | | | | | | | | | | | | | | 5bb5590dec9 Fix blunder in labeled_narrow_to_region 78ddb32fadb Fix documentation of icon-elements 725a3f32f8b ; Fix typos in symbol names 6653ee66ca5 Improve two docstrings in ox-latex 7d869a04029 Doc fix in auth-source-read-char-choice f149de223bf Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 1f97a878795 Fix info-xref-tests 51f391998b1 Add @kindex in manuals for existing keybindings on 'C-x x...
| * Fix blunder in labeled_narrow_to_regionGregory Heytings2024-01-141-1/+1
| | | | | | | | | | | | * src/editfns.c (labeled_narrow_to_region): Record point before, instead of after, calling narrow-to-region; otherwise point may already have been changed. Fixes bug#66764.
* | Revert "Add new `swap` macro and use it"Po Lu2024-01-061-5/+5
| | | | | | | | | | | | | | typeof is an extension which does not exist in Standard C, so macros using it are unsuitable for inclusion in Emacs. This reverts commit 37889523278fe65733938fb11c3701898309961c.
* | Add new `swap` macro and use itStefan Kangas2024-01-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A `swap` macro prevents programming errors and is more concise. It is a natural addition to our existing `min` and `max` macros. * src/lisp.h (swap): New macro. * lwlib/xlwmenu.c (draw_shadow_rectangle, draw_shadow_rhombus): * src/androidterm.c (android_get_surrounding_text): * src/buffer.c (Fmake_overlay, modify_overlay, Fmove_overlay): * src/dispnew.c (swap_glyphs_in_rows, reverse_rows): * src/editfns.c (Finsert_buffer_substring) (Fcompare_buffer_substrings): * src/eval.c (run_hook_wrapped_funcall): * src/fns.c (extract_data_from_object): * src/regex-emacs.c (forall_firstchar_1): * src/textconv.c (textconv_query, get_extracted_text) (get_surrounding_text): * src/textprop.c (validate_interval_range) (verify_interval_modification): * src/w32uniscribe.c (OTF_INT16_VAL): * src/xfaces.c (load_face_colors): * src/xterm.c (SWAPCARD32): Prefer using above macro to open-coding.
* | 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
| |