Subject: bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup

From: martin rudalics <[email-masked]>
Date: Thu, 06 Jul 2017 09:08:13 +0200

> This hook ws introduced for linum.el, but linum.el as added to Emacs
 > never used it.  We should delete the hook and any references to it in
 > the manuals.

The attached patch tries to restore the state before its introduction.

martin
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi
index 0ac5b08..6443464 100644
--- a/doc/lispref/hooks.texi
+++ b/doc/lispref/hooks.texi
@@ -241,11 +241,6 @@ Standard Hooks
 @itemx window-scroll-functions
 @itemx window-size-change-functions
 @xref{Window Hooks}.
-
-@item window-text-change-functions
-@vindex window-text-change-functions
-Functions to call in redisplay when text in the window might change.
-
 @end table

 @ignore
diff --git a/src/xdisp.c b/src/xdisp.c
index 8bc5d81..bd60ed2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16431,9 +16431,8 @@ enum
   eassert (XMARKER (w->start)->buffer == buffer);
   eassert (XMARKER (w->pointm)->buffer == buffer);

-  /* We come here again if we need to run window-text-change-functions
-     below.  */
- restart:
+  specbind (Qinhibit_point_motion_hooks, Qt);
+
   reconsider_clip_changes (w);
   frame_line_height = default_line_pixel_height (w);
   margin = window_scroll_margin (w, MARGIN_IN_LINES);
@@ -16492,6 +16491,10 @@ enum
   /* Really select the buffer, for the sake of buffer-local
      variables.  */
   set_buffer_internal_1 (XBUFFER (w->contents));
+  SET_TEXT_POS (opoint, PT, PT_BYTE);
+
+  beg_unchanged = BEG_UNCHANGED;
+  end_unchanged = END_UNCHANGED;

   current_matrix_up_to_date_p
     = (w->window_end_valid
@@ -16500,23 +16503,6 @@ enum
        && !window_outdated (w)
        && !hscrolling_current_line_p (w));

-  /* Run the window-text-change-functions
-     if it is possible that the text on the screen has changed
-     (either due to modification of the text, or any other reason).  */
-  if (!current_matrix_up_to_date_p
-      && !NILP (Vwindow_text_change_functions))
-    {
-      safe_run_hooks (Qwindow_text_change_functions);
-      goto restart;
-    }
-
-  beg_unchanged = BEG_UNCHANGED;
-  end_unchanged = END_UNCHANGED;
-
-  SET_TEXT_POS (opoint, PT, PT_BYTE);
-
-  specbind (Qinhibit_point_motion_hooks, Qt);
-
   buffer_unchanged_p
     = (w->window_end_valid
        && !current_buffer->clip_changed
@@ -31692,7 +31678,6 @@ A polygon is a cons (poly . [x0 y0 x1 y1 ...]) where each pair in the
   DEFSYM (Qoverriding_terminal_local_map, "overriding-terminal-local-map");
   DEFSYM (Qoverriding_local_map, "overriding-local-map");
   DEFSYM (Qwindow_scroll_functions, "window-scroll-functions");
-  DEFSYM (Qwindow_text_change_functions, "window-text-change-functions");
   DEFSYM (Qredisplay_end_trigger_functions, "redisplay-end-trigger-functions");
   DEFSYM (Qinhibit_point_motion_hooks, "inhibit-point-motion-hooks");
   DEFSYM (Qeval, "eval");
@@ -32016,11 +32001,6 @@ either to point into another buffer (e.g. via `set-window-buffer') or another
 work.  */);
   Vwindow_scroll_functions = Qnil;

-  DEFVAR_LISP ("window-text-change-functions",
-	       Vwindow_text_change_functions,
-    doc: /* Functions to call in redisplay when text in the window might change.  */);
-  Vwindow_text_change_functions = Qnil;
-
   DEFVAR_LISP ("redisplay-end-trigger-functions", Vredisplay_end_trigger_functions,
     doc: /* Functions called when redisplay of a window reaches the end trigger.
 Each function is called with two arguments, the window and the end trigger value.