From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?J=C3=A9r=C3=A9my_Compostella?= Newsgroups: gmane.emacs.devel Subject: [PATCH] window.el: Remove mark saving and restoring Date: Thu, 19 Jan 2012 14:54:45 +0100 Message-ID: <8739bbvlui.fsf@Apollo.jerryland.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1326981286 2753 80.91.229.12 (19 Jan 2012 13:54:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 19 Jan 2012 13:54:46 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 19 14:54:42 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RnsRq-0004mH-AZ for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2012 14:54:39 +0100 Original-Received: from localhost ([::1]:33270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnsRp-0004Ti-Tg for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2012 08:54:37 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnsRl-0004Tc-Pi for emacs-devel@gnu.org; Thu, 19 Jan 2012 08:54:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnsRk-0000we-6F for emacs-devel@gnu.org; Thu, 19 Jan 2012 08:54:33 -0500 Original-Received: from mail-wi0-f169.google.com ([209.85.212.169]:62675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnsRj-0000wa-Uh for emacs-devel@gnu.org; Thu, 19 Jan 2012 08:54:32 -0500 Original-Received: by wicr5 with SMTP id r5so6179102wic.0 for ; Thu, 19 Jan 2012 05:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type; bh=uoMx0aOFd6C9CRb1uN28BTwqGSYp6dJbQEz3H3xE1hw=; b=EJzBIk1R9dLil361GYCTFSNVSbLy2cYvDQ92Abarq7/Ti4MBVtmYjxlH6Mm6v1JKnX c/Q7CVhGXLzethgEpwGF+hP9oXwbZB5eu45+9EeoIpI13V+UpIHsxZoR+e0QISZszgao ZiIVP7PTe5UAm2qtRlUKj0VuGkdt4fkgUHgBk= Original-Received: by 10.180.91.201 with SMTP id cg9mr44354619wib.15.1326981271143; Thu, 19 Jan 2012 05:54:31 -0800 (PST) Original-Received: from Apollo.jerryland.fr (pierre.csie.fr. [212.51.164.178]) by mx.google.com with ESMTPS id bu13sm30847061wib.6.2012.01.19.05.54.29 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jan 2012 05:54:30 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.169 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:147728 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable All, Working on the "desktop.el: Add frames and windows configuration save&restore" thread I'm trying to use the `window-state-get' and `window-state-put' functions. I got a bad behavior. Indeed when I restore a window from its previous state, the mark is modified and activated. As long as I know, mark is buffer related and not window related so we don't have to save and restore it here. The author himself commented this code part with : ;; I'm not sure whether we should set the mark here, but maybe ;; it can be used. I propose the attached patch which removes the mark save&restore part. Regards, J=C3=A9r=C3=A9my --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-window.el-Remove-mark-saving-and-restoring.patch Content-Description: 0001-window.el-Remove-mark-saving-and-restoring.patch >From fb68050a5d6ed714d8f80c5a3cb47e5755dd7127 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Thu, 19 Jan 2012 14:33:32 +0100 Subject: [PATCH] window.el: Remove mark saving and restoring As long as I know mark is related to a buffer and not to a window. It should be saved by buffer functions and not window functions. Moreover, when I call window-state-put on a window-state-get previously stored the mark is changed and activated which does not look like the desired behavior. Signed-off-by: Jeremy Compostella --- lisp/window.el | 16 ++++------------ 1 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index 54e5ec9..c6e9605 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -3612,11 +3612,10 @@ specific buffers." `((parameters . ,list)))) ,@(when buffer ;; All buffer related things go in here - make the buffer - ;; current when retrieving `point' and `mark'. + ;; current when retrieving `point' and `start'. (with-current-buffer (window-buffer window) (let ((point (window-point-1 window)) - (start (window-start window)) - (mark (mark t))) + (start (window-start window))) `((buffer ,(buffer-name buffer) (selected . ,selected) @@ -3629,10 +3628,7 @@ specific buffers." (vscroll . ,(window-vscroll window)) (dedicated . ,(window-dedicated-p window)) (point . ,(if ignore point (copy-marker point))) - (start . ,(if ignore start (copy-marker start))) - ,@(when mark - `((mark . ,(if ignore - mark (copy-marker mark)))))))))))) + (start . ,(if ignore start (copy-marker start)))))))))) (tail (when (memq type '(vc hc)) (let (list) @@ -3815,11 +3811,7 @@ value can be also stored on disk and read back in a new session." ;; have been created and sized). (ignore-errors (set-window-start window (cdr (assq 'start state))) - (set-window-point window (cdr (assq 'point state))) - ;; I'm not sure whether we should set the mark here, but maybe - ;; it can be used. - (let ((mark (cdr (assq 'mark state)))) - (when mark (set-mark mark)))) + (set-window-point window (cdr (assq 'point state)))) ;; Select window if it's the selected one. (when (cdr (assq 'selected state)) (select-window window))))))) -- 1.7.2.5 --=-=-=--