PythonNut / quark-emacs

:rocket: An incredible wonderland of code
MIT License
137 stars 6 forks source link

Only auto-insert for visible buffers #53

Closed PythonNut closed 6 years ago

PythonNut commented 7 years ago
diff --git a/modules/config-intel.el b/modules/config-intel.el
index 1eb64ad..a71f086 100644
--- a/modules/config-intel.el
+++ b/modules/config-intel.el
@@ -217,7 +217,8 @@

 (add-hook 'after-change-major-mode-hook
           (lambda ()
-            (when (= (point-min) (point-max))
+            (when (and (= (point-min) (point-max))
+                       (get-buffer-window (current-buffer)))
               (auto-insert))))

 ;;; ==================================
PythonNut commented 6 years ago

This does not work, as the buffer may not become visible by the time its major mode is set. :(