help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Something like `without-redisplay'?


From: Eli Zaretskii
Subject: Re: Something like `without-redisplay'?
Date: Tue, 01 Sep 2015 18:57:03 +0300

> Date: Tue, 1 Sep 2015 17:24:08 +0200
> From: Alexander Shukaev <haroogan@gmail.com>
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
> 
> >> behave incorrectly when window has non-zero horizontal scroll.  The
> >> problem might be deep in how Emacs implements `next-line' or
> >> `previous-line' or whatever.
> >
> > More likely, the function in question has  bug.
> >
> >> But I found a solution, when I use `evil-previous-visual-line' and
> >> `evil-next-visual-line' in my own functions, I simply wrap their
> >> calls into the `devil-without-window-hscroll' macro, so that during
> >> their execution there is no horizontal scrolling.
> >
> > I'd suggest to find the bug in the function and fix it instead.
> 
> I'd love to, but I'm no expert with these.  Unfortunately, can't
> afford some time for this now.

Did you report the problem to the maintainer of that code?  If not, I
suggest to do that.

> > It can in rare cases, if you scroll vertically.  It all depends on
> > what the code does, exactly.
> 
> OK, then here is an example
> 
> (save-excursion (scroll-down 10)) ;; just scroll
> (previous-line 10) ;; then move point with the method we want
> 
> I've tested it and so far, I see no problems with it.  I think there
> is another option to do the same like this
> 
> (save-window-excursion (previous-line 10)) ;; just move point with the
> method we want
> (save-excursion (scroll-down 10)) ;; then scroll
> 
> Which one is more reliable?  Can I even expect any problems with these codes?

Not with these, I think.  I'm sorry, I cannot give any precise
instructions regarding what not to do, except repeating that in
general it is very unlikely that you will see point moving when Lisp
code takes care to return point to the same place and does not change
the window configuration.  I just know that some code paths inside
redisplay are capable of moving point if they otherwise cannot satisfy
the constraints of vertical position of point, such as scroll-margin.

> > Horizontal scrolling doesn't move point, AFAIR.
> 
> Even if `auto-hscroll-mode' is on (which it is by default)?

auto-hscroll-mode does the opposite: it scrolls the display to move
point into the view.  It doesn't move point.



reply via email to

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