all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] window.el: Remove mark saving and restoring
@ 2012-01-19 13:54 Jérémy Compostella
  2012-01-19 14:37 ` Jérémy Compostella
  0 siblings, 1 reply; 2+ messages in thread
From: Jérémy Compostella @ 2012-01-19 13:54 UTC (permalink / raw)
  To: emacs-devel

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

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-window.el-Remove-mark-saving-and-restoring.patch --]
[-- Type: text/x-diff, Size: 2763 bytes --]

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


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

* Re: [PATCH] window.el: Remove mark saving and restoring
  2012-01-19 13:54 [PATCH] window.el: Remove mark saving and restoring Jérémy Compostella
@ 2012-01-19 14:37 ` Jérémy Compostella
  0 siblings, 0 replies; 2+ messages in thread
From: Jérémy Compostella @ 2012-01-19 14:37 UTC (permalink / raw)
  To: emacs-devel

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

Sorry, but don't read this thread. I should look at it more carefully
before ;)

2012/1/19 Jérémy Compostella <jeremy.compostella@gmail.com>

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

[-- Attachment #2: Type: text/html, Size: 1139 bytes --]

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

end of thread, other threads:[~2012-01-19 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-19 13:54 [PATCH] window.el: Remove mark saving and restoring Jérémy Compostella
2012-01-19 14:37 ` Jérémy Compostella

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.