unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19058: [PATCH] Desktop restore fails to run mark activation hooks when it should
@ 2014-11-15  6:56 Kelly Dean
  0 siblings, 0 replies; 2+ messages in thread
From: Kelly Dean @ 2014-11-15  6:56 UTC (permalink / raw)
  To: 19058

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

Delete your .emacs.desktop, and put in init.el:

(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.4, open a file, press C-SPC, then exit Emacs and save the desktop, then restart Emacs. Notice that the cursor type is now a block, not a bar. It should be a bar.

This bug wasn't in 24.3, and is the opposite of bug 14430. The fix for this new bug is the same patch that I already sent on May 20, 2013 for that bug (my patch fixed that bug without introducing this new bug). That patch wasn't accepted, and instead this new bug and a FIXME comment were introduced into desktop.el for 24.4.

This new bug could be fixed without applying that patch by instead applying second-restoremarkbug.bad-patch that's attached to this message (conditionally calling activate-mark as the new FIXME proposes), but that's a hack that invites future bugs when somebody modifies set-mark and forgets to correspondingly modify the code in desktop-create-buffer that duplicates the functionality of set-mark. The right fix is to not duplicate the functionality of set-mark, and instead just call set-mark and tell it whether to call activate-mark, as my original patch did.

I've been asked to not send any more patches to apply to Emacs, but this new patch is just to point out what NOT to apply, so I trust it's ok to send it.

Of course, nobody besides me cares about this bug, but its existence serves as a convenient excuse for me to ask Stefan to please add the dont-activate option to set-mark so I don't have to maintain it anymore in my personal patches. ;-)

[-- Attachment #2: second-restoremarkbug.bad-patch --]
[-- Type: application/octet-stream, Size: 730 bytes --]

Don't apply this patch! It's the wrong fix for the bug.

--- emacs-24.4/lisp/desktop.el
+++ emacs-24.4/lisp/desktop.el
@@ -1413,8 +1413,7 @@
             (if (consp desktop-buffer-mark)
                 (progn
                   (move-marker (mark-marker) (car desktop-buffer-mark))
-                  ;; FIXME: Should we call (de)activate-mark instead?
-                  (setq mark-active (car (cdr desktop-buffer-mark))))
+                  (if (car (cdr desktop-buffer-mark)) (activate-mark 'no-tmm)))
               (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))

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

* bug#19058: [PATCH] Desktop restore fails to run mark activation hooks when it should
       [not found] <emacs-mail-is-unusable-2>
@ 2014-11-21 18:02 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-11-21 18:02 UTC (permalink / raw)
  To: Kelly Dean; +Cc: 19058-done

> Of course, nobody besides me cares about this bug, but its existence serves
> as a convenient excuse for me to ask Stefan to please add the dont-activate
> option to set-mark so I don't have to maintain it anymore in my personal
> patches. ;-)

But if you call set-mark and a non-nil dont-activate argument, you get
the same as (move-marker (mark-marker) <foo>), so this arg only makes
sense in the case where you dynamically want to choose whether to
activate the mark or not, which is very rare.

So I installed a patch that just calls activate-mark.


        Stefan





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

end of thread, other threads:[~2014-11-21 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-15  6:56 bug#19058: [PATCH] Desktop restore fails to run mark activation hooks when it should Kelly Dean
     [not found] <emacs-mail-is-unusable-2>
2014-11-21 18:02 ` Stefan Monnier

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