emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: linum.el?


From: Richard Stallman
Subject: Re: linum.el?
Date: Sun, 23 Dec 2007 16:12:12 -0500

Regarding `window-bottom-change-functions', the first question is.
can linum.el do the job using `set-window-redisplay-end-trigger'
instead of this hook?

In regard to the patch to implement the hook, I see two problems.

First, calling that hook could make changes that would invalidate data
already computed earlier in redisplay_window.  So it is necessary to
jump back to the top.  I think I have implemented this, and I include
a revised patch below.

Does it work?

Second, the code will run this hook whenever there is any possibility
that the text to be displayed has changed for any reason.
The name implies a much narrower condition, so it is somewhat misleading.
So I changed the name to `window-text-change-functions'.



*** xdisp.c     06 Dec 2007 08:27:01 -0500      1.1174
--- xdisp.c     23 Dec 2007 16:00:30 -0500      
***************
*** 232,237 ****
--- 232,238 ----
  
  Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
  Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
+ Lisp_Object Qwindow_text_change_functions, Vwindow_text_change_functions;
  Lisp_Object Qredisplay_end_trigger_functions, 
Vredisplay_end_trigger_functions;
  Lisp_Object Qinhibit_point_motion_hooks;
  Lisp_Object QCeval, QCfile, QCdata, QCpropertize;
***************
*** 12892,12899 ****
    *w->desired_matrix->method = 0;
  #endif
  
!   specbind (Qinhibit_point_motion_hooks, Qt);
! 
    reconsider_clip_changes (w, buffer);
  
    /* Has the mode line to be updated?  */
--- 12893,12899 ----
    *w->desired_matrix->method = 0;
  #endif
  
!  restart:
    reconsider_clip_changes (w, buffer);
  
    /* Has the mode line to be updated?  */
***************
*** 12944,12953 ****
    /* Really select the buffer, for the sake of buffer-local
       variables.  */
    set_buffer_internal_1 (XBUFFER (w->buffer));
-   SET_TEXT_POS (opoint, PT, PT_BYTE);
- 
-   beg_unchanged = BEG_UNCHANGED;
-   end_unchanged = END_UNCHANGED;
  
    current_matrix_up_to_date_p
      = (!NILP (w->window_end_valid)
--- 12944,12949 ----
***************
*** 12956,12961 ****
--- 12952,12974 ----
         && XFASTINT (w->last_modified) >= MODIFF
         && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF);
  
+   /* Run the window-bottom-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
      = (!NILP (w->window_end_valid)
         && !current_buffer->clip_changed
***************
*** 23952,23957 ****
--- 23965,23973 ----
    staticpro (&Qwindow_scroll_functions);
    Qwindow_scroll_functions = intern ("window-scroll-functions");
  
+   staticpro (&Qwindow_text_change_functions);
+   Qwindow_text_change_functions = intern ("window-text-change-functions");
+ 
    staticpro (&Qredisplay_end_trigger_functions);
    Qredisplay_end_trigger_functions = intern 
("redisplay-end-trigger-functions");
  
***************
*** 24263,24268 ****
--- 24279,24289 ----
  is not valid when these functions are called.  */);
    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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]