aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2017-10-20 22:44:13 -0700
committerPaul Eggert2017-10-20 22:44:13 -0700
commit3155cb1585da7235145d76791feaf6170d8be0f1 (patch)
tree19b655867f27bb630b182f4bdb00a2e2d5ee6427 /src
parentcb29f41624e5163a0aea4bfc98591e683807a2f8 (diff)
parent11bd8aa24b347f75e674528dd1a94b0a4037105e (diff)
downloademacs-3155cb1585da7235145d76791feaf6170d8be0f1.tar.gz
emacs-3155cb1585da7235145d76791feaf6170d8be0f1.zip
Merge from origin/emacs-26
11bd8aa24b Fix flymake's loading of subr-x b500e06f4d Fix Bug#28896 d815de017b Skip a Flymake test for old gcc versions fd3d8610b2 Make :align-to account for display-line-numbers 831eafc8ae Augment Flymake API for third-party extensions ddd547fada Improve treatment of Fortran's "class default" 234b1e3864 Flymake backends must check proc obsoleteness in source bu... 3ea6a4d4ba Skip an rsync test in tramp-tests.el 25f83fa7c5 ; Indentation fixes 4d578d432d On Windows default a frame's border width to zero (Bug#28873) 6f1dea5c74 Spelling fixes b8433b0954 Use pop-to-buffer-same-window instead of switch-to-buffer 2f7163fb72 Fix the MSDOS build. 2551d28fe8 Fix line number display after 'widen' dc8812829b Remove resizable attribute on macOS undecorated frames (bu... b970a4a52a Fix handling of `border-width' in `frameset--restore-frame... 445e92658f Mention how to send CC to > 1 address in a bug report 8ca6fa585a Improve format-time-string doc 2e1b3522b8 Improve documentation of 'line-number-display-width' 5b6e59cfdb Implement vc-default-dir-extra-headers for vc-rcs 22adeca42a In NEWS give advice on use of `switch-to-buffer' (Bug#28645) 2c3e6f1ddc Dont update primary selection with winner-undo b38724ab67 Work around ImageMagick bug 825 20cc68e871 Document rectangle-preview option more (Bug#27974) a0b7b301dd Do not reject https://gnu.org in commit messages fb4200a875 Fix Edebug spec for cl-defun (bug#24255) db68cefe72 Fix errors in kmacro.el post-command-hook c63b344c3d Fix range-error in image-dired.el 081d2187c4 Fix 'line-number-display-width' in hscrolled windows 16e85456e7 Fix error in tramp-smb-handle-insert-directory 613db8d35c Don't reject PBM header whitespace unnecessarily 3205b12a78 Fix regression in display of PPM images 1ca9ae7069 Require subr-x when compiling nnimap.el de60992053 Fix ert-test finding by symbol (Bug#28849) 51615a8082 Don't remember old debugger window (Bug#17882) 5980de3727 Disable python native completion on w32 (Bug#28580) 616b4c5956 Let select-frame-by-name choose any frame when called from... 8eb3c01dbd * lisp/dired-aux.el (dired-create-directory): Doc fix. 325dfdae13 Avoid compilation warnings in optimized builds f79382819c ; * src/composite.c (Fclear_composition_cache): Fix last c... f95cd5cd70 Improve customization of arabic-shaper-ZWNJ-handling. a7f154688d Improve customization type of 'mouse-drag-and-drop-region' 864734d112 ; Prefer https: to http: in GNU URLs 3c78960a47 Encourage https: in commit messages def9715282 ; Cleanup of etc/NEWS 4e59ecc646 Fix wording in Elisp manual's child frames section (Bug#28... eda9f5018c Another fix for C mode fontification of w32 source files 05aadd8990 Fix fontification of ALIGN_STACK functions aa0c38f358 Make sure thread stack is properly aligned on MS-Windows d7038020aa Do not under-align pseudovectors ff33053012 Fix indentation bug in multi-line CSS selectors 8968be822e ; * etc/NEWS: Grammar and spelling fixes 716b84034d gnutls_mac_get_nonce_size has been added in gnutls 3.3 55e313f7be ; * CONTRIBUTE: More suggestions for using US English. 622c675648 * CONTRIBUTE: Suggest American English. # Conflicts: # etc/NEWS # msdos/sed2v2.inp
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c10
-rw-r--r--src/buffer.c4
-rw-r--r--src/composite.c15
-rw-r--r--src/conf_post.h2
-rw-r--r--src/data.c2
-rw-r--r--src/editfns.c11
-rw-r--r--src/fileio.c2
-rw-r--r--src/gnutls.c32
-rw-r--r--src/image.c61
-rw-r--r--src/indent.c27
-rw-r--r--src/msdos.c2
-rw-r--r--src/msdos.h3
-rw-r--r--src/nsterm.m22
-rw-r--r--src/process.c13
-rw-r--r--src/sysdep.c3
-rw-r--r--src/sysselect.h5
-rw-r--r--src/systhread.c7
-rw-r--r--src/thread.c4
-rw-r--r--src/thread.h4
-rw-r--r--src/w32fns.c5
-rw-r--r--src/w32term.h15
-rw-r--r--src/xdisp.c57
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)
2923 2923
2924enum 2924enum
2925 { 2925 {
2926 /* Alignment of struct Lisp_Vector objects. */ 2926 /* Alignment of struct Lisp_Vector objects. Because pseudovectors
2927 vector_alignment = COMMON_MULTIPLE (FLEXALIGNOF (struct Lisp_Vector), 2927 can contain any C type, align at least as strictly as
2928 GCALIGNMENT), 2928 max_align_t. On x86 and x86-64 this can waste up to 8 bytes
2929 for typical vectors, since alignof (max_align_t) is 16 but
2930 typical vectors need only an alignment of 8. However, it is
2931 not worth the hassle to avoid wasting those bytes. */
2932 vector_alignment = COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT),
2929 2933
2930 /* Vector size requests are a multiple of this. */ 2934 /* Vector size requests are a multiple of this. */
2931 roundup_size = COMMON_MULTIPLE (vector_alignment, word_size) 2935 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
3616fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end) 3616fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3617{ 3617{
3618 Lisp_Object overlay; 3618 Lisp_Object overlay;
3619 struct Lisp_Overlay *before_list; 3619 struct Lisp_Overlay *before_list UNINIT;
3620 struct Lisp_Overlay *after_list; 3620 struct Lisp_Overlay *after_list UNINIT;
3621 /* These are either nil, indicating that before_list or after_list 3621 /* These are either nil, indicating that before_list or after_list
3622 should be assigned, or the cons cell the cdr of which should be 3622 should be assigned, or the cons cell the cdr of which should be
3623 assigned. */ 3623 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)
686 return HASH_VALUE (h, id); 686 return HASH_VALUE (h, id);
687} 687}
688 688
689DEFUN ("clear-composition-cache", Fclear_composition_cache,
690 Sclear_composition_cache, 0, 0, 0,
691 doc: /* Internal use only.
692Clear composition cache. */)
693 (void)
694{
695 Lisp_Object args[] = {QCtest, Qequal, QCsize, make_number (311)};
696 gstring_hash_table = CALLMANY (Fmake_hash_table, args);
697 /* Fixme: We call Fclear_face_cache to force complete re-building of
698 display glyphs. But, it may be better to call this function from
699 Fclear_face_cache instead. */
700 return Fclear_face_cache (Qt);
701}
702
689bool 703bool
690composition_gstring_p (Lisp_Object gstring) 704composition_gstring_p (Lisp_Object gstring)
691{ 705{
@@ -1982,4 +1996,5 @@ See also the documentation of `auto-composition-mode'. */);
1982 defsubr (&Scompose_string_internal); 1996 defsubr (&Scompose_string_internal);
1983 defsubr (&Sfind_composition_internal); 1997 defsubr (&Sfind_composition_internal);
1984 defsubr (&Scomposition_get_gstring); 1998 defsubr (&Scomposition_get_gstring);
1999 defsubr (&Sclear_composition_cache);
1985} 2000}
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/>. */
31 31
32#include <stdbool.h> 32#include <stdbool.h>
33 33
34#if defined DOS_NT && !defined DEFER_MS_W32_H 34#if defined WINDOWSNT && !defined DEFER_MS_W32_H
35# include <ms-w32.h> 35# include <ms-w32.h>
36#endif 36#endif
37 37
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. */)
1888 (Lisp_Object variable) 1888 (Lisp_Object variable)
1889{ 1889{
1890 Lisp_Object tem; 1890 Lisp_Object tem;
1891 bool forwarded; 1891 bool forwarded UNINIT;
1892 union Lisp_Val_Fwd valcontents; 1892 union Lisp_Val_Fwd valcontents;
1893 struct Lisp_Symbol *sym; 1893 struct Lisp_Symbol *sym;
1894 struct Lisp_Buffer_Local_Value *blv = NULL; 1894 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:
2038 only blank-padded, %l is like %I blank-padded. 2038 only blank-padded, %l is like %I blank-padded.
2039%p is the locale's equivalent of either AM or PM. 2039%p is the locale's equivalent of either AM or PM.
2040%q is the calendar quarter (1–4). 2040%q is the calendar quarter (1–4).
2041%M is the minute. 2041%M is the minute (00-59).
2042%S is the second. 2042%S is the second (00-59; 00-60 on platforms with leap seconds)
2043%N is the nanosecond, %6N the microsecond, %3N the millisecond, etc.
2044%Z is the time zone name, %z is the numeric form.
2045%s is the number of seconds since 1970-01-01 00:00:00 +0000. 2043%s is the number of seconds since 1970-01-01 00:00:00 +0000.
2044%N is the nanosecond, %6N the microsecond, %3N the millisecond, etc.
2045%Z is the time zone abbreviation, %z is the numeric form.
2046 2046
2047%c is the locale's date and time format. 2047%c is the locale's date and time format.
2048%x is the locale's "preferred" date format. 2048%x is the locale's "preferred" date format.
@@ -2052,7 +2052,8 @@ by text that describes the specified date and time in TIME:
2052%R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p". 2052%R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p".
2053%X is the locale's "preferred" time format. 2053%X is the locale's "preferred" time format.
2054 2054
2055Finally, %n is a newline, %t is a tab, %% is a literal %. 2055Finally, %n is a newline, %t is a tab, %% is a literal %, and
2056unrecognized %-sequences stand for themselves.
2056 2057
2057Certain flags and modifiers are available with some format controls. 2058Certain flags and modifiers are available with some format controls.
2058The flags are `_', `-', `^' and `#'. For certain characters X, 2059The 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. */)
2297 bool plain_rename = (case_only_rename 2297 bool plain_rename = (case_only_rename
2298 || (!NILP (ok_if_already_exists) 2298 || (!NILP (ok_if_already_exists)
2299 && !INTEGERP (ok_if_already_exists))); 2299 && !INTEGERP (ok_if_already_exists)));
2300 int rename_errno; 2300 int rename_errno UNINIT;
2301 if (!plain_rename) 2301 if (!plain_rename)
2302 { 2302 {
2303 if (renameat_noreplace (AT_FDCWD, SSDATA (encoded_file), 2303 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/>. */
26#include "coding.h" 26#include "coding.h"
27#include "buffer.h" 27#include "buffer.h"
28 28
29#if 0x030014 <= GNUTLS_VERSION_NUMBER 29#if GNUTLS_VERSION_NUMBER >= 0x030014
30# define HAVE_GNUTLS_X509_SYSTEM_TRUST 30# define HAVE_GNUTLS_X509_SYSTEM_TRUST
31#endif 31#endif
32 32
@@ -36,10 +36,16 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
36 The relevant fix seems to have been made in GnuTLS 3.5.1; see: 36 The relevant fix seems to have been made in GnuTLS 3.5.1; see:
37 https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d 37 https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d
38 So, require 3.5.1. */ 38 So, require 3.5.1. */
39#if 0x030501 <= GNUTLS_VERSION_NUMBER 39#if GNUTLS_VERSION_NUMBER >= 0x030501
40# define HAVE_GNUTLS_AEAD 40# define HAVE_GNUTLS_AEAD
41#endif 41#endif
42 42
43/* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was
44 exported only since 3.3.0. */
45#if GNUTLS_VERSION_NUMBER >= 0x030300
46# define HAVE_GNUTLS_MAC_GET_NONCE_SIZE
47#endif
48
43#ifdef HAVE_GNUTLS 49#ifdef HAVE_GNUTLS
44 50
45# ifdef WINDOWSNT 51# ifdef WINDOWSNT
@@ -187,7 +193,9 @@ DEF_DLL_FN (const char *, gnutls_mac_get_name, (gnutls_mac_algorithm_t));
187# ifdef HAVE_GNUTLS3 193# ifdef HAVE_GNUTLS3
188DEF_DLL_FN (int, gnutls_rnd, (gnutls_rnd_level_t, void *, size_t)); 194DEF_DLL_FN (int, gnutls_rnd, (gnutls_rnd_level_t, void *, size_t));
189DEF_DLL_FN (const gnutls_mac_algorithm_t *, gnutls_mac_list, (void)); 195DEF_DLL_FN (const gnutls_mac_algorithm_t *, gnutls_mac_list, (void));
196# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
190DEF_DLL_FN (size_t, gnutls_mac_get_nonce_size, (gnutls_mac_algorithm_t)); 197DEF_DLL_FN (size_t, gnutls_mac_get_nonce_size, (gnutls_mac_algorithm_t));
198# endif
191DEF_DLL_FN (size_t, gnutls_mac_get_key_size, (gnutls_mac_algorithm_t)); 199DEF_DLL_FN (size_t, gnutls_mac_get_key_size, (gnutls_mac_algorithm_t));
192DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void)); 200DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void));
193DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t)); 201DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t));
@@ -316,7 +324,9 @@ init_gnutls_functions (void)
316# ifdef HAVE_GNUTLS3 324# ifdef HAVE_GNUTLS3
317 LOAD_DLL_FN (library, gnutls_rnd); 325 LOAD_DLL_FN (library, gnutls_rnd);
318 LOAD_DLL_FN (library, gnutls_mac_list); 326 LOAD_DLL_FN (library, gnutls_mac_list);
327# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
319 LOAD_DLL_FN (library, gnutls_mac_get_nonce_size); 328 LOAD_DLL_FN (library, gnutls_mac_get_nonce_size);
329# endif
320 LOAD_DLL_FN (library, gnutls_mac_get_key_size); 330 LOAD_DLL_FN (library, gnutls_mac_get_key_size);
321 LOAD_DLL_FN (library, gnutls_digest_list); 331 LOAD_DLL_FN (library, gnutls_digest_list);
322 LOAD_DLL_FN (library, gnutls_digest_get_name); 332 LOAD_DLL_FN (library, gnutls_digest_get_name);
@@ -427,7 +437,9 @@ init_gnutls_functions (void)
427# ifdef HAVE_GNUTLS3 437# ifdef HAVE_GNUTLS3
428# define gnutls_rnd fn_gnutls_rnd 438# define gnutls_rnd fn_gnutls_rnd
429# define gnutls_mac_list fn_gnutls_mac_list 439# define gnutls_mac_list fn_gnutls_mac_list
430# define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size 440# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
441# define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size
442# endif
431# define gnutls_mac_get_key_size fn_gnutls_mac_get_key_size 443# define gnutls_mac_get_key_size fn_gnutls_mac_get_key_size
432# define gnutls_digest_list fn_gnutls_digest_list 444# define gnutls_digest_list fn_gnutls_digest_list
433# define gnutls_digest_get_name fn_gnutls_digest_get_name 445# define gnutls_digest_get_name fn_gnutls_digest_get_name
@@ -442,10 +454,10 @@ init_gnutls_functions (void)
442# define gnutls_cipher_decrypt2 fn_gnutls_cipher_decrypt2 454# define gnutls_cipher_decrypt2 fn_gnutls_cipher_decrypt2
443# define gnutls_cipher_deinit fn_gnutls_cipher_deinit 455# define gnutls_cipher_deinit fn_gnutls_cipher_deinit
444# ifdef HAVE_GNUTLS_AEAD 456# ifdef HAVE_GNUTLS_AEAD
445# define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt 457# define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt
446# define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt 458# define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt
447# define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init 459# define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init
448# define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit 460# define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit
449# endif 461# endif
450# define gnutls_hmac_init fn_gnutls_hmac_init 462# define gnutls_hmac_init fn_gnutls_hmac_init
451# define gnutls_hmac_get_len fn_gnutls_hmac_get_len 463# define gnutls_hmac_get_len fn_gnutls_hmac_get_len
@@ -2178,6 +2190,10 @@ name. */)
2178 /* A symbol representing the GnuTLS MAC algorithm. */ 2190 /* A symbol representing the GnuTLS MAC algorithm. */
2179 Lisp_Object gma_symbol = intern (gnutls_mac_get_name (gma)); 2191 Lisp_Object gma_symbol = intern (gnutls_mac_get_name (gma));
2180 2192
2193 size_t nonce_size = 0;
2194#ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
2195 nonce_size = gnutls_mac_get_nonce_size (gma);
2196#endif
2181 Lisp_Object mp = listn (CONSTYPE_HEAP, 11, gma_symbol, 2197 Lisp_Object mp = listn (CONSTYPE_HEAP, 11, gma_symbol,
2182 QCmac_algorithm_id, make_number (gma), 2198 QCmac_algorithm_id, make_number (gma),
2183 QCtype, Qgnutls_type_mac_algorithm, 2199 QCtype, Qgnutls_type_mac_algorithm,
@@ -2189,7 +2205,7 @@ name. */)
2189 make_number (gnutls_mac_get_key_size (gma)), 2205 make_number (gnutls_mac_get_key_size (gma)),
2190 2206
2191 QCmac_algorithm_noncesize, 2207 QCmac_algorithm_noncesize,
2192 make_number (gnutls_mac_get_nonce_size (gma))); 2208 make_number (nonce_size));
2193 mac_algorithms = Fcons (mp, mac_algorithms); 2209 mac_algorithms = Fcons (mp, mac_algorithms);
2194 } 2210 }
2195 2211
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)
2574static int 2574static int
2575xbm_scan (char **s, char *end, char *sval, int *ival) 2575xbm_scan (char **s, char *end, char *sval, int *ival)
2576{ 2576{
2577 unsigned char c; 2577 unsigned char c UNINIT;
2578 2578
2579 loop: 2579 loop:
2580 2580
@@ -5277,6 +5277,25 @@ pbm_scan_number (char **s, char *end)
5277 return val; 5277 return val;
5278} 5278}
5279 5279
5280/* Scan an index from *S and return it. It is a one-byte unsigned
5281 index if !TWO_BYTE, and a two-byte big-endian unsigned index if
5282 TWO_BYTE. */
5283
5284static int
5285pbm_scan_index (char **s, bool two_byte)
5286{
5287 char *p = *s;
5288 unsigned char c0 = *p++;
5289 int n = c0;
5290 if (two_byte)
5291 {
5292 unsigned char c1 = *p++;
5293 n = (n << 8) + c1;
5294 }
5295 *s = p;
5296 return n;
5297}
5298
5280 5299
5281/* Load PBM image IMG for use on frame F. */ 5300/* Load PBM image IMG for use on frame F. */
5282 5301
@@ -5499,7 +5518,8 @@ pbm_load (struct frame *f, struct image *img)
5499 else 5518 else
5500 { 5519 {
5501 int expected_size = height * width; 5520 int expected_size = height * width;
5502 if (max_color_idx > 255) 5521 bool two_byte = 255 < max_color_idx;
5522 if (two_byte)
5503 expected_size *= 2; 5523 expected_size *= 2;
5504 if (type == PBM_COLOR) 5524 if (type == PBM_COLOR)
5505 expected_size *= 3; 5525 expected_size *= 3;
@@ -5522,24 +5542,14 @@ pbm_load (struct frame *f, struct image *img)
5522 int r, g, b; 5542 int r, g, b;
5523 5543
5524 if (type == PBM_GRAY && raw_p) 5544 if (type == PBM_GRAY && raw_p)
5525 { 5545 r = g = b = pbm_scan_index (&p, two_byte);
5526 r = g = b = *p++;
5527 if (max_color_idx > 255)
5528 r = g = b = r * 256 + *p++;
5529 }
5530 else if (type == PBM_GRAY) 5546 else if (type == PBM_GRAY)
5531 r = g = b = pbm_scan_number (&p, end); 5547 r = g = b = pbm_scan_number (&p, end);
5532 else if (raw_p) 5548 else if (raw_p)
5533 { 5549 {
5534 r = *p++; 5550 r = pbm_scan_index (&p, two_byte);
5535 if (max_color_idx > 255) 5551 g = pbm_scan_index (&p, two_byte);
5536 r = r * 256 + *p++; 5552 b = pbm_scan_index (&p, two_byte);
5537 g = *p++;
5538 if (max_color_idx > 255)
5539 g = g * 256 + *p++;
5540 b = *p++;
5541 if (max_color_idx > 255)
5542 b = b * 256 + *p++;
5543 } 5553 }
5544 else 5554 else
5545 { 5555 {
@@ -7839,7 +7849,7 @@ gif_load (struct frame *f, struct image *img)
7839 init_color_table (); 7849 init_color_table ();
7840 7850
7841#ifndef USE_CAIRO 7851#ifndef USE_CAIRO
7842 unsigned long bgcolor; 7852 unsigned long bgcolor UNINIT;
7843 if (STRINGP (specified_bg)) 7853 if (STRINGP (specified_bg))
7844 bgcolor = x_alloc_image_color (f, img, specified_bg, 7854 bgcolor = x_alloc_image_color (f, img, specified_bg,
7845 FRAME_BACKGROUND_PIXEL (f)); 7855 FRAME_BACKGROUND_PIXEL (f));
@@ -8542,13 +8552,19 @@ imagemagick_load_image (struct frame *f, struct image *img,
8542 char hint_buffer[MaxTextExtent]; 8552 char hint_buffer[MaxTextExtent];
8543 char *filename_hint = NULL; 8553 char *filename_hint = NULL;
8544 8554
8555 /* Initialize the ImageMagick environment. */
8556 static bool imagemagick_initialized;
8557 if (!imagemagick_initialized)
8558 {
8559 imagemagick_initialized = true;
8560 MagickWandGenesis ();
8561 }
8562
8545 /* Handle image index for image types who can contain more than one image. 8563 /* Handle image index for image types who can contain more than one image.
8546 Interface :index is same as for GIF. First we "ping" the image to see how 8564 Interface :index is same as for GIF. First we "ping" the image to see how
8547 many sub-images it contains. Pinging is faster than loading the image to 8565 many sub-images it contains. Pinging is faster than loading the image to
8548 find out things about it. */ 8566 find out things about it. */
8549 8567
8550 /* Initialize the imagemagick environment. */
8551 MagickWandGenesis ();
8552 image = image_spec_value (img->spec, QCindex, NULL); 8568 image = image_spec_value (img->spec, QCindex, NULL);
8553 ino = INTEGERP (image) ? XFASTINT (image) : 0; 8569 ino = INTEGERP (image) ? XFASTINT (image) : 0;
8554 image_wand = NewMagickWand (); 8570 image_wand = NewMagickWand ();
@@ -8849,8 +8865,10 @@ imagemagick_load_image (struct frame *f, struct image *img,
8849 DestroyMagickWand (image_wand); 8865 DestroyMagickWand (image_wand);
8850 if (bg_wand) DestroyPixelWand (bg_wand); 8866 if (bg_wand) DestroyPixelWand (bg_wand);
8851 8867
8852 /* `MagickWandTerminus' terminates the imagemagick environment. */ 8868 /* Do not call MagickWandTerminus, to work around ImageMagick bug 825. See:
8853 MagickWandTerminus (); 8869 https://github.com/ImageMagick/ImageMagick/issues/825
8870 Although this bug was introduced in ImageMagick 6.9.9-14 and
8871 fixed in 6.9.9-18, it's simpler to work around it in all versions. */
8854 8872
8855 return 1; 8873 return 1;
8856 8874
@@ -8858,7 +8876,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
8858 DestroyMagickWand (image_wand); 8876 DestroyMagickWand (image_wand);
8859 if (bg_wand) DestroyPixelWand (bg_wand); 8877 if (bg_wand) DestroyPixelWand (bg_wand);
8860 8878
8861 MagickWandTerminus ();
8862 /* TODO more cleanup. */ 8879 /* TODO more cleanup. */
8863 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec); 8880 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec);
8864 return 0; 8881 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)
1974 saved_restriction = true; 1974 saved_restriction = true;
1975 } 1975 }
1976 start_display (&it, w, wstart); 1976 start_display (&it, w, wstart);
1977 /* The call to move_it_by_lines below will not generate a line
1978 number if the first line shown in the window is hscrolled
1979 such that all of its display elements are out of view. So we
1980 pretend the hscroll doesn't exist. */
1981 it.first_visible_x = 0;
1977 move_it_by_lines (&it, 1); 1982 move_it_by_lines (&it, 1);
1978 *width = it.lnum_width; 1983 *width = it.lnum_width;
1979 *pixel_width = it.lnum_pixel_width; 1984 *pixel_width = it.lnum_pixel_width;
@@ -1986,14 +1991,26 @@ line_number_display_width (struct window *w, int *width, int *pixel_width)
1986DEFUN ("line-number-display-width", Fline_number_display_width, 1991DEFUN ("line-number-display-width", Fline_number_display_width,
1987 Sline_number_display_width, 0, 1, 0, 1992 Sline_number_display_width, 0, 1, 0,
1988 doc: /* Return the width used for displaying line numbers in the selected window. 1993 doc: /* Return the width used for displaying line numbers in the selected window.
1989If optional argument PIXELWISE is non-nil, return the width in pixels, 1994If optional argument PIXELWISE is the symbol `columns', return the width
1990otherwise return the width in columns of the face used to display 1995in units of the frame's canonical character width. In this case, the
1991line numbers, `line-number'. */) 1996value is a float.
1997If optional argument PIXELWISE is t or any other non-nil value, return
1998the width as an integer number of pixels.
1999Otherwise return the value as an integer number of columns of the face
2000used to display line numbers, `line-number'. Note that in the latter
2001case, the value doesn't include the 2 columns used for padding the
2002numbers on display. */)
1992 (Lisp_Object pixelwise) 2003 (Lisp_Object pixelwise)
1993{ 2004{
1994 int width, pixel_width; 2005 int width, pixel_width;
2006 struct window *w = XWINDOW (selected_window);
1995 line_number_display_width (XWINDOW (selected_window), &width, &pixel_width); 2007 line_number_display_width (XWINDOW (selected_window), &width, &pixel_width);
1996 if (!NILP (pixelwise)) 2008 if (EQ (pixelwise, Qcolumns))
2009 {
2010 struct frame *f = XFRAME (w->frame);
2011 return make_float ((double) pixel_width / FRAME_COLUMN_WIDTH (f));
2012 }
2013 else if (!NILP (pixelwise))
1997 return make_number (pixel_width); 2014 return make_number (pixel_width);
1998 return make_number (width); 2015 return make_number (width);
1999} 2016}
@@ -2355,6 +2372,8 @@ syms_of_indent (void)
2355 doc: /* Indentation can insert tabs if this is non-nil. */); 2372 doc: /* Indentation can insert tabs if this is non-nil. */);
2356 indent_tabs_mode = 1; 2373 indent_tabs_mode = 1;
2357 2374
2375 DEFSYM (Qcolumns, "columns");
2376
2358 defsubr (&Scurrent_indentation); 2377 defsubr (&Scurrent_indentation);
2359 defsubr (&Sindent_to); 2378 defsubr (&Sindent_to);
2360 defsubr (&Scurrent_column); 2379 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,
3943int 3943int
3944faccessat (int dirfd, const char * path, int mode, int flags) 3944faccessat (int dirfd, const char * path, int mode, int flags)
3945{ 3945{
3946 char fullname[MAXPATHLEN];
3947
3946 /* We silently ignore FLAGS. */ 3948 /* We silently ignore FLAGS. */
3947 flags = flags; 3949 flags = flags;
3948 3950
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/>. */
21 21
22#include <dpmi.h> 22#include <dpmi.h>
23 23
24#include "termhooks.h" /* struct terminal */
25
24int dos_ttraw (struct tty_display_info *); 26int dos_ttraw (struct tty_display_info *);
25int dos_ttcooked (void); 27int dos_ttcooked (void);
26int dos_get_saved_screen (char **, int *, int *); 28int dos_get_saved_screen (char **, int *, int *);
@@ -67,6 +69,7 @@ void syms_of_win16select (void);
67 69
68/* Constants. */ 70/* Constants. */
69#define EINPROGRESS 112 71#define EINPROGRESS 112
72#define ENOTSUP ENOSYS
70/* Gnulib sets O_CLOEXEC to O_NOINHERIT, which gets in the way when we 73/* Gnulib sets O_CLOEXEC to O_NOINHERIT, which gets in the way when we
71 need to redirect standard handles for subprocesses using temporary 74 need to redirect standard handles for subprocesses using temporary
72 files created by mkostemp, see callproc.c. */ 75 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;
423 } 423 }
424 424
425 425
426/* GNUstep always shows decorations if the window is resizable, 426/* These flags will be OR'd or XOR'd with the NSWindow's styleMask
427 miniaturizable or closable, but Cocoa does strange things in native
428 fullscreen mode if you don't have at least resizable enabled.
429
430 These flags will be OR'd or XOR'd with the NSWindow's styleMask
431 property depending on what we're doing. */ 427 property depending on what we're doing. */
432#ifdef NS_IMPL_COCOA
433#define FRAME_DECORATED_FLAGS NSWindowStyleMaskTitled
434#else
435#define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \ 428#define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \
436 | NSWindowStyleMaskResizable \ 429 | NSWindowStyleMaskResizable \
437 | NSWindowStyleMaskMiniaturizable \ 430 | NSWindowStyleMaskMiniaturizable \
438 | NSWindowStyleMaskClosable) 431 | NSWindowStyleMaskClosable)
439#endif
440#define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless 432#define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless
441 433
442/* TODO: get rid of need for these forward declarations */ 434/* TODO: get rid of need for these forward declarations */
@@ -7211,15 +7203,9 @@ not_in_argv (NSString *arg)
7211 7203
7212 win = [[EmacsWindow alloc] 7204 win = [[EmacsWindow alloc]
7213 initWithContentRect: r 7205 initWithContentRect: r
7214 styleMask: ((FRAME_UNDECORATED (f) 7206 styleMask: (FRAME_UNDECORATED (f)
7215 ? FRAME_UNDECORATED_FLAGS 7207 ? FRAME_UNDECORATED_FLAGS
7216 : FRAME_DECORATED_FLAGS) 7208 : FRAME_DECORATED_FLAGS)
7217#ifdef NS_IMPL_COCOA
7218 | NSWindowStyleMaskResizable
7219 | NSWindowStyleMaskMiniaturizable
7220 | NSWindowStyleMaskClosable
7221#endif
7222 )
7223 backing: NSBackingStoreBuffered 7209 backing: NSBackingStoreBuffered
7224 defer: YES]; 7210 defer: YES];
7225 7211
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/>. */
40#include <netinet/in.h> 40#include <netinet/in.h>
41#include <arpa/inet.h> 41#include <arpa/inet.h>
42 42
43#endif /* subprocesses */
44
43#ifdef HAVE_SETRLIMIT 45#ifdef HAVE_SETRLIMIT
44# include <sys/resource.h> 46# include <sys/resource.h>
45 47
@@ -49,6 +51,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
49static struct rlimit nofile_limit; 51static struct rlimit nofile_limit;
50#endif 52#endif
51 53
54#ifdef subprocesses
55
52/* Are local (unix) sockets supported? */ 56/* Are local (unix) sockets supported? */
53#if defined (HAVE_SYS_UN_H) 57#if defined (HAVE_SYS_UN_H)
54#if !defined (AF_LOCAL) && defined (AF_UNIX) 58#if !defined (AF_LOCAL) && defined (AF_UNIX)
@@ -3830,7 +3834,7 @@ usage: (make-network-process &rest ARGS) */)
3830 Lisp_Object proc; 3834 Lisp_Object proc;
3831 Lisp_Object contact; 3835 Lisp_Object contact;
3832 struct Lisp_Process *p; 3836 struct Lisp_Process *p;
3833 const char *portstring; 3837 const char *portstring UNINIT;
3834 ptrdiff_t portstringlen ATTRIBUTE_UNUSED; 3838 ptrdiff_t portstringlen ATTRIBUTE_UNUSED;
3835 char portbuf[INT_BUFSIZE_BOUND (EMACS_INT)]; 3839 char portbuf[INT_BUFSIZE_BOUND (EMACS_INT)];
3836#ifdef HAVE_LOCAL_SOCKETS 3840#ifdef HAVE_LOCAL_SOCKETS
@@ -7455,6 +7459,13 @@ keyboard_bit_set (fd_set *mask)
7455 7459
7456#else /* not subprocesses */ 7460#else /* not subprocesses */
7457 7461
7462/* This is referenced in thread.c:run_thread (which is never actually
7463 called, since threads are not enabled for this configuration. */
7464void
7465update_processes_for_thread_death (Lisp_Object dying_thread)
7466{
7467}
7468
7458/* Defined in msdos.c. */ 7469/* Defined in msdos.c. */
7459extern int sys_select (int, fd_set *, fd_set *, fd_set *, 7470extern int sys_select (int, fd_set *, fd_set *, fd_set *,
7460 struct timespec *, void *); 7471 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)
831 pthread_sigmask (SIG_SETMASK, oldset, 0); 831 pthread_sigmask (SIG_SETMASK, oldset, 0);
832} 832}
833 833
834#endif /* !MSDOS */
835
834/* Block SIGINT. */ 836/* Block SIGINT. */
835void 837void
836block_interrupt_signal (sigset_t *oldset) 838block_interrupt_signal (sigset_t *oldset)
@@ -848,7 +850,6 @@ restore_signal_mask (sigset_t const *oldset)
848 pthread_sigmask (SIG_SETMASK, oldset, 0); 850 pthread_sigmask (SIG_SETMASK, oldset, 0);
849} 851}
850 852
851#endif /* !MSDOS */
852 853
853/* Saving and restoring the process group of Emacs's terminal. */ 854/* Saving and restoring the process group of Emacs's terminal. */
854 855
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;
50#endif 50#endif
51 51
52#ifdef MSDOS 52#ifdef MSDOS
53/* The above #define for 'select' gets in the way because sysselect.h
54 is included in thread.h, which is included everywhere, and 'select'
55 declared in DJGPP system headers has a signature incompatible with
56 'pselect', which we emulate in msdos.c. */
57#undef select
53#define pselect sys_select 58#define pselect sys_select
54#endif 59#endif
55 60
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)
187 187
188#elif defined (WINDOWSNT) 188#elif defined (WINDOWSNT)
189 189
190#include <windows.h> 190#include <w32term.h>
191 191
192/* Cannot include <process.h> because of the local header by the same 192/* Cannot include <process.h> because of the local header by the same
193 name, sigh. */ 193 name, sigh. */
@@ -326,8 +326,9 @@ sys_thread_self (void)
326static thread_creation_function *thread_start_address; 326static thread_creation_function *thread_start_address;
327 327
328/* _beginthread wants a void function, while we are passed a function 328/* _beginthread wants a void function, while we are passed a function
329 that returns a pointer. So we use a wrapper. */ 329 that returns a pointer. So we use a wrapper. See the command in
330static void 330 w32term.h about the need for ALIGN_STACK attribute. */
331static void ALIGN_STACK
331w32_beginthread_wrapper (void *arg) 332w32_beginthread_wrapper (void *arg)
332{ 333{
333 (void)thread_start_address (arg); 334 (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. */)
806 { 806 {
807 /* Restore the previous situation. */ 807 /* Restore the previous situation. */
808 all_threads = all_threads->next_thread; 808 all_threads = all_threads->next_thread;
809#ifdef THREADS_ENABLED
809 error ("Could not start a new thread"); 810 error ("Could not start a new thread");
811#else
812 error ("Concurrency is not supported in this configuration");
813#endif
810 } 814 }
811 815
812 /* FIXME: race here where new thread might not be filled in? */ 816 /* 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/>. */
25#include <sys/socket.h> 25#include <sys/socket.h>
26#endif 26#endif
27 27
28#ifdef MSDOS
29#include <signal.h> /* sigset_t */
30#endif
31
28#include "sysselect.h" /* FIXME */ 32#include "sysselect.h" /* FIXME */
29#include "systime.h" /* FIXME */ 33#include "systime.h" /* FIXME */
30#include "systhread.h" 34#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. */)
5847 that are needed to determine window geometry. */ 5847 that are needed to determine window geometry. */
5848 x_default_font_parameter (f, parameters); 5848 x_default_font_parameter (f, parameters);
5849 5849
5850 x_default_parameter (f, parameters, Qborder_width, make_number (2), 5850 /* Default BorderWidth to 0 to match other platforms. */
5851 x_default_parameter (f, parameters, Qborder_width, make_number (0),
5851 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); 5852 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
5852 5853
5853 /* We recognize either internalBorderWidth or internalBorder 5854 /* We recognize either internalBorderWidth or internalBorder
@@ -5862,7 +5863,7 @@ This function is an internal primitive--use `make-frame' instead. */)
5862 parameters = Fcons (Fcons (Qinternal_border_width, value), 5863 parameters = Fcons (Fcons (Qinternal_border_width, value),
5863 parameters); 5864 parameters);
5864 } 5865 }
5865 /* Default internalBorderWidth to 0 on Windows to match other programs. */ 5866
5866 x_default_parameter (f, parameters, Qinternal_border_width, make_number (0), 5867 x_default_parameter (f, parameters, Qinternal_border_width, make_number (0),
5867 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER); 5868 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER);
5868 x_default_parameter (f, parameters, Qright_divider_width, make_number (0), 5869 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/>. */
22#include "frame.h" 22#include "frame.h"
23#include "atimer.h" 23#include "atimer.h"
24 24
25/* Stack alignment stuff. Every CALLBACK function should have the 25/* Stack alignment stuff. Every CALLBACK and thread function should
26 ALIGN_STACK attribute if it manipulates Lisp objects, because 26 have the ALIGN_STACK attribute if it manipulates Lisp objects,
27 Windows x86 32-bit ABI only guarantees 4-byte stack alignment, and 27 because Windows x86 32-bit ABI only guarantees 4-byte stack
28 that is what we will get when a Windows function calls us. The 28 alignment, and that is what we will get when a Windows function
29 ALIGN_STACK attribute forces GCC to emit a preamble code to 29 calls us. The ALIGN_STACK attribute forces GCC to emit a preamble
30 re-align the stack at function entry. Further details about this 30 code to re-align the stack at function entry. Further details
31 can be found in http://www.peterstock.co.uk/games/mingw_sse/. */ 31 about this can be found in
32 http://www.peterstock.co.uk/games/mingw_sse/. */
32#ifdef __GNUC__ 33#ifdef __GNUC__
33# if USE_STACK_LISP_OBJECTS && !defined _WIN64 && !defined __x86_64__ \ 34# if USE_STACK_LISP_OBJECTS && !defined _WIN64 && !defined __x86_64__ \
34 && __GNUC__ + (__GNUC_MINOR__ > 1) >= 5 35 && __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)
20889 && it->w->base_line_pos <= IT_CHARPOS (*it) 20889 && it->w->base_line_pos <= IT_CHARPOS (*it)
20890 /* line-number-mode always displays narrowed line 20890 /* line-number-mode always displays narrowed line
20891 numbers, so we cannot use its data if the user wants 20891 numbers, so we cannot use its data if the user wants
20892 line numbers that disregard narrowing. */ 20892 line numbers that disregard narrowing, or if the
20893 buffer's narrowing has just changed. */
20893 && !(display_line_numbers_widen 20894 && !(display_line_numbers_widen
20894 && (BEG_BYTE != BEGV_BYTE || Z_BYTE != ZV_BYTE))) 20895 && (BEG_BYTE != BEGV_BYTE || Z_BYTE != ZV_BYTE))
20896 && !current_buffer->clip_changed)
20895 { 20897 {
20896 start_from = CHAR_TO_BYTE (it->w->base_line_pos); 20898 start_from = CHAR_TO_BYTE (it->w->base_line_pos);
20897 last_line = it->w->base_line_number - 1; 20899 last_line = it->w->base_line_number - 1;
@@ -25121,7 +25123,20 @@ else if the text is replaced by an ellipsis. */)
25121 '(space :width (+ left-fringe left-margin (- (1)))) 25123 '(space :width (+ left-fringe left-margin (- (1))))
25122 '(space :width (+ left-fringe left-margin (-1))) 25124 '(space :width (+ left-fringe left-margin (-1)))
25123 25125
25124*/ 25126 If ALIGN_TO is NULL, returns the result in *RES. If ALIGN_TO is
25127 non-NULL, the value of *ALIGN_TO is a window-relative pixel
25128 coordinate, and *RES is the additional pixel width from that point
25129 till the end of the stretch glyph.
25130
25131 WIDTH_P non-zero means take the width dimension or X coordinate of
25132 the object specified by PROP, WIDTH_P zero means take the height
25133 dimension or the Y coordinate. (Therefore, if ALIGN_TO is
25134 non-NULL, WIDTH_P should be non-zero.)
25135
25136 FONT is the font of the face of the surrounding text.
25137
25138 The return value is non-zero if width or height were successfully
25139 calculated, i.e. if PROP is a valid spec. */
25125 25140
25126static bool 25141static bool
25127calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, 25142calc_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,
25143 { 25158 {
25144 char *unit = SSDATA (SYMBOL_NAME (prop)); 25159 char *unit = SSDATA (SYMBOL_NAME (prop));
25145 25160
25161 /* The UNIT expression, e.g. as part of (NUM . UNIT). */
25146 if (unit[0] == 'i' && unit[1] == 'n') 25162 if (unit[0] == 'i' && unit[1] == 'n')
25147 pixels = 1.0; 25163 pixels = 1.0;
25148 else if (unit[0] == 'm' && unit[1] == 'm') 25164 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,
25163 } 25179 }
25164 25180
25165#ifdef HAVE_WINDOW_SYSTEM 25181#ifdef HAVE_WINDOW_SYSTEM
25182 /* 'height': the height of FONT. */
25166 if (EQ (prop, Qheight)) 25183 if (EQ (prop, Qheight))
25167 return OK_PIXELS (font 25184 return OK_PIXELS (font
25168 ? normal_char_height (font, -1) 25185 ? normal_char_height (font, -1)
25169 : FRAME_LINE_HEIGHT (it->f)); 25186 : FRAME_LINE_HEIGHT (it->f));
25187 /* 'width': the width of FONT. */
25170 if (EQ (prop, Qwidth)) 25188 if (EQ (prop, Qwidth))
25171 return OK_PIXELS (font 25189 return OK_PIXELS (font
25172 ? FONT_WIDTH (font) 25190 ? FONT_WIDTH (font)
@@ -25176,33 +25194,48 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
25176 return OK_PIXELS (1); 25194 return OK_PIXELS (1);
25177#endif 25195#endif
25178 25196
25197 /* 'text': the width or height of the text area. */
25179 if (EQ (prop, Qtext)) 25198 if (EQ (prop, Qtext))
25180 return OK_PIXELS (width_p 25199 return OK_PIXELS (width_p
25181 ? window_box_width (it->w, TEXT_AREA) 25200 ? (window_box_width (it->w, TEXT_AREA)
25201 - it->lnum_pixel_width)
25182 : WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w)); 25202 : WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w));
25183 25203
25204 /* ':align_to'. First time we compute the value, window
25205 elements are interpreted as the position of the element's
25206 left edge. */
25184 if (align_to && *align_to < 0) 25207 if (align_to && *align_to < 0)
25185 { 25208 {
25186 *res = 0; 25209 *res = 0;
25210 /* 'left': left edge of the text area. */
25187 if (EQ (prop, Qleft)) 25211 if (EQ (prop, Qleft))
25188 return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA)); 25212 return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA)
25213 + it->lnum_pixel_width);
25214 /* 'right': right edge of the text area. */
25189 if (EQ (prop, Qright)) 25215 if (EQ (prop, Qright))
25190 return OK_ALIGN_TO (window_box_right_offset (it->w, TEXT_AREA)); 25216 return OK_ALIGN_TO (window_box_right_offset (it->w, TEXT_AREA));
25217 /* 'center': the center of the text area. */
25191 if (EQ (prop, Qcenter)) 25218 if (EQ (prop, Qcenter))
25192 return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA) 25219 return OK_ALIGN_TO (window_box_left_offset (it->w, TEXT_AREA)
25220 + it->lnum_pixel_width
25193 + window_box_width (it->w, TEXT_AREA) / 2); 25221 + window_box_width (it->w, TEXT_AREA) / 2);
25222 /* 'left-fringe': left edge of the left fringe. */
25194 if (EQ (prop, Qleft_fringe)) 25223 if (EQ (prop, Qleft_fringe))
25195 return OK_ALIGN_TO (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w) 25224 return OK_ALIGN_TO (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
25196 ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (it->w) 25225 ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (it->w)
25197 : window_box_right_offset (it->w, LEFT_MARGIN_AREA)); 25226 : window_box_right_offset (it->w, LEFT_MARGIN_AREA));
25227 /* 'right-fringe': left edge of the right fringe. */
25198 if (EQ (prop, Qright_fringe)) 25228 if (EQ (prop, Qright_fringe))
25199 return OK_ALIGN_TO (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w) 25229 return OK_ALIGN_TO (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
25200 ? window_box_right_offset (it->w, RIGHT_MARGIN_AREA) 25230 ? window_box_right_offset (it->w, RIGHT_MARGIN_AREA)
25201 : window_box_right_offset (it->w, TEXT_AREA)); 25231 : window_box_right_offset (it->w, TEXT_AREA));
25232 /* 'left-margin': left edge of the left display margin. */
25202 if (EQ (prop, Qleft_margin)) 25233 if (EQ (prop, Qleft_margin))
25203 return OK_ALIGN_TO (window_box_left_offset (it->w, LEFT_MARGIN_AREA)); 25234 return OK_ALIGN_TO (window_box_left_offset (it->w, LEFT_MARGIN_AREA));
25235 /* 'right-margin': left edge of the right display margin. */
25204 if (EQ (prop, Qright_margin)) 25236 if (EQ (prop, Qright_margin))
25205 return OK_ALIGN_TO (window_box_left_offset (it->w, RIGHT_MARGIN_AREA)); 25237 return OK_ALIGN_TO (window_box_left_offset (it->w, RIGHT_MARGIN_AREA));
25238 /* 'scroll-bar': left edge of the vertical scroll bar. */
25206 if (EQ (prop, Qscroll_bar)) 25239 if (EQ (prop, Qscroll_bar))
25207 return OK_ALIGN_TO (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (it->w) 25240 return OK_ALIGN_TO (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (it->w)
25208 ? 0 25241 ? 0
@@ -25213,6 +25246,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
25213 } 25246 }
25214 else 25247 else
25215 { 25248 {
25249 /* Otherwise, the elements stand for their width. */
25216 if (EQ (prop, Qleft_fringe)) 25250 if (EQ (prop, Qleft_fringe))
25217 return OK_PIXELS (WINDOW_LEFT_FRINGE_WIDTH (it->w)); 25251 return OK_PIXELS (WINDOW_LEFT_FRINGE_WIDTH (it->w));
25218 if (EQ (prop, Qright_fringe)) 25252 if (EQ (prop, Qright_fringe))
@@ -25235,6 +25269,8 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
25235 int base_unit = (width_p 25269 int base_unit = (width_p
25236 ? FRAME_COLUMN_WIDTH (it->f) 25270 ? FRAME_COLUMN_WIDTH (it->f)
25237 : FRAME_LINE_HEIGHT (it->f)); 25271 : FRAME_LINE_HEIGHT (it->f));
25272 if (width_p && align_to && *align_to < 0)
25273 return OK_PIXELS (XFLOATINT (prop) * base_unit + it->lnum_pixel_width);
25238 return OK_PIXELS (XFLOATINT (prop) * base_unit); 25274 return OK_PIXELS (XFLOATINT (prop) * base_unit);
25239 } 25275 }
25240 25276
@@ -25246,6 +25282,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
25246 if (SYMBOLP (car)) 25282 if (SYMBOLP (car))
25247 { 25283 {
25248#ifdef HAVE_WINDOW_SYSTEM 25284#ifdef HAVE_WINDOW_SYSTEM
25285 /* '(image PROPS...)': width or height of the specified image. */
25249 if (FRAME_WINDOW_P (it->f) 25286 if (FRAME_WINDOW_P (it->f)
25250 && valid_image_p (prop)) 25287 && valid_image_p (prop))
25251 { 25288 {
@@ -25254,12 +25291,15 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
25254 25291
25255 return OK_PIXELS (width_p ? img->width : img->height); 25292 return OK_PIXELS (width_p ? img->width : img->height);
25256 } 25293 }
25294 /* '(xwidget PROPS...)': dimensions of the specified xwidget. */
25257 if (FRAME_WINDOW_P (it->f) && valid_xwidget_spec_p (prop)) 25295 if (FRAME_WINDOW_P (it->f) && valid_xwidget_spec_p (prop))
25258 { 25296 {
25259 /* TODO: Don't return dummy size. */ 25297 /* TODO: Don't return dummy size. */
25260 return OK_PIXELS (100); 25298 return OK_PIXELS (100);
25261 } 25299 }
25262#endif 25300#endif
25301 /* '(+ EXPR...)' or '(- EXPR...)' add or subtract
25302 recursively calculated values. */
25263 if (EQ (car, Qplus) || EQ (car, Qminus)) 25303 if (EQ (car, Qplus) || EQ (car, Qminus))
25264 { 25304 {
25265 bool first = true; 25305 bool first = true;
@@ -25287,15 +25327,18 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
25287 car = Qnil; 25327 car = Qnil;
25288 } 25328 }
25289 25329
25330 /* '(NUM)': absolute number of pixels. */
25290 if (NUMBERP (car)) 25331 if (NUMBERP (car))
25291 { 25332 {
25292 double fact; 25333 double fact;
25334 int offset =
25335 width_p && align_to && *align_to < 0 ? it->lnum_pixel_width : 0;
25293 pixels = XFLOATINT (car); 25336 pixels = XFLOATINT (car);
25294 if (NILP (cdr)) 25337 if (NILP (cdr))
25295 return OK_PIXELS (pixels); 25338 return OK_PIXELS (pixels + offset);
25296 if (calc_pixel_width_or_height (&fact, it, cdr, 25339 if (calc_pixel_width_or_height (&fact, it, cdr,
25297 font, width_p, align_to)) 25340 font, width_p, align_to))
25298 return OK_PIXELS (pixels * fact); 25341 return OK_PIXELS (pixels * fact + offset);
25299 return false; 25342 return false;
25300 } 25343 }
25301 25344