From 368e140660bf84e91c67c87c47b73cfb2ea25476 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Thu, 11 Jun 2020 23:10:07 +0200 Subject: Avoid crashes in 'defconst' * src/eval.c (Fdefconst): Verify that SYMBOL is a known symbol. (Bug#41817) --- src/eval.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/eval.c b/src/eval.c index 014905ce6df..16c36fa284c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -831,6 +831,7 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) Lisp_Object sym, tem; sym = XCAR (args); + CHECK_SYMBOL (sym); Lisp_Object docstring = Qnil; if (!NILP (XCDR (XCDR (args)))) { -- cgit v1.2.1 From bb1a9481c9044ced4b7d7f514557b5ab508f80db Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 26 Jun 2020 15:01:44 +0300 Subject: Fix posn-at-point at beginning of a display string * src/xdisp.c (pos_visible_p): Account for the line-number width when the display string at CHARPOS ends in a newline. (Bug#42039) --- src/xdisp.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/xdisp.c b/src/xdisp.c index a280b48de99..15901af9a8d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1782,6 +1782,12 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, start_display (&it3, w, top); if (start > CHARPOS (top)) move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); + /* Record the line-number width, if any. Do it here, + before subsequent calls to start_display etc. reset + the line_number_produced_p flag, and we can no + longer be sure we are not using stale info. */ + int lnum_pixel_width = + it3.line_number_produced_p ? it3.lnum_pixel_width : 0; /* Move forward one more line if the position before the display string is a newline or if it is the rightmost character on a line that is @@ -1850,10 +1856,14 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, top_x = it3.current_x - it3.pixel_width; /* Account for line-number display, if IT3 still didn't. This can happen if START - 1 is the - first character on its display line. */ - if (!it3.line_number_produced_p - && it.line_number_produced_p) - top_x += it.lnum_pixel_width; + first or the last character on its display line. */ + if (!it3.line_number_produced_p) + { + if (lnum_pixel_width > 0) + top_x += lnum_pixel_width; + else if (it.line_number_produced_p) + top_x += it.lnum_pixel_width; + } /* Normally, we would exit the above loop because we found the display element whose character position is CHARPOS. For the contingency that we -- cgit v1.2.1 From 5280e118c07d738321f61b3f2bc3cd27a5ac8dbc Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 26 Jun 2020 16:34:50 +0300 Subject: ; * src/xdisp.c (pos_visible_p): Fix last change. (Bug#42039) --- src/xdisp.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/xdisp.c b/src/xdisp.c index 15901af9a8d..2aff120bc80 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1782,12 +1782,6 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, start_display (&it3, w, top); if (start > CHARPOS (top)) move_it_to (&it3, start - 1, -1, -1, -1, MOVE_TO_POS); - /* Record the line-number width, if any. Do it here, - before subsequent calls to start_display etc. reset - the line_number_produced_p flag, and we can no - longer be sure we are not using stale info. */ - int lnum_pixel_width = - it3.line_number_produced_p ? it3.lnum_pixel_width : 0; /* Move forward one more line if the position before the display string is a newline or if it is the rightmost character on a line that is @@ -1857,13 +1851,10 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, /* Account for line-number display, if IT3 still didn't. This can happen if START - 1 is the first or the last character on its display line. */ - if (!it3.line_number_produced_p) - { - if (lnum_pixel_width > 0) - top_x += lnum_pixel_width; - else if (it.line_number_produced_p) - top_x += it.lnum_pixel_width; - } + if (it3.lnum_pixel_width > 0) + top_x += it3.lnum_pixel_width; + else if (it.line_number_produced_p) + top_x += it.lnum_pixel_width; /* Normally, we would exit the above loop because we found the display element whose character position is CHARPOS. For the contingency that we -- cgit v1.2.1