From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Something like `without-redisplay'?
Date: Tue, 01 Sep 2015 05:39:42 +0300 [thread overview]
Message-ID: <83zj16zwup.fsf@gnu.org> (raw)
In-Reply-To: <CAKu-7WyfqM5sYW=yHdwG1c_U5ZbKXAeVjaSBmGxkQKvMRuLhSA@mail.gmail.com>
> Date: Tue, 1 Sep 2015 01:37:22 +0200
> From: Alexander Shukaev <haroogan@gmail.com>
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
>
> (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.
I don't understand the need for that: since redisplay doesn't happen
as long as the code runs, why would you need to manipulate the
viewport like that during the execution, just to have it back by the
time redisplay is about to happen?
> 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.
In general, hscroll only scrolls if point goes out of view. Vertical
scroll can happen even with point is in view, under some rare
situations.
But again, I don't understand what you want to accomplish with these
macros, so I cannot answer your questions yet.
next prev parent reply other threads:[~2015-09-01 2:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 9:49 Something like `without-redisplay'? Alexander Shukaev
2015-08-31 14:23 ` Eli Zaretskii
2015-08-31 19:32 ` Alexander Shukaev
2015-08-31 23:37 ` Alexander Shukaev
2015-09-01 2:39 ` Eli Zaretskii [this message]
2015-09-01 13:56 ` Alexander Shukaev
2015-09-01 14:52 ` Eli Zaretskii
2015-09-01 15:24 ` Alexander Shukaev
2015-09-01 15:57 ` Eli Zaretskii
2015-09-01 16:10 ` Alexander Shukaev
2015-09-01 16:47 ` Alexander Shukaev
2015-09-01 17:00 ` Eli Zaretskii
2015-09-01 17:24 ` Alexander Shukaev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83zj16zwup.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.