aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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
| |
* | Fix sloppy base64 acceptance of some multibyte charactersMattias Engdegård2021-12-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The base64 encoding functions incorrectly accepted some multibyte characters; stop doing that (bug#52670). * src/fns.c (base64_encode_1): Reject all multibyte characters. * test/src/fns-tests.el (fns-tests-base64-encode-string) (fns-test-base64url-encode-region) (fns-test-base64url-encode-string): Add tests. * doc/lispref/text.texi (Base 64): Rephrase outdated manual text. * etc/NEWS: Add a notice.
* | Merge from origin/emacs-28Glenn Morris2021-10-251-0/+3
|\ \ | |/ | | | | | | 817c929eda Doc fix for concat 3eca2ad2a1 * lisp/image-dired.el (image-dired-external-viewer): Suppo...
| * Doc fix for concatIhor Radchenko2021-10-241-0/+3
| | | | | | | | | | * src/fns.c (Fconcat): Note that composition values may not remain eq in return value of concat. (Bug#48740)
* | Make 'mapconcat' argument 'separator' optionalStefan Kangas2021-10-051-2/+6
|/ | | | | | | | | | | | * src/fns.c (Fmapconcat): Make third 'separator' argument optional. (Bug#50965) * doc/lispref/functions.texi (Mapping Functions): Update documentation for above change. * test/src/fns-tests.el (fns-tests-mapconcat): New test. * doc/misc/cl.texi (Obsolete Setf Customization): Don't use third mapconcat argument in example. * lisp/emacs-lisp/subr-x.el (string-join): Doc fix.
* Fix string-distance for two empty stringsPhilip Kaludercic2021-09-231-1/+1
| | | | | * fns.c (Fstring_distance): Avoid using uninitialized memory. * test/src/fns-tests.el (test-string-distance): Add test cases.
* Doc fix for y-or-n-p; trailing space is no longer neededStefan Kangas2021-09-161-2/+4
| | | | | | | | | | * doc/lispref/minibuf.texi (Yes-or-No Queries): * doc/lispref/os.texi (Suspending Emacs): * doc/lispref/tips.texi (Programming Tips): * doc/misc/gnus-faq.texi (FAQ 5-9): * lisp/subr.el (y-or-n-p): * src/fns.c (Fyes_or_no_p): Doc fix to reflect that a trailing space is no longer needed; one is added or removed automatically.
* ; Fix typosStefan Kangas2021-09-031-1/+1
|
* Improve documentation of 'assoc'Eli Zaretskii2021-08-181-1/+2
| | | | | * doc/lispref/lists.texi (Association Lists): * src/fns.c (Fassoc): Document how TESTFN is called. (Bug#50110)
* Fix Fdirectory_append check for whether strings have to be convertedLars Ingebrigtsen2021-07-241-10/+0
| | | | | | | | | | | * src/coding.c (string_ascii_p): Make it non-static. * src/fileio.c (Fdirectory_append): Fix check for whether we need to convert to multibyte. * src/fns.c (string_ascii_p): Remove copy. * src/lisp.h: Declare string_ascii_p.
* Fix final test for invalid base64url charsLars Ingebrigtsen2021-07-211-1/+1
| | | | | * src/fns.c (base64_decode_1): Fix test for invalid base64url (bug#45562). Noted by Andreas Schwab.
* Eliminate some GCC warningsMattias Engdegård2021-06-161-2/+3
| | | | | | | | | | * src/doprnt.c (exprintf, evxprintf): * src/lisp.h (exprintf, evxprintf): Don't use a pointer-to-const type for the `nonheapbuf` argument: although it is never dereferenced, GCC will warn when passing a pointer to uninitialised memory otherwise. * src/fns.c (sort_vector_copy, realize_face, realize_gui_face) (realize_tty_face): Use the same signatures in the prototypes as in the actual function definitions.
* Fix arg-out-of-range errors in 'line-number-at-pos'Eli Zaretskii2021-05-201-1/+1
| | | | | | | * src/fns.c (Fline_number_at_pos): Pass character position to args_out_of_range. Suggested by Andreas Schwab <schwab@linux-m68k.org>. Call args_out_of_range_3 to show both ends of the accessible portion.
* ; * src/fns.c (Fline_number_at_pos): Fix doc string and comments.Eli Zaretskii2021-05-201-7/+9
|
* Introduce `sxhash-equal-including-properties'.Andrea Corallo2021-04-211-9/+34
| | | | | | | * src/fns.c (collect_interval): Move it upwards. (Fsxhash_equal_including_properties): New function. (syms_of_fns): Register `sxhash-equal-including-properties'. * etc/NEWS: Add 'sxhash-equal-including-properties'.
* Clarify the doc string of plist-memeber and plist-putLars Ingebrigtsen2021-03-281-2/+8
| | | | | | * src/fns.c (Fplist_member): (Fplist_put): Clarify what comparison function is used for PROP (bug#47426) and don't claim that PROP has to be a symbol.
* Prevent open minibuffers getting lost when their frame gets deletedAlan Mackenzie2021-03-211-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This happened with minibuffer-follows-selected-frame set to t. * doc/emacs/mini.texi (Basic Minibuffer): State where a command's action takes place when a minibuffer's frame has been deleted. * lisp/window.el (window--before-delete-windows, record-window-buffer): Take into account that minibuffers are now recorded on w->prev_buffers field. * src/fns.c (merge_c): New version of `merge' taking a C function, rather than a Lisp function as the comparison function. * src/frame.c (do_switch_frame): Pass arguments sf and for_deletion to move_minibuffers_onnto_frame. * src/lisp.h (top level): Declare merge_c and move_minibuffers_onto_selected_frame. * src/minibuf.c (MB_frame): New Lisp_Object recording the minibuffer's frame. (choose_minibuf_frame): Remove all code except that which sets minibuf_window to the current frame's minibuffer. (minibuffer_ent_greater): New comparison function, passed to merge_c. (zip_minibuffer_stacks): New function. (move_minibuffers_onto_frame): Renamed from `move_minibuffer_onto_frame' given two arguments, the old frame and for_deletion, and simplified. Minibuffers are now stacked in the mini-window's ->prev_buffers field. (read_minibuf): Several detailed amendments. (exp_MB_frame): New Lisp_Object, the expired minibuffer's frame. (read_minibuf_unwind): Search for the expired minibuffer's frame, rather than taking it from (unreliable) variables. Switch temporarily to this frame for tidying up operations. (minibuffer_unwind): New function which pops a stacked minibuffer. (syms_of_minibuf): Call staticpro for the two new Lisp variables. * src/window.c (Fset_window_configuration): Don't record minibuffers with record-window-buffer. * src/xdisp.c (gui_consider_frame_title): Remove redundant Fselect_window, which caused an unwanted frame switch. Amend the arguments to format_mode_line_unwind_data to match.
* Update docstrings of 'delete'/'remove' to interlink each other (bug#47054)Juri Linkov2021-03-111-1/+2
| | | | | * lisp/subr.el (remove): Add xref to 'delete'. * src/fns.c (Fdelete): Add xref to 'remove'.
* * src/fns.c (Frandom): Handle bignum `limit`sStefan Monnier2021-03-051-1/+52
| | | | (ccall2, get_random_bignum): New functions.
* Fix documentation of a recent changeEli Zaretskii2021-02-251-7/+5
| | | | | | | | * src/fns.c (Fyes_or_no_p): Don't use braces around one-line block. (syms_of_fns) <use-short-answers>: Improve the wording of the doc string. * etc/NEWS: Improve wording of the entry about 'use-short-answers'.
* New variable 'use-short-answers' to use 'y-or-n-p' instead of 'yes-or-no-p'Juri Linkov2021-02-251-0/+14
| | | | | | | | | | * lisp/cus-start.el: Add use-short-answers. * lisp/emacs-lisp/map-ynp.el (read-answer): Handle use-short-answers. (read-answer-short): Add use-short-answers to docstring. * src/fns.c (Fyes_or_no_p): Call y-or-n-p if use_short_answers is true. (syms_of_fns): Add DEFVAR_BOOL use-short-answers (bug#46594).
* Fix count-lines problem in non-ASCII buffersLars Ingebrigtsen2021-02-091-1/+1
| | | | | * src/fns.c (Fline_number_at_pos): Get the correct start position in non-ASCII buffers (bug#22763).
* Allow Fline_number_at_pos being called with a markerLars Ingebrigtsen2021-02-071-1/+3
| | | | | * src/fns.c (Fline_number_at_pos): Also allow being called with a marker (since the Lisp function allowed that).
* Move line-number-at-pos to CLars Ingebrigtsen2021-02-071-9/+22
| | | | | | | | | | | | | * doc/lispref/positions.texi (Text Lines): Revert previous change. * lisp/simple.el (line-number-at-pos): Remove definition. * lisp/simple.el (count-lines): Revert back to using `forward-line', because there seems to be a disagreement on how lines should be counted in a region... * src/fns.c (Fline_number_at_pos): Rename from Fline_number_at_position and adjust parameter list.
* Add a new function 'line-number-at-position'Lars Ingebrigtsen2021-02-071-0/+18
| | | | | | | | | * doc/lispref/positions.texi (Text Lines): Document it. * lisp/simple.el (count-lines): Use it. (line-number-at-pos): Ditto. * src/fns.c (Fline_number_at_position): New function (bug#22763).
* * src/fns.c (hash_string): Fix bug#46111Stefan Monnier2021-01-281-19/+15
| | | | | Use `memcpy` instead of an unaligned memory access. On x86 at least, GCC turns this `memcpy` into a single `mov`, so it's about as fast.
* Add a new function 'buffer-line-statistics'Lars Ingebrigtsen2021-01-121-0/+85
| | | | * src/fns.c (Fbuffer_line_statistics): New function.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* ; Fix recent shortdoc.el and fns.c additionsBasil L. Contovounesios2020-12-271-1/+1
| | | | | * lisp/emacs-lisp/shortdoc.el (list): Fix typos. * src/fns.c (Flength_equal): Fix docstring.
* ; Fix the recent `length' doc string additionŠtěpán Němec2020-12-271-1/+1
|
* Fix up length_internal with degenerate length inputsLars Ingebrigtsen2020-12-271-2/+5
| | | | * src/fns.c (length_internal): Protect against edge conditions.
* Add new predicates for sequence lengthsLars Ingebrigtsen2020-12-271-1/+75
| | | | | | | | | | | | | * doc/lispref/sequences.texi (Sequence Functions): Document them. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Mark them as side-effect-free. * lisp/emacs-lisp/shortdoc.el (list): Mention them. * src/fns.c (Flength): Mention them in the doc string. (length_internal): New function. (Flength_less, Flength_greater, Flength_equal): New defuns. (syms_of_fns): Sym them.
* * src/fns.c (hash_string): Tweak the code furtherStefan Monnier2020-12-121-28/+24
| | | | | Merge the two main branches; remove the `max` test and thus reduce the "most steps" to 8 as written
* * src/fns.c (Fbuffer_hash): Doc fix. (Bug#45178)Stefan Kangas2020-12-111-1/+2
|
* Add new function `object-intervals'Lars Ingebrigtsen2020-12-111-0/+35
| | | | | | * doc/lispref/text.texi (Examining Properties): Document it. * src/fns.c (Fobject_intervals): New defun. (collect_interval): New function.
* * src/fns.c: Remove left over includeStefan Monnier2020-12-081-1/+0
|
* * src/fns.c (hash_string): Speed up on large stringsStefan Monnier2020-12-081-9/+32
|
* More string-search optimisationsMattias Engdegård2020-11-191-8/+15
| | | | | | | | | | | All-ASCII strings cannot have substrings with non-ASCII characters in them; use this fact to avoid searching entirely. * src/fns.c (Fstring_search): For multibyte non-ASCII needle and unibyte haystack, don't check if the haystack is all-ASCII; it's a waste of time. For multibyte non-ASCII needle and multibyte all-ASCII haystack, fail immediately. * test/src/fns-tests.el (string-search): Add more test cases.
* eql doc improvementsPaul Eggert2020-10-131-0/+1
| | | | | | | * doc/lispref/numbers.texi (Comparison of Numbers): Copy some useful text from eql help string. * src/fns.c (Feql): In doc string, say that eql also compares integers by value.
* Use the full name of the null byte/character, not its abbreviationAndreas Schwab2020-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | * lisp/subr.el (inhibit-nul-byte-detection): Make it an obsolete alias. * src/coding.c (setup_coding_system): Use original name. (detect_coding): Rename nul_byte_found => null_byte_found. (detect_coding_system): Use original name. Rename nul_byte_found => null_byte_found. (Fdefine_coding_system_internal): Use original name. (syms_of_coding): Rename inhibit-nul-byte-detection to inhibit-null-byte-detection. * src/w16select.c (get_clipboard_data): Rename nul_char to null_char. * src/json.c (check_string_without_embedded_nulls): Rename from check_string_without_embedded_nuls. (Fjson_parse_string): Adjust accordingly. * src/coding.h (enum define_coding_undecided_arg_index) (enum coding_attr_index): Rename ...nul_byte... to ...null_byte.... * lisp/info.el (info-insert-file-contents, Info-insert-dir): * lisp/international/mule.el (define-coding-system): * lisp/vc/vc-git.el (vc-git--call): * doc/lispref/nonascii.texi (Lisp and Coding Systems): Use original name.
* Minor string-search optimisations (bug#43598)Mattias Engdegård2020-09-271-32/+27
| | | | | | | * src/fns.c (Fstring_search): Perform cheap all-ASCII checks before more expensive ones. Use a faster loop when searching for non-ASCII non-raw bytes. * test/src/fns-tests.el (string-search): Add more test cases.
* Fix searching for multibyte needles in unibyte haystacksLars Ingebrigtsen2020-09-271-4/+41
| | | | | * src/fns.c (Fstring_search): Make this work better when searching unibyte haystacks for multibyte needles (bug#43598).
* Add tiny optimization for string-searchLars Ingebrigtsen2020-09-271-1/+7
| | | | | * src/fns.c (Fstring_search): Add tiny optimization for needles that are longer than the haystack (bug#43598).
* string-search robustness and documentation improvement (bug#43598)Mattias Engdegård2020-09-251-7/+13
| | | | | | | | * src/fns.c (Fstring_search): Check START-POS argument range. Simplify logic. Improve doc string. * test/src/fns-tests.el (string-search): Add test cases. * doc/lispref/strings.texi (Text Comparison): Elaborate. * lisp/emacs-lisp/byte-opt.el (pure-fns): Mark string-search as pure.
* Add a new function 'string-search'Lars Ingebrigtsen2020-09-251-0/+46
| | | | | * doc/lispref/strings.texi (Text Comparison): Document it. * src/fns.c (Fstring_search): New function.
* Fix recently-introduced Fdelete bugPaul Eggert2020-08-151-25/+4
| | | | | | | | | Problem reported by Pip Cet in: https://lists.gnu.org/r/emacs-devel/2020-08/msg00444.html * src/fns.c (Fdelete): Fix correctness bug via a simpler (though more memory-intensive) approach. It’s probably not worth optimizing the memory usage yere. * test/src/fns-tests.el (test-vector-delete): Add test for the bug.
* Minimize ‘equal’ calls in (delete x vector)Paul Eggert2020-08-151-9/+29
| | | | | | | | | * src/fns.c (Fdelete): When deleting from a vector, call Fequal only once per vector element. This is faster when Fequal is slow, and avoids the need to preinitialize the vector result. Finish when the result is exhausted, not when the input is exhausted; the two are equivalent but the former may be faster. * test/src/fns-tests.el (test-vector-delete): New test.
* Fdelete speed tweak for stringsPaul Eggert2020-08-151-2/+5
| | | | | * src/fns.c (Fdelete): Hoist FIXNUMP out of a loop, and turn it into CHARACTERP.
* Fix GC bugs related to uninitialized vectorsPaul Eggert2020-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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.