From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: include new package wconf.el in GNU ELPA Date: Mon, 03 Aug 2015 09:45:51 +0200 Message-ID: <873800bys0.fsf@gnu.org> 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> <55BCA47C.2070700@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1438587976 21364 80.91.229.3 (3 Aug 2015 07:46:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Aug 2015 07:46:16 +0000 (UTC) Cc: Ingo Lohmar , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 03 09:46:07 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 1ZMARi-0002Qx-Mu for ged-emacs-devel@m.gmane.org; Mon, 03 Aug 2015 09:46:06 +0200 Original-Received: from localhost ([::1]:57857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMARh-0004Pg-Mv for ged-emacs-devel@m.gmane.org; Mon, 03 Aug 2015 03:46:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMARa-0004Nf-Ob for emacs-devel@gnu.org; Mon, 03 Aug 2015 03:46:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMARW-0004ru-N0 for emacs-devel@gnu.org; Mon, 03 Aug 2015 03:45:58 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:35892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMARW-0004oo-7b for emacs-devel@gnu.org; Mon, 03 Aug 2015 03:45:54 -0400 Original-Received: from thinkpad-t440p (dhcp247.uni-koblenz.de [141.26.71.247]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 6AC651A8392; Mon, 3 Aug 2015 09:45:52 +0200 (CEST) Mail-Followup-To: martin rudalics , Ingo Lohmar , emacs-devel@gnu.org In-Reply-To: <55BCA47C.2070700@gmx.at> (martin rudalics's message of "Sat, 01 Aug 2015 12:50:36 +0200") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.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:188321 Archived-At: martin rudalics writes: >> --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. Yes, that was kind of an assumption. In the presence of multiple windows on the same buffer in either the from or to window configuration, there are lots of special cases to which I don't have an answer, yet. (Neither code nor what should actually happen.) >> 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. I see, thanks. Bye, Tassilo