aboutsummaryrefslogtreecommitdiffstats
path: root/src (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-07-08Special-case symbol and fixnum keys in member, assoc and rassocMattias Engdegård1-0/+14
* src/fns.c (Fmember, Fassoc, Frassoc): Delegate to the cheaper Fmemq, Fassq and Frassq for arguments of the appropriate types. (eq_comparable_value): New function.
2020-07-07Avoid infloop in 'format-mode-line'Eli Zaretskii1-0/+16
* src/xdisp.c (decode_mode_spec): Don't use W->start if it is outside of the buffer's accessible region. (Bug#42220)
2020-06-29Fix undefined behavior in json.c (Bug#42113)Philipp Stephani1-0/+2
* src/json.c (lisp_to_json_toplevel_1, Fjson_parse_string): Check whether input strings are actually strings. * test/src/json-tests.el (json-parse-string/wrong-type) (json-serialize/wrong-hash-key-type): New regression tests.
2020-06-28MS-Windows fixes as followup to import of Gnulib 'getrandom'Eli Zaretskii2-15/+0
* nt/mingw-cfg.site (gl_cv_lib_assume_bcrypt): Set to "no" to disable linking against bcrypt.dll. (Bug#42095) * src/gnutls.c (gnutls_rnd) [WINDOWSNT]: Don't define a function pointer, and don't load it from GnuTLS DLL. (w32_gnutls_rnd) [WINDOWSNT]: Delete unused function. * src/fns.c (gnutls_rnd) [WINDOWSNT]: Don't redirect to w32_gnutls_rnd.
2020-06-28Add thread-naming support for OpenBSDTimo Myyrä1-0/+8
OpenBSD has pthread_set_name_np; FreeBSD appears to have both this call and pthread_setname_np (the latter call is used in preference). * configure.ac: Detect pthread_set_name_np. * sys/systhread.c: Include <pthread_np.h> and call pthread_set_name_np if available.
2020-06-27Use getrandom syscall for noncesPaul Eggert2-31/+16
* admin/merge-gnulib (GNULIB_MODULES): Add getrandom. * doc/lispref/text.texi (Format of GnuTLS Cryptography Inputs): Don’t say that iv-auto uses GNUTLS_RND_NONCE. Also, don’t say that it returns the IV’s actual value, as it never has done that. * src/fns.c, src/sysdep.c: Include sys/random.h, for getrandom. * src/fns.c (Fsecure_hash_algorithms): Use getrandom so that this function does not depend on HAVE_GNUTLS3. * src/sysdep.c: Do not include <gnutls/crypto.h>. (random_seed) [HAVE_LRAND48]: Can be long int now. (init_random) [!WINDOWSNT]: Use getrandom syscall instead of opening /dev/urandom, as this works even on GNU/Linux hosts that lack /dev/urandom. Don’t bother with gnutls_rnd as it’s not needed now that we have getrandom.
2020-06-27* src/keyboard.c (Fclear_this_command_keys): Doc fix.Eli Zaretskii1-1/+1
2020-06-26; * src/xdisp.c (pos_visible_p): Yet another minor fix for bug#42039.Eli Zaretskii1-4/+7
2020-06-26; * src/xdisp.c (pos_visible_p): Fix last change. (Bug#42039)Eli Zaretskii1-13/+4
2020-06-26Fix posn-at-point at beginning of a display stringEli Zaretskii1-4/+14
* src/xdisp.c (pos_visible_p): Account for the line-number width when the display string at CHARPOS ends in a newline. (Bug#42039)
2020-06-22Minor improvements as followup to recent RGB string-parsing changeEli Zaretskii1-41/+49
* src/xfaces.c (Finternal_color_values_from_color_spec): Rename to... (Fcolor_values_from_color_spec): ...this. Callers changed. Rename the argument to SPEC and improve the doc string. (parse_color_spec, parse_float_color_comp, parse_hex_color_comp): Improve commentary. (parse_color_spec): Rename the argument S to SPEC. * etc/NEWS: Mention 'color-values-from-color-spec'.
2020-06-21Consolidate #RGB string parsersMattias Engdegård5-230/+155
Use a single parser of color strings in the #RGB, rgb:R/G/B and rgbi:R/G/B formats, replacing four existing ones. Previously, error-checking was spotty, handling of the rgbi: format not always present, and normalization of the result was sometimes incorrect. * src/dispextern.h: New prototype. * src/xfaces.c (parse_hex_color_comp, parse_float_color_comp) (parse_color_spec, Finternal-color_values_from_color_spec): New functions. * test/src/xfaces-tests.el (xfaces-internal-color-values-from-color-spec): New test. * lisp/term/tty-colors.el (tty-color-standard-values): Use internal-color-values-from-color-spec, replacing old parser. * src/nsterm.m (ns_get_color): * src/w32fns.c (x_to_w32_color): * src/xterm.c (x_parse_color): Use parse_color_spec, replacing old parsers. (HEX_COLOR_NAME_LENGTH): Remove #define.
2020-06-20Add fallback for 24-bit terminal color via COLORTERM=truecolorJan Beich1-0/+9
* src/term.c (init_tty): When COLORTERM=truecolor is defined, override setaf/setab/colors terminfo capabilities with 24-bit color support. * doc/misc/efaq.texi (Colors on a TTY): Mention the possibility to enable 24-bit color via the COLORTERM environment variable. (Bug#41846) Copyright-paperwork-exempt: yes
2020-06-20Avoid crashes in 'defconst'Stephen Berman1-0/+1
* src/eval.c (Fdefconst): Verify that SYMBOL is a known symbol. (Bug#41817)
2020-06-18Check AREF and aref_addr subscriptsPaul Eggert1-7/+9
* src/lisp.h (gc_asize): Move before first use. (AREF, aref_addr): Check subscripts. Co-authored-by: Tino Calancha <tino.calancha@gmail.com>
2020-06-08More robust NS hex colour string parsingMattias Engdegård1-9/+12
Invalid arguments to color-values, such as "#abcdefg" or "#1234", or valid ones like "#111222333", should not yield nonsense values. * src/nsterm.m (ns_get_color): Only accept "#RGB" strings with 1-4 digits per components, equal number of digits each, and no trailing characters. Parse 12-bit colours correctly.
2020-06-07Use 65535 as color-values scale value in the NS backendMattias Engdegård1-2/+2
* src/nsfns.m (Fxw_color_values): Scale with 65535 instead of 65280, for uniformity with other backends. * lisp/faces.el (color-values): Update doc string. * doc/lispref/frames.texi (Color Names): Update examples.
2020-06-06* src/xdisp.c (Fwindow_text_pixel_size): Doc fix. (Bug#41737)Eli Zaretskii1-25/+35
2020-06-05Avoid zero-width glyphs and the resulting cursor artifactsPip Cet1-7/+26
* src/xdisp.c (fill_gstring_glyph_string): Handle unavailable glyphs. (append_composite_glyph): Mark unavailable glyphs. (gui_produce_glyphs): Make glyphs unavailable for zero-width compositions. (Bug#41645)
2020-06-05Fix Arabic shaping when eww/shr fill the text to be renderedEli Zaretskii1-1/+6
* src/hbfont.c (hbfont_shape): Don't use DIRECTION if the current buffer has bidi reordering disabled. (Bug#41005)
2020-06-04Streamline live_*_holdingPaul Eggert1-124/+148
(live_string_holding, live_cons_holding, live_symbol_holding) (live_float_p, live_vector_holding): Assert that m->type is correct, instead of testing this at runtime. All callers changed. (live_large_vector_holding, live_small_vector_holding): Now two functions instead of the old live_vector_holding. All callers changed. (live_large_vector_p, live_small_vector_p): Now two functions instead of the old live_vector_p. All callers changed. (mark_maybe_object): Ignore Lisp_Type_Unused0 quickly too, since that cannot possibly be an object. (CHECK_LIVE, CHECK_ALLOCATED_AND_LIVE): New arg MEM_TYPE. All callers changed. (CHECK_ALLOCATED_AND_LIVE_SYMBOL): Simplify by combining GC_CHECK_MARKED_OBJECTS code.
2020-06-04Make live_*_p more accuratePaul Eggert1-40/+60
* src/alloc.c (live_string_holding, live_cons_holding) (live_symbol_holding, live_vector_holding): Return a C pointer, not a Lisp_Object. All callers changed. This helps the compiler a bit. (live_string_p, live_cons_p, live_symbol_p, live_vector_p): Require that P point directly at the object, rather than somewhere within the object. This fixes some false positives with valid_lisp_object_p (used only in debugging). (mark_maybe_object): Rely on the new accuracy.
2020-06-03Don’t default to Valgrind unless ENABLE_CHECKINGPaul Eggert1-2/+3
* src/alloc.c (USE_VALGRIND): If not defined, don’t default it to 1 unless ENABLE_CHECKING. The Valgrind hooks bloat the garbage collector a bit in production, and there’s no need for them these days if one has a Valgrind suppressions file (which one needs anyway). (mark_maybe_pointer): Use ‘#if USE_VALGRIND’ instead of ‘#ifdef USE_VALGRIND’ for consistency with other uses of USE_VALGRIND. This is in case someone builds with ‘-DENABLE_CHECKING -DUSE_VALGRIND=0’ in CFLAGS.
2020-06-03Make color-distance symmetric and more accurateMattias Engdegård1-11/+13
* src/xfaces.c (color_distance): Don't throw away the low 8 bits of the colours, and make the function symmetric (bug41544) (Fcolor_distance): Add caution about this not being a true metric. * test/src/xfaces-tests.el: New file.
2020-06-03Handle mid-gstring face changesPip Cet1-0/+1
* src/xdisp.c (fill_gstring_glyph_string): Don't extend the glyph string past face changes. (Bug#41454)
2020-06-02Fix bug in recent byte-code checking hoistPaul Eggert1-10/+11
Problem reported by Daniel Colascione (Bug#41680). * src/lread.c (read1): Check that AREF (tmp, COMPILED_BYTECODE) is a string before subjecting it to STRING_MULTIBYTE. Be more consistent about using AREF in the neighborhood, to help prevent this sort of problem from recurring.
2020-06-02Avoid losing composition state in handle_stop_backwardsPip Cet1-0/+2
* src/xdisp.c (handle_stop_backwards): Save composition iterator state across our forward scan. (Bug#41626)
2020-06-02; * src/composite.c (syms_of_composite): Fix last change.Eli Zaretskii1-1/+2
2020-06-02Fix Arabic composition rulesEli Zaretskii1-1/+2
* lisp/language/misc-lang.el (composition-function-table): Reorder Arabic composition rules in descending order of lookback. * src/composite.c (syms_of_composite): Document the order of rules in 'composition-function-table'.
2020-06-01Simplify and regularize some offset tests in alloc.cPaul Eggert1-5/+4
* src/alloc.c (live_string_holding, live_cons_holding) (live_symbol_holding, live_float_p): Simplify and regularize.
2020-06-01Don't call 'mbrtowc' on WINDOWSNTEli Zaretskii1-1/+4
* src/emacs.c (using_utf8): Don't call 'mbrtowc' on WINDOWSNT systems, as it's not available on Windows 9X.
2020-05-31Be more aggressive in marking objects during GCPaul Eggert1-16/+10
Simplified version of a patch from Pip Cet (Bug#41321#299). * src/alloc.c (maybe_lisp_pointer): Remove. All uses removed. (mark_memory): Also look at the pointer offset by ‘lispsym’, for symbols.
2020-05-31Unbreak compilation with CHECK_STRUCTS defined.Philipp Stephani1-1/+1
* src/pdumper.c (dump_float): Update hash value after commit 9f7bfb6cb06f1480a0904184cabf187e03628e55. The struct layout is still compatible.
2020-05-31; * src/xdisp.c (find_last_unchanged_at_beg_row): Fix a typo.Eli Zaretskii1-1/+1
2020-05-31Protect bidi cache from inadvertent resetsEli Zaretskii1-0/+4
* src/xdisp.c (Fline_pixel_height, Fmove_point_visually): Save and restore the bidi cache, to avoid inadvertently resetting it by starting a new iteration through buffer text. This could cause trouble if these functions are called during a redisplay cycle, especially while we were processing RTL text.
2020-05-31Avoid crashes due to bidi cache being reset during redisplayEli Zaretskii1-0/+2
If automatic character composition triggers GC, and 'garbage-collection-messages' are turned on, we could have the bidi cache reset while processing RTL text, which would then consistently crash. * src/xdisp.c (display_echo_area_1): Protect the bidi cache against changes inside 'try_window'.
2020-05-30Remove private prototype for 'execve' and its uses in MinGW buildEli Zaretskii1-0/+3
* src/sysdep.c (emacs_exec_file): Don't compile this function anymore on WINDOWSNT, since it is not used there. This function was the only reason for having 'execve' prototype in ms-w32.h. * nt/inc/ms-w32.h (execve): Remove prototype and the MinGW64 vs ming.org mess that it causes.
2020-05-29Another fix of display of line-prefix with fringe bitmapsEli Zaretskii1-0/+6
* src/xdisp.c (redisplay_internal): Don't use "optimization 1" if a glyph row from which to start display begins with a display property that draws into the fringes. (Bug#41584)
2020-05-29Fix display of line-prefix with fringe bitmapsEli Zaretskii1-0/+6
* src/xdisp.c (try_window_id): Don't use this optimization if a glyph row from which to start display begins with a display property that draws into the fringes. (Bug#41584)
2020-05-28Document that {en,de}code-coding-string preserve match dataMattias Engdegård1-2/+2
* lisp/international/mule.el (define-coding-system): Require :pre-write-conversion and :post-read-conversion functions to leave the match data untouched. * src/coding.c (Fdecode_coding_string, Fencode_coding_string): Document functions as match-data-preserving. Suggested by Stefan Monnier (see bug#41445).
2020-05-27Fix crash with invalid bytecode vectorsPaul Eggert1-0/+4
* src/lread.c (read_vector): If the vector is to short to be for bytecodes don’t do bytecode processing for it, as the processing might run past the end of the vector.
2020-05-27--with-wide-int is a no-op on 64-bit hostsPaul Eggert1-1/+1
* configure.ac: Clarify wording for --with-wide-int help. * src/pdumper.c (dump_vectorlike_generic): Do the eassert even if --with-wide-int was specified unnecessarily.
2020-05-27Omit unnecessary USE_LAB_TAG #ifPaul Eggert1-6/+0
* src/lisp.h: Omit unnecessary #if; the condition is always false now.
2020-05-26Tweak GC performance if !USE_LSB_TAGPaul Eggert1-2/+19
Performance issue reported by Eli Zaretskii (Bug#41321#149). * src/alloc.c (GC_OBJECT_ALIGNMENT_MINIMUM): New constant. (maybe_lisp_pointer): Use it instead of GCALIGNMENT.
2020-05-26Port struct Lisp_FLoat to oddball platformsPaul Eggert1-1/+3
* src/lisp.h (struct Lisp_Float): Declare via GCALIGNED_UNION_MEMBER, not via GCALIGNED_STRUCT, since alloc.c creates these in arrays and GCALIGNED_STRUCT does not necessarily suffice to align struct Lisp_Float when it’s used in an array. This avoids undefined behavior on oddball machines where sizeof (struct Lisp_Float) is not a multiple of 8 and the compiler does not support __attribute__ ((aligned 8)).
2020-05-25Move union emacs_align_type to alloc.cPaul Eggert2-41/+41
* src/alloc.c (union emacs_align_type): Move to here ... * src/lisp.h: ... from here, and uncomment out some of the types that alloc.c can see but lisp.h cannot.
2020-05-25Further fix for aborts due to GC losing pseudovectorsPaul Eggert2-19/+58
* src/alloc.c (MALLOC_ALIGNMENT_BOUND): Remove. (LISP_ALIGNMENT): Go back to yesterday’s version, except use union emacs_align_type instead of max_align_t. (MALLOC_IS_LISP_ALIGNED): Go back to yesterday’s version. (maybe_lisp_pointer): Check against GCALIGNMENT, not LISP_ALIGNMENT. * src/lisp.h (union emacs_align_type): Bring back.
2020-05-25Refix aborts due to GC losing pseudovectorsPaul Eggert2-61/+14
This is simpler, and fixes a bug in the previous fix. * src/alloc.c (MALLOC_ALIGNMENT_BOUND): Simplify by using max_align_t, since the buggy implementations won’t break this simpler implementation. (LISP_ALIGNMENT): Simplify by just using GCALIGNMENT, since the fancier implementation wasn’t correct anyway, and fixing it isn’t worth the trouble on practical platforms. * src/lisp.h (union emacs_align_type): Remove.
2020-05-25Fix aborts due to GC losing pseudovectorsPaul Eggert3-29/+78
Problem reported by Eli Zaretskii (Bug#41321). * src/alloc.c (MALLOC_ALIGNMENT_BOUND): New constant. (LISP_ALIGNMENT): Lower it to avoid crashes on MinGW and similarly buggy platforms where malloc returns pointers not aligned to alignof (max_align_t). But keep it higher on platforms where this is known to work, as it helps GC performance. (MALLOC_IS_LISP_ALIGNED): Define in terms of the other two. * src/alloc.c (stacktop_sentry): * src/thread.c (run_thread): Don’t overalign or oversize stack sentries; they need to be aligned only for pointers and Lisp_Object, not for arbitrary pseudovector contents. * src/lisp.h (union emacs_align_type): New type, used for LISP_ALIGNMENT.
2020-05-25Fix access to single-byte characters in buffer textEli Zaretskii2-5/+5
* src/xdisp.c (get_visually_first_element) (Fbidi_find_overridden_directionality): * src/cmds.c (Fend_of_line): Use FETCH_BYTE instead of FETCH_CHAR, and byte position instead of character position, to access individual bytes of buffer text. This avoids producing invalid characters and accessing wrong buffer positions. (Bug#41520)