emacs-devel
[Top][All Lists]
Advanced

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

Re: linum.el?


From: Juanma Barranquero
Subject: Re: linum.el?
Date: Thu, 1 Nov 2007 02:39:47 +0100

On 11/1/07, Richard Stallman <address@hidden> wrote:

> I don't remember after all this time which drawbacks
> remain to be fixed.  Can you remind us?

Markus can explain it better, but as far as I remember, linum.el is
too slow when allout-mode or outline-mode are active.

> Can you post this code again?

Attached after the signature.

> Which drawbacks in linum would this enable to be fixed,

Markus: "Yes, and I also found it's not enough to update line
numbers in window-size-change-functions, configuration-change-hook,
and after-change-functions; one should also do it in hs-...-hook,
allout-..., outline-..., and many others."

You: "I think that means we need to add a suitable hook which
redisplay can call to inform Lisp code that visibility changes
may have altered the position of the bottom of the window.
The hook could be called by redisplay_window, if
current_matrix_up_to_date_p is zero.
Would someone like to try implementing this?"

> and which other drawbacks would remain?

The only one I've seen is that, in very infrequent cases, linum.el
does not update some line numbers after adding or deleting lines. That
may be related to the fact that I use a custom format function. Other
than that, linum.el works very well and it's more than fast enough.

             Juanma


2007-09-16  Markus Triska  <address@hidden>

        * xdisp.c (redisplay_window): Invoke new hook,
window-bottom-change-functions, when visibility changes may have
        altered the position of the bottom of the window.
        (syms_of_xdisp) <window-bottom-change-functions>: New hook.


diff --git a/src/xdisp.c b/src/xdisp.c
index 618a538..80b973c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -232,6 +232,7 @@ extern Lisp_Object Qhelp_echo;

 Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
 Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
+Lisp_Object Qwindow_bottom_change_functions, Vwindow_bottom_change_functions;
 Lisp_Object Qredisplay_end_trigger_functions, Vredisplay_end_trigger_functions;
 Lisp_Object Qinhibit_point_motion_hooks;
 Lisp_Object QCeval, QCfile, QCdata, QCpropertize;
@@ -12880,6 +12881,10 @@ redisplay_window (window, just_this_one_p)
        && XFASTINT (w->last_modified) >= MODIFF
        && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF);

+  if (!current_matrix_up_to_date_p
+      && !NILP (Vwindow_bottom_change_functions))
+      safe_run_hooks (Qwindow_bottom_change_functions);
+
   buffer_unchanged_p
     = (!NILP (w->window_end_valid)
        && !current_buffer->clip_changed
@@ -23866,6 +23871,9 @@ syms_of_xdisp ()
   staticpro (&Qwindow_scroll_functions);
   Qwindow_scroll_functions = intern ("window-scroll-functions");

+  staticpro (&Qwindow_bottom_change_functions);
+  Qwindow_bottom_change_functions = intern ("window-bottom-change-functions");
+
   staticpro (&Qredisplay_end_trigger_functions);
   Qredisplay_end_trigger_functions = intern
("redisplay-end-trigger-functions");

@@ -24173,6 +24181,10 @@ and its new display-start position.  Note
that the value of `window-end'
 is not valid when these functions are called.  */);
   Vwindow_scroll_functions = Qnil;

+  DEFVAR_LISP ("window-bottom-change-functions",
&Vwindow_bottom_change_functions,
+    doc: /* Functions to call when the bottom of the window changes.  */);
+  Vwindow_bottom_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]