[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14430: [PATCH] Desktop restore runs mark activation hooks when it sh

From: Stefan Monnier
Subject: bug#14430: [PATCH] Desktop restore runs mark activation hooks when it shouldn't
Date: Sun, 09 Mar 2014 22:19:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> (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.


=== 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)
-                 (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 
          (dolist (this desktop-buffer-locals)
            (if (consp this)
-               ;; an entry of this form `(symbol . value)'
+               ;; An entry of this form `(symbol . value)'.
                  (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 via email to

[Prev in Thread] Current Thread [Next in Thread]