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: Alexander Shukaev
Subject: Re: Something like `without-redisplay'?
Date: Tue, 1 Sep 2015 01:37:22 +0200

A couple of related questions.  I have written several macros like the
following:

(defmacro devil-without-window-hscroll
    (&rest body)
  "\
Execute BODY without horizontal scrolling in the selected window."
  (declare (debug  t)
           (indent defun))
  `(let ((hscroll (window-hscroll)))
     (set-window-hscroll (selected-window) 0)
     (unwind-protect
         (progn ,@body)
       (set-window-hscroll (selected-window) hscroll))))

In brief, these are macros which somehow alter viewport (how window
views a buffer) temporarily and then restore it.  For instance, if
`auto-hscroll-mode' is on, should I fear that `set-window-hscroll'
will move point?  I personally, have not experienced this problem, but
still I want to know exactly what to expect.  For example, would you
recommend to wrap `set-window-hscroll' into `save-excursion' or that
would be redundant?  By the way, the same would apply to vertical
changes in viewport (due to vertical scrolling, for example) as Emacs
auto-scrolls (moves point to keep it in viewport) by default.  Yet,
again, I've never experienced any problem with this too.



reply via email to

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