From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: include new package wconf.el in GNU ELPA Date: Sat, 01 Aug 2015 12:50:36 +0200 Message-ID: <55BCA47C.2070700@gmx.at> References: <877fph8xwx.fsf@acer.localhost.com> <87d1z9a210.fsf@gnu.org> <871tfp8ir0.fsf@acer.localhost.com> <87lhdwhosp.fsf@gnu.org> <55BB1F61.7030104@gmx.at> <87twskhgu6.fsf@gnu.org> <55BB463D.4080202@gmx.at> <87h9okh2ej.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1438426265 4362 80.91.229.3 (1 Aug 2015 10:51:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Aug 2015 10:51:05 +0000 (UTC) To: Ingo Lohmar , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 01 12:50:56 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZLUNS-0006IB-BG for ged-emacs-devel@m.gmane.org; Sat, 01 Aug 2015 12:50:54 +0200 Original-Received: from localhost ([::1]:53299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLUNR-0003i3-N7 for ged-emacs-devel@m.gmane.org; Sat, 01 Aug 2015 06:50:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLUNN-0003de-0X for emacs-devel@gnu.org; Sat, 01 Aug 2015 06:50:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLUNJ-0006S9-Pg for emacs-devel@gnu.org; Sat, 01 Aug 2015 06:50:48 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:56650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLUNJ-0006Rw-5Z for emacs-devel@gnu.org; Sat, 01 Aug 2015 06:50:45 -0400 Original-Received: from [178.191.140.100] ([178.191.140.100]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MC4y8-1ZCege16TA-008quU; Sat, 01 Aug 2015 12:50:44 +0200 In-Reply-To: <87h9okh2ej.fsf@gnu.org> X-Provags-ID: V03:K0:QxOFwGzZBKxzr2kCRBusK1HJ9+uI8yLVNQVwRe9NiEAnO9er1z5 EGhWAIvYxWzVUU2o/HPG1Eqr8Go3aNGBZvCpNULLjP73RZEvYUonsR6O8ZfnJJ2WLq2hwH0 FHYqTSCpMS1jcVKWXLYQ/oMSXDHfsNxRKSJ4fkKBN5l/1yc8uJyx4O36PLFi2TiP15gBYdf TXzyavO0xnuBe82Ts1pbw== X-UI-Out-Filterresults: notjunk:1;V01:K0:IHVE+LJXuLU=:NgrK/o2SEPkp7RIJyKaf8d 0lqv5AmvL7QhctGgb7m2lULncgGLCge+HT0VCvB3BCGV0RV+s4rzucGJyV6BzHMbEAXgxbMy8 VBJ4oUpP7EAA/1idZyCxZkYDI5kYgEMOZBCnZSKOt7CFtrbuiW7yhQ3iSYqtPtLQl+n6XZMtg 7SF1gKD5sfkYP3h0b80tcAjx7OaVGwGvJLxNZ74M1mbqi/xrEf4MHaZGvMs5MMnWDqLoFCG+Z t4NqTL+sORLsWrdmO0SpRYPnB60ahgIdbCyQjjAEliGNOspFikOZsp8XYc0leE8ZYlC+NsuXr UIKpwa9wSg51O6sxONuUOi78sezCVRhm7jHM6Qsndinw+qdHdJwAC081W0iBJ6ahxBiy0e1VT fPoATDsqVfCgtL+5m5fwY95hpgMaJT9cUzA4HXTt2EsSLsLD/l4lB9CPxiCJDA6Lj3crXxLG4 Eoc0I8ZEvfmWQOn/Jjq4+OrXMnGoe3FZDyk+hFDkhgVmk6zLoJBiA917k7cJWI3bh4/WDULIi imntfe84VK/FoRdK4pXXo3bv5MOuLJYDJ9DLZRynBYiPhE4tUK5cDPZD2Uyaq9BdrgKWdKhT2 0uwVWcr/g+fBEv5dAp8QiUOs5SDPJ+Ki5PCJ/ssLcKOd/eBxKrSPIaqbLlmtUyjuQTrsMckTH rxaqEcxPudB9RijAhKfgcs0TEF+6p/lCGe0nwZTLwg3BG4noZpPkCkV8xdJPD/2Z5f0g= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.15.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:188266 Archived-At: > Ok, so is this better? Not much. > > --8<---------------cut here---------------start------------->8--- > ;; Keep window selection and point > (defun th/window-config-keep-points-and-selected-window (old config) > (let ((bufpoints (mapcar (lambda (win) > (cons (window-buffer win) (window-point win))) > (window-list (selected-frame)))) Here you record window points ... > (selected-buf (current-buffer))) > (funcall old config) > ;; Do our magic only if called interactively. > (when (and (memq this-command '(jump-to-register winner-undo winner-redo)) > (called-interactively-p 'interactive)) > ;; Restore selected window > (when-let ((w (get-buffer-window selected-buf))) > (select-window w)) > ;; The setting of point is not performed by `set-window-configuration' > ;; itself but by `jump-to-register' or the winner functions. > (run-with-timer 0.139 nil > (lambda () > (dolist (bp bufpoints) > (when-let ((w (get-buffer-window (car bp)))) > (set-window-point win (cdr bp))))))))) ... and here you restore them in some completely arbitrary manner. This can work reasonably iff all windows show different buffers. > You mean, get the state of all windows in the current window > configuration, then switch to the other, and then put the state back for > all windows of buffers that were also displayed in the previous WC? `window-state-get' gets you a Lisp object that you can manipulate. For example, you can replace point positions in some arbitrary way. Doing the same with an object returned by `current-window-configuration' is practically impossible. martin