Fanael / persistent-scratch

Preserve the scratch buffer across Emacs sessions
132 stars 14 forks source link

Persistent-scratch starts in visual state with evil-mode #9

Closed dieggsy closed 7 years ago

dieggsy commented 7 years ago

When using evil-mode and persistent-scratch is loaded, the buffer is put into evil-visual-state and the text in the scratch buffer is highlighted. Unsure what the cause is/how to fix. The following is how I am loading persistent-scratch, note that it is deferred.

(use-package persistent-scratch
  :ensure t
  :defer 10
  :config
  (persistent-scratch-setup-default))
Fanael commented 7 years ago

Does this patch solve the issue?

diff --git a/persistent-scratch.el b/persistent-scratch.el
index 74733e8..5605478 100644
--- a/persistent-scratch.el
+++ b/persistent-scratch.el
@@ -194,7 +194,8 @@ same name as a saved buffer, the contents of that buffer will be overwritten."
         (let ((point-and-mark (aref saved-buffer 2)))
           (when point-and-mark
             (goto-char (car point-and-mark))
-            (set-mark (cdr point-and-mark))))
+            (set-mark (cdr point-and-mark))
+            (deactivate-mark)))
         (let ((narrowing (aref saved-buffer 4)))
           (when narrowing
             (narrow-to-region (car narrowing) (cdr narrowing))))))))
justmytwospence commented 7 years ago

I can confirm that this patch does solve the issue.

Fanael commented 7 years ago

Should be fixed now.