]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove the compilation-arrow-overlay on a major mode change/reinitialization
authorAlan Mackenzie <acm@muc.de>
Sun, 29 Sep 2019 15:39:16 +0000 (15:39 +0000)
committerAlan Mackenzie <acm@muc.de>
Sun, 29 Sep 2019 15:39:16 +0000 (15:39 +0000)
At the same time, remove the 2-character left margin.

* lisp/progmodes/compile.el (compilation-set-up-arrow-spec-in-margin): put
compilation-tear-down-arrow-spec-in-margin onto change-major-mode-hook.

lisp/progmodes/compile.el

index f0b34c702ca6e1a5906aaa919ae33adef27931f2..d80fef3103ef7886b672fe1fe369a663e08146ee 100644 (file)
@@ -2625,7 +2625,10 @@ Actual value is never used, only the text property.")
        (make-overlay overlay-arrow-position overlay-arrow-position))
   (overlay-put compilation-arrow-overlay
                'before-string compilation--dummy-string)
-  (set-window-margins (selected-window) (+ (or (car (window-margins)) 0) 2)))
+  (set-window-margins (selected-window) (+ (or (car (window-margins)) 0) 2))
+  ;; Take precautions against `compilation-mode' getting reinitialized.
+  (add-hook 'change-major-mode-hook
+            'compilation-tear-down-arrow-spec-in-margin nil t))
 
 (defun compilation-tear-down-arrow-spec-in-margin ()
   "Restore compilation-arrow-overlay to not using the margin, which is removed."