emacs-devel
[Top][All Lists]
Advanced

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

Re: Can we make set_point_both less expensive?


From: Stefan Monnier
Subject: Re: Can we make set_point_both less expensive?
Date: Sat, 21 Mar 2015 10:35:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

BTW, I now remember that re-running pre-redisplay-function (and then
redisplay) is already implemented in xdisp.c.  The part that's not yet
implemented is to detect inf-loops and break them (i.e. to not run
pre-redisplay-function when we're doing the second redisplay).

The relevant code is

          /* Re-run pre-redisplay-function so it can update the region
             according to the new position of point.  */
          /* Other than the cursor, w's redisplay is done so we can set its
             redisplay to false.  Also the buffer's redisplay can be set to
             false, since propagate_buffer_redisplay should have already
             propagated its info to `w' anyway.  */
          w->redisplay = false;
          XBUFFER (w->contents)->text->redisplay = false;
          safe__call1 (true, Vpre_redisplay_function, Fcons (window, Qnil));

          if (w->redisplay || XBUFFER (w->contents)->text->redisplay)
            {
              /* pre-redisplay-function made changes (e.g. move the region)
                 that require another round of redisplay.  */
              clear_glyph_matrix (w->desired_matrix);
              if (!try_window (window, startp, 0))
                goto need_larger_matrices;
            }

This was needed to handle correctly the following recipe:

   emacs -Q lisp/subr.el \
         --eval "(global-set-key [?\\M-n] \
                                 (lambda () \
                                   (interactive) \
                                   (set-window-start \
                                    nil (+ (window-start) 1000))))" \
         -f blink-cursor-mode
   C-SPC M-n M-n M-n

This potential inf-loop is new in Emacs-25 (instead, in Emacs-24.4, the
recipe misbehaves).


        Stefan



reply via email to

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