branch: externals/indent-bars
commit 09dd1d6f7548044c1722a9ed64b01168aca48f9f
Author: JD Smith <[email protected]>
Commit: JD Smith <[email protected]>

    Correct after-make-frame handling for daemon
---
 indent-bars.el | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/indent-bars.el b/indent-bars.el
index 68d48df3f5..cbfd7d1f22 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -1246,10 +1246,11 @@ Adapted from `highlight-indentation-mode'."
   (indent-bars-teardown)
   (indent-bars-setup))
 
-(defun indent-bars-setup-and-remove ()
-  "Setup indent bars and remove from `after-make-frame-functions'."
-  (remove-hook 'after-make-frame-functions #'indent-bars-setup-and-remove)
-  (indent-bars-setup))
+(defun indent-bars-setup-and-remove (frame)
+  "Setup indent bars for FRAME and remove from `after-make-frame-functions'."
+  (when (display-graphic-p frame)
+    (remove-hook 'after-make-frame-functions #'indent-bars-setup-and-remove)
+    (indent-bars-setup)))
 
 ;;;###autoload
 (define-minor-mode indent-bars-mode
@@ -1258,11 +1259,8 @@ Adapted from `highlight-indentation-mode'."
   :group 'indent-bars
   (if indent-bars-mode
       (if (and (daemonp) (not (frame-parameter nil 'client)))
-         (let ((buf (current-buffer)))
-           (add-hook 'after-make-frame-functions
-                     (lambda () (with-current-buffer buf
-                                  (indent-bars-setup-and-remove)))
-                     nil t))
+         (add-hook 'after-make-frame-functions
+                   #'indent-bars-setup-and-remove nil t)
        (indent-bars-setup))
     (indent-bars-teardown)))
 

Reply via email to