unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] window.el: Improve mark management
@ 2012-01-19 19:43 Jérémy Compostella
  2012-01-20 10:01 ` martin rudalics
  2012-01-20 13:42 ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Jérémy Compostella @ 2012-01-19 19:43 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

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érémy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] window.el: Improve mark management --]
[-- Type: text/x-diff, Size: 1923 bytes --]

From d50e46f53dd09f9ab133ef3ca048ec3cd8023bdf Mon Sep 17 00:00:00 2001
From: Jeremy Compostella <jeremy.compostella@gmail.com>
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 <jeremy.compostella@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-01-25 15:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-19 19:43 [PATCH] window.el: Improve mark management Jérémy Compostella
2012-01-20 10:01 ` martin rudalics
2012-01-20 13:42 ` Stefan Monnier
2012-01-20 15:13   ` martin rudalics
2012-01-20 16:11     ` Stefan Monnier
2012-01-20 16:52   ` Jérémy Compostella
2012-01-20 18:25     ` Stefan Monnier
2012-01-21 14:36       ` Jérémy Compostella
2012-01-24 20:31         ` Stefan Monnier
2012-01-25 10:32           ` martin rudalics
2012-01-25 13:45             ` Stefan Monnier
2012-01-25 15:01               ` Jérémy Compostella

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).