diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/alloc.c | 10 | ||||
-rw-r--r-- | src/buffer.c | 4 | ||||
-rw-r--r-- | src/composite.c | 15 | ||||
-rw-r--r-- | src/conf_post.h | 2 | ||||
-rw-r--r-- | src/data.c | 2 | ||||
-rw-r--r-- | src/editfns.c | 11 | ||||
-rw-r--r-- | src/fileio.c | 2 | ||||
-rw-r--r-- | src/gnutls.c | 32 | ||||
-rw-r--r-- | src/image.c | 61 | ||||
-rw-r--r-- | src/indent.c | 27 | ||||
-rw-r--r-- | src/msdos.c | 2 | ||||
-rw-r--r-- | src/msdos.h | 3 | ||||
-rw-r--r-- | src/nsterm.m | 22 | ||||
-rw-r--r-- | src/process.c | 13 | ||||
-rw-r--r-- | src/sysdep.c | 3 | ||||
-rw-r--r-- | src/sysselect.h | 5 | ||||
-rw-r--r-- | src/systhread.c | 7 | ||||
-rw-r--r-- | src/thread.c | 4 | ||||
-rw-r--r-- | src/thread.h | 4 | ||||
-rw-r--r-- | src/w32fns.c | 5 | ||||
-rw-r--r-- | src/w32term.h | 15 | ||||
-rw-r--r-- | src/xdisp.c | 57 |
22 files changed, 220 insertions, 86 deletions
diff --git a/src/alloc.c b/src/alloc.c index 2e6399e7f8d..da0c3ad4b3e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2923,9 +2923,13 @@ set_next_vector (struct Lisp_Vector *v, struct Lisp_Vector *p) enum { - /* Alignment of struct Lisp_Vector objects. */ - vector_alignment = COMMON_MULTIPLE (FLEXALIGNOF (struct Lisp_Vector), - GCALIGNMENT), + /* Alignment of struct Lisp_Vector objects. Because pseudovectors + can contain any C type, align at least as strictly as + max_align_t. On x86 and x86-64 this can waste up to 8 bytes + for typical vectors, since alignof (max_align_t) is 16 but + typical vectors need only an alignment of 8. However, it is + not worth the hassle to avoid wasting those bytes. */ + vector_alignment = COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT), /* Vector size requests are a multiple of this. */ roundup_size = COMMON_MULTIPLE (vector_alignment, word_size) diff --git a/src/buffer.c b/src/buffer.c index cc6021bfb5d..1c8b4635086 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -3616,8 +3616,8 @@ void fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end) { Lisp_Object overlay; - struct Lisp_Overlay *before_list; - struct Lisp_Overlay *after_list; + struct Lisp_Overlay *before_list UNINIT; + struct Lisp_Overlay *after_list UNINIT; /* These are either nil, indicating that before_list or after_list should be assigned, or the cons cell the cdr of which should be assigned. */ diff --git a/src/composite.c b/src/composite.c index c01e2e3b95c..650bf8708b3 100644 --- a/src/composite.c +++ b/src/composite.c @@ -686,6 +686,20 @@ composition_gstring_from_id (ptrdiff_t id) return HASH_VALUE (h, id); } +DEFUN ("clear-composition-cache", Fclear_composition_cache, + Sclear_composition_cache, 0, 0, 0, + doc: /* Internal use only. +Clear composition cache. */) + (void) +{ + Lisp_Object args[] = {QCtest, Qequal, QCsize, make_number (311)}; + gstring_hash_table = CALLMANY (Fmake_hash_table, args); + /* Fixme: We call Fclear_face_cache to force complete re-building of + display glyphs. But, it may be better to call this function from + Fclear_face_cache instead. */ + return Fclear_face_cache (Qt); +} + bool composition_gstring_p (Lisp_Object gstring) { @@ -1982,4 +1996,5 @@ See also the documentation of `auto-composition-mode'. */); defsubr (&Scompose_string_internal); defsubr (&Sfind_composition_internal); defsubr (&Scomposition_get_gstring); + defsubr (&Sclear_composition_cache); } diff --git a/src/conf_post.h b/src/conf_post.h index febdb8b8bf7..4c9eb32aba3 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -31,7 +31,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <stdbool.h> -#if defined DOS_NT && !defined DEFER_MS_W32_H +#if defined WINDOWSNT && !defined DEFER_MS_W32_H # include <ms-w32.h> #endif diff --git a/src/data.c b/src/data.c index 2e7f3e017be..00d1eb43033 100644 --- a/src/data.c +++ b/src/data.c @@ -1888,7 +1888,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) (Lisp_Object variable) { Lisp_Object tem; - bool forwarded; + bool forwarded UNINIT; union Lisp_Val_Fwd valcontents; struct Lisp_Symbol *sym; struct Lisp_Buffer_Local_Value *blv = NULL; diff --git a/src/editfns.c b/src/editfns.c index c00457b0a5c..47ff2a5cbfd 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2038,11 +2038,11 @@ by text that describes the specified date and time in TIME: only blank-padded, %l is like %I blank-padded. %p is the locale's equivalent of either AM or PM. %q is the calendar quarter (1–4). -%M is the minute. -%S is the second. -%N is the nanosecond, %6N the microsecond, %3N the millisecond, etc. -%Z is the time zone name, %z is the numeric form. +%M is the minute (00-59). +%S is the second (00-59; 00-60 on platforms with leap seconds) %s is the number of seconds since 1970-01-01 00:00:00 +0000. +%N is the nanosecond, %6N the microsecond, %3N the millisecond, etc. +%Z is the time zone abbreviation, %z is the numeric form. %c is the locale's date and time format. %x is the locale's "preferred" date format. @@ -2052,7 +2052,8 @@ by text that describes the specified date and time in TIME: %R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p". %X is the locale's "preferred" time format. -Finally, %n is a newline, %t is a tab, %% is a literal %. +Finally, %n is a newline, %t is a tab, %% is a literal %, and +unrecognized %-sequences stand for themselves. Certain flags and modifiers are available with some format controls. The flags are `_', `-', `^' and `#'. For certain characters X, diff --git a/src/fileio.c b/src/fileio.c index ca21b0a115a..ac520c2328e 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2297,7 +2297,7 @@ This is what happens in interactive use with M-x. */) bool plain_rename = (case_only_rename || (!NILP (ok_if_already_exists) && !INTEGERP (ok_if_already_exists))); - int rename_errno; + int rename_errno UNINIT; if (!plain_rename) { if (renameat_noreplace (AT_FDCWD, SSDATA (encoded_file), diff --git a/src/gnutls.c b/src/gnutls.c index b55d1b9289f..36f65c4acb3 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -26,7 +26,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include "coding.h" #include "buffer.h" -#if 0x030014 <= GNUTLS_VERSION_NUMBER +#if GNUTLS_VERSION_NUMBER >= 0x030014 # define HAVE_GNUTLS_X509_SYSTEM_TRUST #endif @@ -36,10 +36,16 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ The relevant fix seems to have been made in GnuTLS 3.5.1; see: https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d So, require 3.5.1. */ -#if 0x030501 <= GNUTLS_VERSION_NUMBER +#if GNUTLS_VERSION_NUMBER >= 0x030501 # define HAVE_GNUTLS_AEAD #endif +/* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was + exported only since 3.3.0. */ +#if GNUTLS_VERSION_NUMBER >= 0x030300 +# define HAVE_GNUTLS_MAC_GET_NONCE_SIZE +#endif + #ifdef HAVE_GNUTLS # ifdef WINDOWSNT @@ -187,7 +193,9 @@ DEF_DLL_FN (const char *, gnutls_mac_get_name, (gnutls_mac_algorithm_t)); # ifdef HAVE_GNUTLS3 DEF_DLL_FN (int, gnutls_rnd, (gnutls_rnd_level_t, void *, size_t)); DEF_DLL_FN (const gnutls_mac_algorithm_t *, gnutls_mac_list, (void)); +# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE DEF_DLL_FN (size_t, gnutls_mac_get_nonce_size, (gnutls_mac_algorithm_t)); +# endif DEF_DLL_FN (size_t, gnutls_mac_get_key_size, (gnutls_mac_algorithm_t)); DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void)); DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t)); @@ -316,7 +324,9 @@ init_gnutls_functions (void) # ifdef HAVE_GNUTLS3 LOAD_DLL_FN (library, gnutls_rnd); LOAD_DLL_FN (library, gnutls_mac_list); +# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE LOAD_DLL_FN (library, gnutls_mac_get_nonce_size); +# endif LOAD_DLL_FN (library, gnutls_mac_get_key_size); LOAD_DLL_FN (library, gnutls_digest_list); LOAD_DLL_FN (library, gnutls_digest_get_name); @@ -427,7 +437,9 @@ init_gnutls_functions (void) # ifdef HAVE_GNUTLS3 # define gnutls_rnd fn_gnutls_rnd # define gnutls_mac_list fn_gnutls_mac_list -# define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size +# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE +# define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size +# endif # define gnutls_mac_get_key_size fn_gnutls_mac_get_key_size # define gnutls_digest_list fn_gnutls_digest_list # define gnutls_digest_get_name fn_gnutls_digest_get_name @@ -442,10 +454,10 @@ init_gnutls_functions (void) # define gnutls_cipher_decrypt2 fn_gnutls_cipher_decrypt2 # define gnutls_cipher_deinit fn_gnutls_cipher_deinit # ifdef HAVE_GNUTLS_AEAD -# define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt -# define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt -# define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init -# define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit +# define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt +# define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt +# define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init +# define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit # endif # define gnutls_hmac_init fn_gnutls_hmac_init # define gnutls_hmac_get_len fn_gnutls_hmac_get_len @@ -2178,6 +2190,10 @@ name. */) /* A symbol representing the GnuTLS MAC algorithm. */ Lisp_Object gma_symbol = intern (gnutls_mac_get_name (gma)); + size_t nonce_size = 0; +#ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE + nonce_size = gnutls_mac_get_nonce_size (gma); +#endif Lisp_Object mp = listn (CONSTYPE_HEAP, 11, gma_symbol, QCmac_algorithm_id, make_number (gma), QCtype, Qgnutls_type_mac_algorithm, @@ -2189,7 +2205,7 @@ name. */) make_number (gnutls_mac_get_key_size (gma)), QCmac_algorithm_noncesize, - make_number (gnutls_mac_get_nonce_size (gma))); + make_number (nonce_size)); mac_algorithms = Fcons (mp, mac_algorithms); } diff --git a/src/image.c b/src/image.c index 3dac7086cb4..c1c1671899b 100644 --- a/src/image.c +++ b/src/image.c @@ -2574,7 +2574,7 @@ xbm_image_p (Lisp_Object object) static int xbm_scan (char **s, char *end, char *sval, int *ival) { - unsigned char c; + unsigned char c UNINIT; loop: @@ -5277,6 +5277,25 @@ pbm_scan_number (char **s, char *end) return val; } +/* Scan an index from *S and return it. It is a one-byte unsigned + index if !TWO_BYTE, and a two-byte big-endian unsigned index if + TWO_BYTE. */ + +static int +pbm_scan_index (char **s, bool two_byte) +{ + char *p = *s; + unsigned char c0 = *p++; + int n = c0; + if (two_byte) + { + unsigned char c1 = *p++; + n = (n << 8) + c1; + } + *s = p; + return n; +} + /* Load PBM image IMG for use on frame F. */ @@ -5499,7 +5518,8 @@ pbm_load (struct frame *f, struct image *img) else { int expected_size = height * width; - if (max_color_idx > 255) + bool two_byte = 255 < max_color_idx; + if (two_byte) expected_size *= 2; if (type == PBM_COLOR) expected_size *= 3; @@ -5522,24 +5542,14 @@ pbm_load (struct frame *f, struct image *img) int r, g, b; if (type == PBM_GRAY && raw_p) - { - r = g = b = *p++; - if (max_color_idx > 255) - r = g = b = r * 256 + *p++; - } + r = g = b = pbm_scan_index (&p, two_byte); else if (type == PBM_GRAY) r = g = b = pbm_scan_number (&p, end); else if (raw_p) { - r = *p++; - if (max_color_idx > 255) - r = r * 256 + *p++; - g = *p++; - if (max_color_idx > 255) - g = g * 256 + *p++; - b = *p++; - if (max_color_idx > 255) - b = b * 256 + *p++; + r = pbm_scan_index (&p, two_byte); + g = pbm_scan_index (&p, two_byte); + b = pbm_scan_index (&p, two_byte); } else { @@ -7839,7 +7849,7 @@ gif_load (struct frame *f, struct image *img) init_color_table (); #ifndef USE_CAIRO - unsigned long bgcolor; + unsigned long bgcolor UNINIT; if (STRINGP (specified_bg)) bgcolor = x_alloc_image_color (f, img, specified_bg, FRAME_BACKGROUND_PIXEL (f)); @@ -8542,13 +8552,19 @@ imagemagick_load_image (struct frame *f, struct image *img, char hint_buffer[MaxTextExtent]; char *filename_hint = NULL; + /* Initialize the ImageMagick environment. */ + static bool imagemagick_initialized; + if (!imagemagick_initialized) + { + imagemagick_initialized = true; + MagickWandGenesis (); + } + /* Handle image index for image types who can contain more than one image. Interface :index is same as for GIF. First we "ping" the image to see how many sub-images it contains. Pinging is faster than loading the image to find out things about it. */ - /* Initialize the imagemagick environment. */ - MagickWandGenesis (); image = image_spec_value (img->spec, QCindex, NULL); ino = INTEGERP (image) ? XFASTINT (image) : 0; image_wand = NewMagickWand (); @@ -8849,8 +8865,10 @@ imagemagick_load_image (struct frame *f, struct image *img, DestroyMagickWand (image_wand); if (bg_wand) DestroyPixelWand (bg_wand); - /* `MagickWandTerminus' terminates the imagemagick environment. */ - MagickWandTerminus (); + /* Do not call MagickWandTerminus, to work around ImageMagick bug 825. See: + https://github.com/ImageMagick/ImageMagick/issues/825 + Although this bug was introduced in ImageMagick 6.9.9-14 and + fixed in 6.9.9-18, it's simpler to work around it in all versions. */ return 1; @@ -8858,7 +8876,6 @@ imagemagick_load_image (struct frame *f, struct image *img, DestroyMagickWand (image_wand); if (bg_wand) DestroyPixelWand (bg_wand); - MagickWandTerminus (); /* TODO more cleanup. */ image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec); return 0; diff --git a/src/indent.c b/src/indent.c index 26507b5eb5b..192eec72efe 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1974,6 +1974,11 @@ line_number_display_width (struct window *w, int *width, int *pixel_width) saved_restriction = true; } start_display (&it, w, wstart); + /* The call to move_it_by_lines below will not generate a line + number if the first line shown in the window is hscrolled + such that all of its display elements are out of view. So we + pretend the hscroll doesn't exist. */ + it.first_visible_x = 0; move_it_by_lines (&it, 1); *width = it.lnum_width; *pixel_width = it.lnum_pixel_width; @@ -1986,14 +1991,26 @@ line_number_display_width (struct window *w, int *width, int *pixel_width) DEFUN ("line-number-display-width", Fline_number_display_width, Sline_number_display_width, 0, 1, 0, doc: /* Return the width used for displaying line numbers in the selected window. -If optional argument PIXELWISE is non-nil, return the width in pixels, -otherwise return the width in columns of the face used to display -line numbers, `line-number'. */) +If optional argument PIXELWISE is the symbol `columns', return the width +in units of the frame's canonical character width. In this case, the +value is a float. +If optional argument PIXELWISE is t or any other non-nil value, return +the width as an integer number of pixels. +Otherwise return the value as an integer number of columns of the face +used to display line numbers, `line-number'. Note that in the latter +case, the value doesn't include the 2 columns used for padding the +numbers on display. */) (Lisp_Object pixelwise) { int width, pixel_width; + struct window *w = XWINDOW (selected_window); line_number_display_width (XWINDOW (selected_window), &width, &pixel_width); - if (!NILP (pixelwise)) + if (EQ (pixelwise, Qcolumns)) + { + struct frame *f = XFRAME (w->frame); + return make_float ((double) pixel_width / FRAME_COLUMN_WIDTH (f)); + } + else if (!NILP (pixelwise)) return make_number (pixel_width); return make_number (width); } @@ -2355,6 +2372,8 @@ syms_of_indent (void) doc: /* Indentation can insert tabs if this is non-nil. */); indent_tabs_mode = 1; + DEFSYM (Qcolumns, "columns"); + defsubr (&Scurrent_indentation); defsubr (&Sindent_to); defsubr (&Scurrent_column); diff --git a/src/msdos.c b/src/msdos.c index a8aef9ac405..f7c99f63fff 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -3943,6 +3943,8 @@ careadlinkat (int fd, char const *filename, int faccessat (int dirfd, const char * path, int mode, int flags) { + char fullname[MAXPATHLEN]; + /* We silently ignore FLAGS. */ flags = flags; diff --git a/src/msdos.h b/src/msdos.h index 16292c551d9..e4f633e9df4 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -21,6 +21,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <dpmi.h> +#include "termhooks.h" /* struct terminal */ + int dos_ttraw (struct tty_display_info *); int dos_ttcooked (void); int dos_get_saved_screen (char **, int *, int *); @@ -67,6 +69,7 @@ void syms_of_win16select (void); /* Constants. */ #define EINPROGRESS 112 +#define ENOTSUP ENOSYS /* Gnulib sets O_CLOEXEC to O_NOINHERIT, which gets in the way when we need to redirect standard handles for subprocesses using temporary files created by mkostemp, see callproc.c. */ diff --git a/src/nsterm.m b/src/nsterm.m index 0b43c04c0b7..709e905ec8f 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -423,20 +423,12 @@ static CGPoint menu_mouse_point; } -/* GNUstep always shows decorations if the window is resizable, - miniaturizable or closable, but Cocoa does strange things in native - fullscreen mode if you don't have at least resizable enabled. - - These flags will be OR'd or XOR'd with the NSWindow's styleMask +/* These flags will be OR'd or XOR'd with the NSWindow's styleMask property depending on what we're doing. */ -#ifdef NS_IMPL_COCOA -#define FRAME_DECORATED_FLAGS NSWindowStyleMaskTitled -#else #define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \ | NSWindowStyleMaskResizable \ | NSWindowStyleMaskMiniaturizable \ | NSWindowStyleMaskClosable) -#endif #define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless /* TODO: get rid of need for these forward declarations */ @@ -7211,15 +7203,9 @@ not_in_argv (NSString *arg) win = [[EmacsWindow alloc] initWithContentRect: r - styleMask: ((FRAME_UNDECORATED (f) - ? FRAME_UNDECORATED_FLAGS - : FRAME_DECORATED_FLAGS) -#ifdef NS_IMPL_COCOA - | NSWindowStyleMaskResizable - | NSWindowStyleMaskMiniaturizable - | NSWindowStyleMaskClosable -#endif - ) + styleMask: (FRAME_UNDECORATED (f) + ? FRAME_UNDECORATED_FLAGS + : FRAME_DECORATED_FLAGS) backing: NSBackingStoreBuffered defer: YES]; diff --git a/src/process.c b/src/process.c index 05feba73253..fc46e743328 100644 --- a/src/process.c +++ b/src/process.c @@ -40,6 +40,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <netinet/in.h> #include <arpa/inet.h> +#endif /* subprocesses */ + #ifdef HAVE_SETRLIMIT # include <sys/resource.h> @@ -49,6 +51,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ static struct rlimit nofile_limit; #endif +#ifdef subprocesses + /* Are local (unix) sockets supported? */ #if defined (HAVE_SYS_UN_H) #if !defined (AF_LOCAL) && defined (AF_UNIX) @@ -3830,7 +3834,7 @@ usage: (make-network-process &rest ARGS) */) Lisp_Object proc; Lisp_Object contact; struct Lisp_Process *p; - const char *portstring; + const char *portstring UNINIT; ptrdiff_t portstringlen ATTRIBUTE_UNUSED; char portbuf[INT_BUFSIZE_BOUND (EMACS_INT)]; #ifdef HAVE_LOCAL_SOCKETS @@ -7455,6 +7459,13 @@ keyboard_bit_set (fd_set *mask) #else /* not subprocesses */ +/* This is referenced in thread.c:run_thread (which is never actually + called, since threads are not enabled for this configuration. */ +void +update_processes_for_thread_death (Lisp_Object dying_thread) +{ +} + /* Defined in msdos.c. */ extern int sys_select (int, fd_set *, fd_set *, fd_set *, struct timespec *, void *); diff --git a/src/sysdep.c b/src/sysdep.c index dd0062b6f04..f9cc2c81762 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -831,6 +831,8 @@ unblock_child_signal (sigset_t const *oldset) pthread_sigmask (SIG_SETMASK, oldset, 0); } +#endif /* !MSDOS */ + /* Block SIGINT. */ void block_interrupt_signal (sigset_t *oldset) @@ -848,7 +850,6 @@ restore_signal_mask (sigset_t const *oldset) pthread_sigmask (SIG_SETMASK, oldset, 0); } -#endif /* !MSDOS */ /* Saving and restoring the process group of Emacs's terminal. */ diff --git a/src/sysselect.h b/src/sysselect.h index 8295aeb8421..4d8a4d0a3a9 100644 --- a/src/sysselect.h +++ b/src/sysselect.h @@ -50,6 +50,11 @@ typedef int fd_set; #endif #ifdef MSDOS +/* The above #define for 'select' gets in the way because sysselect.h + is included in thread.h, which is included everywhere, and 'select' + declared in DJGPP system headers has a signature incompatible with + 'pselect', which we emulate in msdos.c. */ +#undef select #define pselect sys_select #endif diff --git a/src/systhread.c b/src/systhread.c index ee89a1ed3ff..6f9baabaf2e 100644 --- a/src/systhread.c +++ b/src/systhread.c @@ -187,7 +187,7 @@ sys_thread_yield (void) #elif defined (WINDOWSNT) -#include <windows.h> +#include <w32term.h> /* Cannot include <process.h> because of the local header by the same name, sigh. */ @@ -326,8 +326,9 @@ sys_thread_self (void) static thread_creation_function *thread_start_address; /* _beginthread wants a void function, while we are passed a function - that returns a pointer. So we use a wrapper. */ -static void + that returns a pointer. So we use a wrapper. See the command in + w32term.h about the need for ALIGN_STACK attribute. */ +static void ALIGN_STACK w32_beginthread_wrapper (void *arg) { (void)thread_start_address (arg); diff --git a/src/thread.c b/src/thread.c index d075bdb3a13..c03cdda0fae 100644 --- a/src/thread.c +++ b/src/thread.c @@ -806,7 +806,11 @@ If NAME is given, it must be a string; it names the new thread. */) { /* Restore the previous situation. */ all_threads = all_threads->next_thread; +#ifdef THREADS_ENABLED error ("Could not start a new thread"); +#else + error ("Concurrency is not supported in this configuration"); +#endif } /* FIXME: race here where new thread might not be filled in? */ diff --git a/src/thread.h b/src/thread.h index cb2133d72d4..19baafbf8a1 100644 --- a/src/thread.h +++ b/src/thread.h @@ -25,6 +25,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <sys/socket.h> #endif +#ifdef MSDOS +#include <signal.h> /* sigset_t */ +#endif + #include "sysselect.h" /* FIXME */ #include "systime.h" /* FIXME */ #include "systhread.h" diff --git a/src/w32fns.c b/src/w32fns.c index e3de22d68ab..d2d4b2c7355 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5847,7 +5847,8 @@ This function is an internal primitive--use `make-frame' instead. */) that are needed to determine window geometry. */ x_default_font_parameter (f, parameters); - x_default_parameter (f, parameters, Qborder_width, make_number (2), + /* Default BorderWidth to 0 to match other platforms. */ + x_default_parameter (f, parameters, Qborder_width, make_number (0), "borderWidth", "BorderWidth", RES_TYPE_NUMBER); /* We recognize either internalBorderWidth or internalBorder @@ -5862,7 +5863,7 @@ This function is an internal primitive--use `make-frame' instead. */) parameters = Fcons (Fcons (Qinternal_border_width, value), parameters); } - /* Default internalBorderWidth to 0 on Windows to match other programs. */ + x_default_parameter (f, parameters, Qinternal_border_width, make_number (0), "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER); x_default_parameter (f, parameters, Qright_divider_width, make_number (0), diff --git a/src/w32term.h b/src/w32term.h index 16b44b0ca2f..8d08ca0a2bf 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -22,13 +22,14 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include "frame.h" #include "atimer.h" -/* Stack alignment stuff. Every CALLBACK function should have the - ALIGN_STACK attribute if it manipulates Lisp objects, because - Windows x86 32-bit ABI only guarantees 4-byte stack alignment, and - that is what we will get when a Windows function calls us. The - ALIGN_STACK attribute forces GCC to emit a preamble code to - re-align the stack at function entry. Further details about this - can be found in http://www.peterstock.co.uk/games/mingw_sse/. */ +/* Stack alignment stuff. Every CALLBACK and thread function should + have the ALIGN_STACK attribute if it manipulates Lisp objects, + because Windows x86 32-bit ABI only guarantees 4-byte stack + alignment, and that is what we will get when a Windows function + calls us. The ALIGN_STACK attribute forces GCC to emit a preamble + code to re-align the stack at function entry. Further details + about this can be found in + http://www.peterstock.co.uk/games/mingw_sse/. */ #ifdef __GNUC__ # if USE_STACK_LISP_OBJECTS && !defined _WIN64 && !defined __x86_64__ \ && __GNUC__ + (__GNUC_MINOR__ > 1) >= 5 diff --git a/src/xdisp.c b/src/xdisp.c index b14b7daf2b0..dc23959aadb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20889,9 +20889,11 @@ maybe_produce_line_number (struct it *it) && it->w->base_line_pos <= IT_CHARPOS (*it) /* line-number-mode always displays narrowed line numbers, so we cannot use its data if the user wants - line numbers that disregard narrowing. */ + line numbers that disregard narrowing, or if the + buffer's narrowing has just changed. */ && !(display_line_numbers_widen - && (BEG_BYTE != BEGV_BYTE || Z_BYTE != ZV_BYTE))) + && (BEG_BYTE != BEGV_BYTE || Z_BYTE != ZV_BYTE)) + && !current_buffer->clip_changed) { start_from = CHAR_TO_BYTE (it->w->base_line_pos); last_line = it->w->base_line_number - 1; @@ -25121,7 +25123,20 @@ else if the text is replaced by an ellipsis. */) '(space :width (+ left-fringe left-margin (- (1)))) '(space :width (+ left-fringe left-margin (-1))) -*/ + If ALIGN_TO is NULL, returns the result in *RES. If ALIGN_TO is + non-NULL, the value of *ALIGN_TO is a window-relative pixel + coordinate, and *RES is the additional pixel width from that point + till the end of the stretch glyph. + + WIDTH_P non-zero means take the width dimension or X coordinate of + the object specified by PROP, WIDTH_P zero means take the height + dimension or the Y coordinate. (Therefore, if ALIGN_TO is + non-NULL, WIDTH_P should be non-zero.) + + FONT is the font of the face of the surrounding text. + + The return value is non-zero if width or height were successfully + calculated, i.e. if PROP is a valid spec. */ static bool calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, @@ -25143,6 +25158,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, { char *unit = SSDATA (SYMBOL_NAME (prop)); + /* The UNIT expression, e.g. as part of (NUM . UNIT). */ if (unit[0] == 'i' && unit[1] == 'n') pixels = 1.0; else if (unit[0] == 'm' && unit[1] == 'm') @@ -25163,10 +25179,12 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, } #ifdef HAVE_WINDOW_SYSTEM + /* 'height': the height of FONT. */ if (EQ (prop, Qheight)) return OK_PIXELS (font ? normal_char_height (font, -1) : FRAME_LINE_HEIGHT (it->f)); + /* 'width': the width of FONT. */ if (EQ (prop, Qwidth)) return OK_PIXELS (font ? FONT_WIDTH (font) @@ -25176,33 +25194,48 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, return OK_PIXELS (1); #endif + /* 'text': the width or height of the text area. */ if (EQ (prop, Qtext)) return OK_PIXELS (width_p - ? window_box_width (it->w, TEXT_AREA) + ? (window_box_width (it->w, TEXT_AREA) + - it->lnum_pixel_width) : WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w)); + /* ':align_to'. First time we compute the value, window + elements are interpreted as the position of the element's + left edge. */ if (align_to && *align_to < 0) { *res = 0; + /* 'left': left edge of the text area. */ if (EQ (prop, Qleft)) - return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA)); + return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA) + + it->lnum_pixel_width); + /* 'right': right edge of the text area. */ if (EQ (prop, Qright)) return OK_ALIGN_TO (window_box_right_offset (it->w, TEXT_AREA)); + /* 'center': the center of the text area. */ if (EQ (prop, Qcenter)) return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA) + + it->lnum_pixel_width + window_box_width (it->w, TEXT_AREA) / 2); + /* 'left-fringe': left edge of the left fringe. */ if (EQ (prop, Qleft_fringe)) return OK_ALIGN_TO (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w) ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (it->w) : window_box_right_offset (it->w, LEFT_MARGIN_AREA)); + /* 'right-fringe': left edge of the right fringe. */ if (EQ (prop, Qright_fringe)) return OK_ALIGN_TO (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w) ? window_box_right_offset (it->w, RIGHT_MARGIN_AREA) : window_box_right_offset (it->w, TEXT_AREA)); + /* 'left-margin': left edge of the left display margin. */ if (EQ (prop, Qleft_margin)) return OK_ALIGN_TO (window_box_left_offset (it->w, LEFT_MARGIN_AREA)); + /* 'right-margin': left edge of the right display margin. */ if (EQ (prop, Qright_margin)) return OK_ALIGN_TO (window_box_left_offset (it->w, RIGHT_MARGIN_AREA)); + /* 'scroll-bar': left edge of the vertical scroll bar. */ if (EQ (prop, Qscroll_bar)) return OK_ALIGN_TO (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (it->w) ? 0 @@ -25213,6 +25246,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, } else { + /* Otherwise, the elements stand for their width. */ if (EQ (prop, Qleft_fringe)) return OK_PIXELS (WINDOW_LEFT_FRINGE_WIDTH (it->w)); if (EQ (prop, Qright_fringe)) @@ -25235,6 +25269,8 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, int base_unit = (width_p ? FRAME_COLUMN_WIDTH (it->f) : FRAME_LINE_HEIGHT (it->f)); + if (width_p && align_to && *align_to < 0) + return OK_PIXELS (XFLOATINT (prop) * base_unit + it->lnum_pixel_width); return OK_PIXELS (XFLOATINT (prop) * base_unit); } @@ -25246,6 +25282,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, if (SYMBOLP (car)) { #ifdef HAVE_WINDOW_SYSTEM + /* '(image PROPS...)': width or height of the specified image. */ if (FRAME_WINDOW_P (it->f) && valid_image_p (prop)) { @@ -25254,12 +25291,15 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, return OK_PIXELS (width_p ? img->width : img->height); } + /* '(xwidget PROPS...)': dimensions of the specified xwidget. */ if (FRAME_WINDOW_P (it->f) && valid_xwidget_spec_p (prop)) { /* TODO: Don't return dummy size. */ return OK_PIXELS (100); } #endif + /* '(+ EXPR...)' or '(- EXPR...)' add or subtract + recursively calculated values. */ if (EQ (car, Qplus) || EQ (car, Qminus)) { bool first = true; @@ -25287,15 +25327,18 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, car = Qnil; } + /* '(NUM)': absolute number of pixels. */ if (NUMBERP (car)) { double fact; + int offset = + width_p && align_to && *align_to < 0 ? it->lnum_pixel_width : 0; pixels = XFLOATINT (car); if (NILP (cdr)) - return OK_PIXELS (pixels); + return OK_PIXELS (pixels + offset); if (calc_pixel_width_or_height (&fact, it, cdr, font, width_p, align_to)) - return OK_PIXELS (pixels * fact); + return OK_PIXELS (pixels * fact + offset); return false; } |