dengste / minimap

Sidebar showing a "mini-map" of a buffer
172 stars 14 forks source link

Window buffer history loss on minimap show #1

Closed sadboy closed 4 years ago

sadboy commented 10 years ago

When minimap-window-location is 'left the "main" window's next-buffers and prev-buffers histories are lost upon showing the minimap (because the "main" window is a new window, and the old window is now taken by *MINIMAP*). minimap should probably attempt to restore the histories, something like:

diff --git a/minimap.el b/minimap.el
index 4d58023..39b3847 100644
--- a/minimap.el
+++ b/minimap.el
@@ -332,7 +332,9 @@ when you enter a buffer which is not derived from

 (defun minimap-create-window ()
   (let ((width (round (* (window-width)
-            minimap-width-fraction))))
+            minimap-width-fraction)))
+        (next-buffers (window-next-buffers))
+        (prev-buffers (window-prev-buffers)))
     (when (< width minimap-minimum-width)
       (setq width minimap-minimum-width))
     (if (eq minimap-window-location 'left)
@@ -358,7 +360,10 @@ when you enter a buffer which is not derived from
       (set-window-dedicated-p nil t))
     (prog1
    (selected-window)
-      (other-window 1))))
+      (other-window 1)
+      ;; Restore main window history:
+      (set-window-next-buffers nil next-buffers)
+      (set-window-prev-buffers nil prev-buffers))))

 (defun minimap-setup-hooks (&optional remove)
   "Hook minimap into other modes.
dengste commented 4 years ago

Thanks, this is now fixed (finally...).