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 10:27:45 +0200 Message-ID: <87twskhgu6.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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1438331304 22855 80.91.229.3 (31 Jul 2015 08:28:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Jul 2015 08:28:24 +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 Fri Jul 31 10:28: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 1ZL5fo-0005CE-4H for ged-emacs-devel@m.gmane.org; Fri, 31 Jul 2015 10:28:12 +0200 Original-Received: from localhost ([::1]:43532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL5fn-0006gF-Af for ged-emacs-devel@m.gmane.org; Fri, 31 Jul 2015 04:28:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL5fa-0006g8-U3 for emacs-devel@gnu.org; Fri, 31 Jul 2015 04:27:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZL5fR-00079m-ED for emacs-devel@gnu.org; Fri, 31 Jul 2015 04:27:58 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZL5fR-00078s-8I for emacs-devel@gnu.org; Fri, 31 Jul 2015 04:27:49 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 779202017C for ; Fri, 31 Jul 2015 04:27:48 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Fri, 31 Jul 2015 04:27:48 -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=ODUoRic//Yru2uGAL+ezWRfzQ00=; b=KVJhK XLHqm5eTgLhmB2aYPMuX4pI06lbih4q3k9sqhZjMzFyqFYtxrr//ol59iEMGcPzE Yq8riEsEfnRP1cQY8A2weAvq883ohSMT+5O/Yp6CkHVuPWiLFATrRelIYKepezBQ FKUrsD99gVInGLflnkax3RJleQ/nBjFXDJhdTA= X-Sasl-enc: lyefvksQ1B4OdBEFOjGLbq8vIKaBiQmBkHYc1937gQDz 1438331268 Original-Received: from thinkpad-t440p (unknown [2.162.149.230]) by mail.messagingengine.com (Postfix) with ESMTPA id 80E21C00012; Fri, 31 Jul 2015 04:27:47 -0400 (EDT) Mail-Followup-To: martin rudalics , Ingo Lohmar , emacs-devel@gnu.org In-Reply-To: <55BB1F61.7030104@gmx.at> (martin rudalics's message of "Fri, 31 Jul 2015 09:10:25 +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:188228 Archived-At: martin rudalics writes: >> 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. > > I didn't look into these. But do they really change a buffer's point? > Or do they change a window's point (aka `window-point'). They use `goto-char' in the window which is selected after setting the window configuration, so I guess it's the buffer's point. BTW, my advice was completely broken. Here is a better version: --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))))) (selected-buf (current-buffer))) (funcall old config) ;; 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) (let ((buf (car bp)) (p (cdr bp))) (when-let ((w (get-buffer-window buf))) (with-selected-window w (goto-char p))))))))) (advice-add #'set-window-configuration :around #'th/window-config-keep-points-and-selected-window) --8<---------------cut here---------------end--------------->8--- But that's also really bad. For example, `edebug' uses `set-window-configuration' internally, so point always jumps back after each edebug step. Seems like I can't achieve what I'm looking for too easily. Bye, Tassilo