From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Something like `without-redisplay'? Date: Tue, 01 Sep 2015 05:39:42 +0300 Message-ID: <83zj16zwup.fsf@gnu.org> References: <83egij1qr5.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1441075198 5907 80.91.229.3 (1 Sep 2015 02:39:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Sep 2015 02:39:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 01 04:39:50 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZWbUC-0002H7-5a for geh-help-gnu-emacs@m.gmane.org; Tue, 01 Sep 2015 04:39:48 +0200 Original-Received: from localhost ([::1]:43624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWbUB-0003QT-OM for geh-help-gnu-emacs@m.gmane.org; Mon, 31 Aug 2015 22:39:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWbU0-0003QJ-CC for help-gnu-emacs@gnu.org; Mon, 31 Aug 2015 22:39:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWbTw-0003Xz-Tn for help-gnu-emacs@gnu.org; Mon, 31 Aug 2015 22:39:36 -0400 Original-Received: from mtaout28.012.net.il ([80.179.55.184]:35813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWbTw-0003Xp-L9 for help-gnu-emacs@gnu.org; Mon, 31 Aug 2015 22:39:32 -0400 Original-Received: from conversion-daemon.mtaout28.012.net.il by mtaout28.012.net.il (HyperSendmail v2007.08) id <0NTZ002008JL2M00@mtaout28.012.net.il> for help-gnu-emacs@gnu.org; Tue, 01 Sep 2015 05:39:22 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout28.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NTZ0021Z8PLE810@mtaout28.012.net.il> for help-gnu-emacs@gnu.org; Tue, 01 Sep 2015 05:39:22 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.184 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106950 Archived-At: > Date: Tue, 1 Sep 2015 01:37:22 +0200 > From: Alexander Shukaev > Cc: help-gnu-emacs > > (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.