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: Improve mark management Date: Thu, 19 Jan 2012 20:43:28 +0100 Message-ID: <87zkdjtr4v.fsf@Apollo.jerryland.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1327002203 6487 80.91.229.12 (19 Jan 2012 19:43:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 19 Jan 2012 19:43:23 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 19 20:43:20 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 1RnxtI-000659-54 for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2012 20:43:20 +0100 Original-Received: from localhost ([::1]:50488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnxtH-0008DL-NX for ged-emacs-devel@m.gmane.org; Thu, 19 Jan 2012 14:43:19 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:48253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnxtE-0008DC-7Q for emacs-devel@gnu.org; Thu, 19 Jan 2012 14:43:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnxtD-0000pP-3I for emacs-devel@gnu.org; Thu, 19 Jan 2012 14:43:16 -0500 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:35956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnxtC-0000pK-U0 for emacs-devel@gnu.org; Thu, 19 Jan 2012 14:43:15 -0500 Original-Received: by werl4 with SMTP id l4so330464wer.0 for ; Thu, 19 Jan 2012 11:43:13 -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=MYioo9k5dc/qMU/VXnjaem/uRUueAOzzTMVzT+go7pg=; b=OAVFqNJE9Rz13Kovoy4CLABwD3ro4DZWuolU/o9QpA+T4efMD1OXvCcnDvqLUJ6Uxe /+5JspuOI5MIXTFsXzUuYWjt3i7dWTCY9M+XhXW8g2IHT4hss8L+doF2522MdWoYhm1i v5/0cq7okq9zNliZj6Jr2XHrKy9ntBODTxYMc= Original-Received: by 10.216.139.91 with SMTP id b69mr1130904wej.51.1327002193598; Thu, 19 Jan 2012 11:43:13 -0800 (PST) Original-Received: from Apollo.jerryland.fr ([85.69.251.50]) by mx.google.com with ESMTPS id eq5sm1234182wib.2.2012.01.19.11.43.12 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jan 2012 11:43:13 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.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:147745 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable All, I think the current window.el `window-state-get' and `window-state-put' function does not manage the mark well. First, `mark-active' save was missing in the `window-state-get' function. Second, `window-state-put' restore the mark without taking into account the previously set mark(s). It looks better to use `push-mark' instead of `set-mark'. Moreover it does not restore the active mark state which lead to an automatically active mark in restored buffer. Please, review it or merge it, Best Regards, J=C3=A9r=C3=A9my --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-window.el-Improve-mark-management.patch Content-Description: [PATCH] window.el: Improve mark management >From d50e46f53dd09f9ab133ef3ca048ec3cd8023bdf Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Thu, 19 Jan 2012 20:21:58 +0100 Subject: [PATCH] window.el: Improve mark management First, `mark-active' save was missing in the `window-state-get' function. Second, `window-state-put' restore the mark without taking into account the previously set mark(s). It looks better to use `push-mark' instead of `set-mark'. Moreover it does not restore the active mark state which lead to an automatically active mark in restored buffer. Signed-off-by: Jeremy Compostella --- lisp/window.el | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/window.el b/lisp/window.el index 54e5ec9..6a2be23 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -3632,7 +3632,8 @@ specific buffers." (start . ,(if ignore start (copy-marker start))) ,@(when mark `((mark . ,(if ignore - mark (copy-marker mark)))))))))))) + mark (copy-marker mark))) + (mark-active . ,mark-active)))))))))) (tail (when (memq type '(vc hc)) (let (list) @@ -3816,10 +3817,10 @@ value can be also stored on disk and read back in a new session." (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)))) + (when mark + (push-mark mark t) + (setq mark-active (cdr (assq 'mark-active state)))))) ;; Select window if it's the selected one. (when (cdr (assq 'selected state)) (select-window window))))))) -- 1.7.2.5 --=-=-=--