From: "Jérémy Compostella" <jeremy.compostella@gmail.com>
To: emacs-devel@gnu.org
Subject: [PATCH] window.el: Improve mark management
Date: Thu, 19 Jan 2012 20:43:28 +0100 [thread overview]
Message-ID: <87zkdjtr4v.fsf@Apollo.jerryland.fr> (raw)
[-- 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
next reply other threads:[~2012-01-19 19:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-19 19:43 Jérémy Compostella [this message]
2012-01-20 10:01 ` [PATCH] window.el: Improve mark management 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
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=87zkdjtr4v.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.