emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/indent-bars d59d94d622 088/431: 2nd attempt defer setup


From: ELPA Syncer
Subject: [elpa] externals/indent-bars d59d94d622 088/431: 2nd attempt defer setup when running under daemon
Date: Mon, 16 Sep 2024 12:59:17 -0400 (EDT)

branch: externals/indent-bars
commit d59d94d6223f775208718c101cab3c959cd54c25
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>

    2nd attempt defer setup when running under daemon
    
    See dinkonin #10
---
 README.md      |  8 --------
 indent-bars.el | 12 +++++++++++-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 8e7f07aa32..82ca0bb501 100644
--- a/README.md
+++ b/README.md
@@ -46,14 +46,6 @@ To clone with `use-package` and `straight`:
   :hook ((python-mode yaml-mode) . indent-bars-mode)) ; or whichever modes you 
prefer
 ```
 
-## With `--daemon`
-If you open files via emacsclient which start emacs, and for which 
`indent-bars` will be enabled using the emacs daemon, you may need to delay 
loading until after the server-start, e.g.:
-
-```elisp
-  :hook
-  (server-after-make-frame-hook . (lambda () (add-hook 'prog-mode-hook  
'indent-bars-mode)))
-```
-
 ## Compatibility 
 
 For `indent-bars` to display fancy guide bars, your port and version of emacs 
must correctly display the `:stipple` face attribute.  **Most do.**  It can 
also be used *without stipples*, drawing a simple vertical character (like `│`) 
instead.  It automatically does this in non-graphical displays (terminals), but 
can optionally be configured to always do so; see [Non-stipple 
Display](#non-stipple-display).
diff --git a/indent-bars.el b/indent-bars.el
index fae08f145b..fa9f56715d 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -982,13 +982,23 @@ 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))
+
 ;;;###autoload
 (define-minor-mode indent-bars-mode
   "Indicate indentation with configurable bars."
   :global nil
   :group 'indent-bars
   (if indent-bars-mode
-      (indent-bars-setup)
+      (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))
+       (indent-bars-setup))
     (indent-bars-teardown)))
 
 (provide 'indent-bars)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]