all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jérémy Compostella" <jeremy.compostella@gmail.com>
To: emacs-devel@gnu.org
Subject: [PATCH] window.el: Remove mark saving and restoring
Date: Thu, 19 Jan 2012 14:54:45 +0100	[thread overview]
Message-ID: <8739bbvlui.fsf@Apollo.jerryland.fr> (raw)

[-- 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


             reply	other threads:[~2012-01-19 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-19 13:54 Jérémy Compostella [this message]
2012-01-19 14:37 ` [PATCH] window.el: Remove mark saving and restoring Jérémy Compostella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8739bbvlui.fsf@Apollo.jerryland.fr \
    --to=jeremy.compostella@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.