unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kelly Dean <kellydeanch@yahoo.com>
Cc: 14430-done@debbugs.gnu.org
Subject: bug#14430: [PATCH] Desktop restore runs mark activation hooks when it shouldn't
Date: Sun, 09 Mar 2014 22:19:20 -0400	[thread overview]
Message-ID: <jwvob1edcn5.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <1369102003.84562.YahooMailClassic@web141101.mail.bf1.yahoo.com> (Kelly Dean's message of "Mon, 20 May 2013 19:06:43 -0700 (PDT)")

> (desktop-save-mode 1)
> (add-hook 'deactivate-mark-hook (lambda () (setq cursor-type t)))
> (add-hook 'activate-mark-hook (lambda () (setq cursor-type 'bar)))

> Start Emacs 24.3, open a file, press C-SPC C-g, then exit Emacs and save the
> desktop, then restart Emacs. Notice that the cursor type is now a bar,
> not a block. It should be a block.

I installed a patch which makes desktop not run (de)activate-mark hooks.

> The attached patch fixes it. It could be fixed without patching set-mark, by
> conditionally calling deactivate-mark in desktop-create-buffer after calling
> set-mark, but that's a hack; the mark shouldn't be activated in the first

Instead, I simply use move-marker on mark-marker.


        Stefan


=== modified file 'lisp/desktop.el'
--- lisp/desktop.el	2014-02-22 02:10:49 +0000
+++ lisp/desktop.el	2014-03-10 02:17:20 +0000
@@ -1382,18 +1382,19 @@
 	  (when desktop-buffer-mark
 	    (if (consp desktop-buffer-mark)
 		(progn
-		  (set-mark (car desktop-buffer-mark))
+                  (move-marker (mark-marker) (car desktop-buffer-mark))
+                  ;; FIXME: Should we call (de)activate-mark instead?
 		  (setq mark-active (car (cdr desktop-buffer-mark))))
-	      (set-mark desktop-buffer-mark)))
+              (move-marker (mark-marker) desktop-buffer-mark)))
 	  ;; Never override file system if the file really is read-only marked.
 	  (when desktop-buffer-read-only (setq buffer-read-only desktop-buffer-read-only))
 	  (dolist (this desktop-buffer-locals)
 	    (if (consp this)
-		;; an entry of this form `(symbol . value)'
+		;; An entry of this form `(symbol . value)'.
 		(progn
 		  (make-local-variable (car this))
 		  (set (car this) (cdr this)))
-	      ;; an entry of the form `symbol'
+	      ;; An entry of the form `symbol'.
 	      (make-local-variable this)
 	      (makunbound this))))))))
 






      reply	other threads:[~2014-03-10  2:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21  2:06 bug#14430: [PATCH] Desktop restore runs mark activation hooks when it shouldn't Kelly Dean
2014-03-10  2:19 ` Stefan Monnier [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvob1edcn5.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=14430-done@debbugs.gnu.org \
    --cc=kellydeanch@yahoo.com \
    /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 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).