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: Fri, 31 Jul 2015 07:35:50 +0200 Message-ID: <87lhdwhosp.fsf@gnu.org> References: <877fph8xwx.fsf@acer.localhost.com> <87d1z9a210.fsf@gnu.org> <871tfp8ir0.fsf@acer.localhost.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1438320982 29036 80.91.229.3 (31 Jul 2015 05:36:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Jul 2015 05:36:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Ingo Lohmar Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 31 07:36:14 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 1ZL2zN-0001go-Ng for ged-emacs-devel@m.gmane.org; Fri, 31 Jul 2015 07:36:13 +0200 Original-Received: from localhost ([::1]:43229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL2zM-0004L5-Te for ged-emacs-devel@m.gmane.org; Fri, 31 Jul 2015 01:36:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL2zA-0004Jl-Gf for emacs-devel@gnu.org; Fri, 31 Jul 2015 01:36:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZL2z4-0003YC-Lo for emacs-devel@gnu.org; Fri, 31 Jul 2015 01:36:00 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:45409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL2z4-0003Xv-Ig for emacs-devel@gnu.org; Fri, 31 Jul 2015 01:35:54 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id E87BA2098F for ; Fri, 31 Jul 2015 01:35:53 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Fri, 31 Jul 2015 01:35:53 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=S0mYmRQhaOS3hL8b6QVdKFojnMw=; b=Xhgux ur+iJN5CQGvdMWhvkVKiDAF/cZd2iK/dU8m0cdKHYDoOAozi+T7lVVzFKmy8i+0F dd6V9hQnyBVR6mA9ax2ySiy8RKrg2iBHkdlZPllAuir23QFrCx698B1U82WfHp1U hjognIvJrZF84AvwPotiB6c1ILWuCuOqh8Wn5A= X-Sasl-enc: WRPAh7T/r6nfWU8//3thZBuRl0hfAikRI0ZsADjj6tlg 1438320953 Original-Received: from thinkpad-t440p (unknown [2.162.149.230]) by mail.messagingengine.com (Postfix) with ESMTPA id D6414680159; Fri, 31 Jul 2015 01:35:52 -0400 (EDT) Mail-Followup-To: Ingo Lohmar , emacs-devel@gnu.org In-Reply-To: <871tfp8ir0.fsf@acer.localhost.com> (Ingo Lohmar's message of "Thu, 30 Jul 2015 22:58:59 +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.2.x-3.x [generic] X-Received-From: 66.111.4.25 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:188219 Archived-At: Ingo Lohmar writes: Hi Ingo, > I have not thought about the point and window business yet, so there's > no option. Generally I am wary of dealing with window-config details > (which I did in a much earlier version of the package), but this seems > like a general and useful switch to have.. Maybe I will add that. It > would help me if you could add a github issue describing the option > behavior, otherwise I'll try to keep a note myself. I've thought about it, and I think such an option should be in emacs itself so that you can have that behavior with winner, wconf, or whatever else you use for window config business. I had a look at the corresponding code in emacs, and actually the restoration of point is not done in `set-window-configuration' but instead it's done afterwards in `jump-to-register', in `winner-set', and probably other places as well. The best I could come up so far is this advice, which uses an ugly timer to reclaim back the current points... --8<---------------cut here---------------start------------->8--- (defun th/window-config-keep-points-and-selected-window (old config) (let ((bufpoints (mapcar (lambda (buf) (cons buf (with-selected-window (get-buffer-window buf) (point)))) (cl-remove-if-not #'get-buffer-window (buffer-list (selected-frame))))) (p (point))) (funcall old config) (when-let ((w (get-buffer-window))) (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) (let ((buf (car bp)) (p (cdr bp))) (when-let ((w (get-buffer-window buf))) (with-selected-window (goto-char p))))))))) (advice-add #'set-window-configuration :around #'th/window-config-keep-points-and-selected-window) --8<---------------cut here---------------end--------------->8--- Bye, Tassilo