From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#32672: 27.0.50; image resize on window resizing Date: Sat, 27 Oct 2018 22:38:37 +0300 Organization: LINKOV.NET Message-ID: <87zhuzgx9u.fsf@mail.linkov.net> References: <87pnxmyjgt.fsf@mail.linkov.net> <5B9B7253.5060808@gmx.at> <87pnxexr2m.fsf@mail.linkov.net> <5B9E1E0E.7070805@gmx.at> <87h8ip2eby.fsf@mail.linkov.net> <5B9F4DBD.5020009@gmx.at> <877ejjzr9s.fsf@mail.linkov.net> <5BA20763.8070305@gmx.at> <875zz1t6y1.fsf@mail.linkov.net> <5BA34D7E.4030509@gmx.at> <87fty3sp6a.fsf@mail.linkov.net> <5BA490E5.5090506@gmx.at> <87zhw9xjpx.fsf@mail.linkov.net> <5BA74E3D.5030903@gmx.at> <87va6wt79n.fsf@mail.linkov.net> <5BA89ED5.4050207@gmx.at> <83in2vb8dw.fsf@gnu.org> <87a7o6ewxw.fsf@mail.linkov.net> <5BA9E378.9090105@gmx.at> <871s9hjvgn.fsf@mail.linkov.net> <5BAB487D.1000303@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1540671556 22763 195.159.176.226 (27 Oct 2018 20:19:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 27 Oct 2018 20:19:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 32672@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 27 22:19:12 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1gGV38-0005nW-GI for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Oct 2018 22:19:10 +0200 Original-Received: from localhost ([::1]:37685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGV5E-00077d-Gc for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Oct 2018 16:21:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGV50-00076U-1l for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2018 16:21:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGV4w-0006V7-2i for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2018 16:21:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41530) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gGV4v-0006Ul-TD for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2018 16:21:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gGV4v-00007Q-P9 for bug-gnu-emacs@gnu.org; Sat, 27 Oct 2018 16:21:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Oct 2018 20:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32672 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32672-submit@debbugs.gnu.org id=B32672.1540671620348 (code B ref 32672); Sat, 27 Oct 2018 20:21:01 +0000 Original-Received: (at 32672) by debbugs.gnu.org; 27 Oct 2018 20:20:20 +0000 Original-Received: from localhost ([127.0.0.1]:45779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGV4G-00005X-Ih for submit@debbugs.gnu.org; Sat, 27 Oct 2018 16:20:20 -0400 Original-Received: from catfish.maple.relay.mailchannels.net ([23.83.214.32]:18563) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGV4D-00005O-Ol for 32672@debbugs.gnu.org; Sat, 27 Oct 2018 16:20:18 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 009E8682EB2; Sat, 27 Oct 2018 20:20:16 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (unknown [100.96.16.121]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B8D35682B0B; Sat, 27 Oct 2018 20:20:15 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Sat, 27 Oct 2018 20:20:15 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Language-Wide-Eyed: 09cf817f7a42bc1e_1540671615850_3257493458 X-MC-Loop-Signature: 1540671615850:3380731031 X-MC-Ingress-Time: 1540671615850 Original-Received: from pdx1-sub0-mail-a3.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a3.g.dreamhost.com (Postfix) with ESMTP id 714F07F694; Sat, 27 Oct 2018 13:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=nU5midnIpgQ8gVed5TvCAzDDy6I=; b= qtMK2Z3Tybkj9/iQE3WXrNPXfOBsMxPPg/R0DtsK1/kQ34bkNBIS5vX1wDuzVpZS Kx+gxm1rkq6vikdSACxGhIkoHc0z49n7KkP0hKO17lempGHc6YfFXVKXHhUp93c/ QwpgNonCsKP32zfXuAYIPXROcmOlXYJ/6WA14JCrD5o= Original-Received: from mail.jurta.org (m91-129-105-154.cust.tele2.ee [91.129.105.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a3.g.dreamhost.com (Postfix) with ESMTPSA id 560D07F68E; Sat, 27 Oct 2018 13:20:12 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a3 In-Reply-To: <5BAB487D.1000303@gmx.at> (martin rudalics's message of "Wed, 26 Sep 2018 10:51:09 +0200") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrheeggdduheduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdehrdduheegnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedrudehgedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehruhgurghlihgtshesghhmgidrrghtnecuvehluhhsthgvrhfuihiivgeptd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151701 Archived-At: --=-=-= Content-Type: text/plain >> Your proposed window-state-change-functions would match window-state-get >> very well, e.g. it could call the hook with an argument containing alist >> of values that really changed, where elements of the alist could have >> the same keys as in alist returned from window-state-get, > > Retaining the nomenclature of 'window-state-get' is part of the plan. > But I'm not sure whether we want to retain all of what is recorded in > a window state. > >> for example: >> >> (add-hook 'window-state-change-functions (lambda (window alist) ...) nil t) >> >> where 'alist' could have such keys and values of changes: >> >> (buffer "*scratch*") - means the buffer was switched in the window > > (buffer . #) rather Here is a complete implementation that works well when tested on display-buffer-directionally in bug#32790 (it doesn't handle window-point because then the hook is called too often): --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=window-state-change-functions.1.el Content-Transfer-Encoding: quoted-printable (defvar window-state-change-functions nil) (defvar window-state-change-prev nil) (defun window-state-change-pre-command () (setq window-state-change-prev (mapcar (lambda (window) `(,window (buffer . ,(window-buffer window)) (selected . ,(eq window (selected-window))) (start . ,(window-start window)))) (window-list nil 'nomini)))) (add-hook 'pre-command-hook 'window-state-change-pre-command) (defun window-state-change-post-command () (mapc (lambda (window) (let ((prev (cdr (assq window window-state-change-prev))) alist) (when prev (unless (eq (cdr (assq 'buffer prev)) (window-buffer w= indow)) (push `(buffer ,(cdr (assq 'buffer prev)) ,(window-buffer w= indow)) alist)) (unless (eq (cdr (assq 'selected prev)) (eq window (selecte= d-window))) (push `(selected ,(cdr (assq 'selected prev)) ,(eq window (= selected-window))) alist)) (unless (eq (cdr (assq 'start prev)) (window-start wind= ow)) (push `(start ,(cdr (assq 'start prev)) ,(window-start wind= ow)) alist))) (when alist (run-hook-with-args 'window-state-change-functions window ali= st)))) (window-list nil 'nomini))) (add-hook 'post-command-hook 'window-state-change-post-command) --=-=-=--