Subject: Re: bug#20260: 24.4.1; Triple-clicking selects and deselects the line in weird situations

From: Stefan Monnier <[email-masked]>
Date: Tue, 07 Apr 2015 14:53:42 -0400

> Triple-click on the "World" in the *Bug* buffer. Notice that Emacs
> selects the whole line only momentarily, and then deselects it again
> immediately.

Indeed.  I though I had fixed this in Emacs-25 by making deactivate-mark
buffer-local, but I actually failed to adjust the C code accordingly.

The patch below seems to fix your test case.  Can you confirm it also
fixes your real use case?

        Stefan

diff --git a/src/fileio.c b/src/fileio.c
index d4e12cb..a6e7fbb 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4165,7 +4165,7 @@ by calling `format-decode', which see.  */)
       Vdeactivate_mark = old_Vdeactivate_mark;
     }
   else
-    Vdeactivate_mark = Qt;
+    Fset (Qdeactivate_mark, Qt);
 
   emacs_close (fd);
   clear_unwind_protect (fd_index);
diff --git a/src/insdel.c b/src/insdel.c
index 80650be..22c2bcc 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1846,7 +1846,7 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end,
       = call1 (Fsymbol_value (Qregion_extract_function), Qnil);
 
   signal_before_change (start, end, preserve_ptr);
-  Vdeactivate_mark = Qt;
+  Fset (Qdeactivate_mark, Qt);
 }
 
 /* Like above, but called when we know that the buffer text