From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-26 f274cbd: Avoid reordering of output in 'shr-insert-document' Date: Sun, 17 Dec 2017 22:20:59 +0100 Message-ID: <5A36DFBB.4060801@gmx.at> References: <20171216141055.30854.67661@vcs0.savannah.gnu.org> <20171216141056.8391A24612@vcs0.savannah.gnu.org> <83bmiyslq7.fsf@gnu.org> <83a7yhqrys.fsf@gnu.org> <5A36AF3D.8040406@gmx.at> <83zi6hp0j9.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1513545571 3970 195.159.176.226 (17 Dec 2017 21:19:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 17 Dec 2017 21:19:31 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 17 22:19:26 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQgLE-0000Qv-JS for ged-emacs-devel@m.gmane.org; Sun, 17 Dec 2017 22:19:24 +0100 Original-Received: from localhost ([::1]:55532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQgN9-0000Yw-P1 for ged-emacs-devel@m.gmane.org; Sun, 17 Dec 2017 16:21:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQgN2-0000Yi-8R for emacs-devel@gnu.org; Sun, 17 Dec 2017 16:21:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQgMy-0003Yd-6J for emacs-devel@gnu.org; Sun, 17 Dec 2017 16:21:16 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:63833) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQgMx-0003Vr-Sq; Sun, 17 Dec 2017 16:21:12 -0500 Original-Received: from [192.168.1.103] ([212.95.5.143]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MBrCt-1eGXEU2Sz1-00Al8A; Sun, 17 Dec 2017 22:21:05 +0100 In-Reply-To: <83zi6hp0j9.fsf@gnu.org> X-Provags-ID: V03:K0:X0K4PHrd4oJ2fdtSywPl1HuLGZzImUfxYvShpZ+NjNhMlNW2NjE mH8XAZDOOQZ1OrjEqt296H9ETJrK5Z1biDiVM5qASNiFBWTMMUT9uMW7zGXbfpNwy3+3oEr EtnnF756sxVLAn9OxJlmPlzX2mbjMC9u2jSy0nPLZp67L4bmTcG+2fctwckeV2lqEeoU71a REpcOAOb4XrgOabv69mlQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:GefbgC/xOYA=:4uBJUGIec3ayV7BcmBzbx8 vqoli3PZb/p5ao71v3BN4Rr2ETuy6VBXI/Nb+kh8Gb+FL74HwAiR4LuAbd7kfT/fvDk8sUR2E vvErCqWKMM/udiO3dPz8rCtGkAh1ZvnHlhVmjWJWdBet33njFXO1P0Vw7Y6PmRQD5rxoOl14S BougZLOq5mS1Mhad2MTWLoUB3/BAGiiEWR7gYK3T0SmKb+g2kkHIPfX5FgvYeQwSO3abRlSLe QQ9AYlgA7pP8D+Vp7UjW4Zh0sHBHGlhZqXZmTsnFjdgq0iaQHlDo0dJ08rF10dA6sD2EwtfdL 8PyAWD136QmL9hQFE2+kUJ5sDsIV3S1WQFgQoDP8LX1B7SvJWxEohvf+Sz4fw3rt2pdjHzf/P gyRUxtBt62a26NG8F+kZqJ8/SvCss7VxVjU5hKh8rveBq5t1S7xcq1myEqoaR+VR1xJF1ZSZ3 IdzwERgWB2Y928YoQOsCaMmARBLn3gB2G9ph48UQbBAiTbZFiLqULbYu4ed/NFoB4kJUvW0cr m2shuXNAg9slcIdPCtQKEhtnGvzWysystFgvddWvVk/5L/42HGWcKHP/esfx3GloYxbQTzIvy NmNCJfdE6FzqC8jbCKMIx0Z6P386OGlyA8RHtFAJnOelkKubmh+gx8D5X5OOX7XsCcOujh/k6 oXhIdSHELaaDkvh7NqBdIbAyflIk6O75PZppnteUvuVUZyVfU3uz1lgAbGXZjN5uSSMOm81PN I1osvNd9b4GGhWZJZ7U/BOR8Rsq9XbhIcyvC6anTf9IJxH6X8gCSrAAlsxBCYwy3WvPgBY0W X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221188 Archived-At: > If we do that, then why use save-window-excursion in the first place? > That's what it's supposed to preserve (among other things), right? Not really. The Elisp manual says about `save-window-excursion' that This macro records the window configuration of the selected frame, executes FORMS in sequence, then restores the earlier window configuration. and about window configurations As a special exception, the window configuration does not record the value of point in the selected window for the current buffer. so the point of the selected window is not necessarily restored. > If it doesn't do that much, let's do its job by hand altogether. (And > then, of course, a few years down the line someone will come and ask > herself why don't they just use save-window-excursion.) Well, `set-window-buffer' isn't that innocuous either. Note that `shr-pixel-column' will also fail when the current buffer is not shown in the selected window. Hence, a more correct version should do: (defun shr-pixel-column () (cond ((not shr-use-fonts) (current-column)) ((not (eq (window-buffer) (current-buffer))) (let ((window-point (window-point))) (prog1 (save-window-excursion ;; Avoid errors if the selected window is a dedicated one, ;; and they just want to insert a document into it. (set-window-dedicated-p nil nil) (set-window-buffer nil (current-buffer)) (car (window-text-pixel-size nil (line-beginning-position) (point)))) (set-window-point nil window-point)))) (t (car (window-text-pixel-size nil (line-beginning-position) (point)))))) But without a doc-string I obviously can't tell for sure. martin