aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorPaul Eggert2020-01-07 11:23:11 -0800
committerPaul Eggert2020-01-07 11:29:42 -0800
commit724af7671590cd91df37f64df6be73f6dca0144d (patch)
tree075df63dcdc3653ff710ce49a5f238c165d0f0c1 /src/window.c
parentf950b078a6f2fd011312e9471998edf6b5fb957e (diff)
downloademacs-724af7671590cd91df37f64df6be73f6dca0144d.tar.gz
emacs-724af7671590cd91df37f64df6be73f6dca0144d.zip
Fix sxhash-equal on bytecodes, markers, etc.
Problem reported by Pip Cet (Bug#38912#14). * doc/lispref/objects.texi (Equality Predicates): Document better when ‘equal’ looks inside objects. * doc/lispref/windows.texi (Window Configurations): Don’t say that ‘equal’ looks inside window configurations. * etc/NEWS: Mention the change. * src/fns.c (internal_equal): Do not look inside window configurations. (sxhash_obj): Hash markers, byte-code function objects, char-tables, and font objects consistently with Fequal. * src/window.c (compare_window_configurations): Now static. Remove last argument. Caller changed. * test/lisp/ffap-tests.el (ffap-other-window--bug-25352): Use compare-window-configurations, not ‘equal’. * test/src/fns-tests.el (test-sxhash-equal): New test.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/window.c b/src/window.c
index ff17cd88f38..8cdad27b664 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7976,19 +7976,17 @@ foreach_window_1 (struct window *w, bool (*fn) (struct window *, void *),
7976/* Return true if window configurations CONFIGURATION1 and CONFIGURATION2 7976/* Return true if window configurations CONFIGURATION1 and CONFIGURATION2
7977 describe the same state of affairs. This is used by Fequal. 7977 describe the same state of affairs. This is used by Fequal.
7978 7978
7979 IGNORE_POSITIONS means ignore non-matching scroll positions 7979 Ignore non-matching scroll positions and the like.
7980 and the like.
7981 7980
7982 This ignores a couple of things like the dedication status of 7981 This ignores a couple of things like the dedication status of
7983 window, combination_limit and the like. This might have to be 7982 window, combination_limit and the like. This might have to be
7984 fixed. */ 7983 fixed. */
7985 7984
7986bool 7985static bool
7987compare_window_configurations (Lisp_Object configuration1, 7986compare_window_configurations (Lisp_Object configuration1,
7988 Lisp_Object configuration2, 7987 Lisp_Object configuration2)
7989 bool ignore_positions)
7990{ 7988{
7991 register struct save_window_data *d1, *d2; 7989 struct save_window_data *d1, *d2;
7992 struct Lisp_Vector *sws1, *sws2; 7990 struct Lisp_Vector *sws1, *sws2;
7993 ptrdiff_t i; 7991 ptrdiff_t i;
7994 7992
@@ -8006,9 +8004,6 @@ compare_window_configurations (Lisp_Object configuration1,
8006 || d1->frame_menu_bar_lines != d2->frame_menu_bar_lines 8004 || d1->frame_menu_bar_lines != d2->frame_menu_bar_lines
8007 || !EQ (d1->selected_frame, d2->selected_frame) 8005 || !EQ (d1->selected_frame, d2->selected_frame)
8008 || !EQ (d1->f_current_buffer, d2->f_current_buffer) 8006 || !EQ (d1->f_current_buffer, d2->f_current_buffer)
8009 || (!ignore_positions
8010 && (!EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window)
8011 || !EQ (d1->minibuf_selected_window, d2->minibuf_selected_window)))
8012 || !EQ (d1->focus_frame, d2->focus_frame) 8007 || !EQ (d1->focus_frame, d2->focus_frame)
8013 /* Verify that the two configurations have the same number of windows. */ 8008 /* Verify that the two configurations have the same number of windows. */
8014 || sws1->header.size != sws2->header.size) 8009 || sws1->header.size != sws2->header.size)
@@ -8041,12 +8036,6 @@ compare_window_configurations (Lisp_Object configuration1,
8041 equality. */ 8036 equality. */
8042 || !EQ (sw1->parent, sw2->parent) 8037 || !EQ (sw1->parent, sw2->parent)
8043 || !EQ (sw1->prev, sw2->prev) 8038 || !EQ (sw1->prev, sw2->prev)
8044 || (!ignore_positions
8045 && (!EQ (sw1->hscroll, sw2->hscroll)
8046 || !EQ (sw1->min_hscroll, sw2->min_hscroll)
8047 || !EQ (sw1->start_at_line_beg, sw2->start_at_line_beg)
8048 || NILP (Fequal (sw1->start, sw2->start))
8049 || NILP (Fequal (sw1->pointm, sw2->pointm))))
8050 || !EQ (sw1->left_margin_cols, sw2->left_margin_cols) 8039 || !EQ (sw1->left_margin_cols, sw2->left_margin_cols)
8051 || !EQ (sw1->right_margin_cols, sw2->right_margin_cols) 8040 || !EQ (sw1->right_margin_cols, sw2->right_margin_cols)
8052 || !EQ (sw1->left_fringe_width, sw2->left_fringe_width) 8041 || !EQ (sw1->left_fringe_width, sw2->left_fringe_width)
@@ -8071,7 +8060,7 @@ This function ignores details such as the values of point
8071and scrolling positions. */) 8060and scrolling positions. */)
8072 (Lisp_Object x, Lisp_Object y) 8061 (Lisp_Object x, Lisp_Object y)
8073{ 8062{
8074 if (compare_window_configurations (x, y, true)) 8063 if (compare_window_configurations (x, y))
8075 return Qt; 8064 return Qt;
8076 return Qnil; 8065 return Qnil;
8077} 8066}