branch: externals/indent-bars
commit 628d42f2044c417217abb3693ce8ecf663a8b39d
Author: JD Smith <[email protected]>
Commit: JD Smith <[email protected]>
Defer setup when running under daemon and remove from README
Frame properties are not yet available
---
README.md | 8 --------
indent-bars.el | 9 ++++++++-
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 9868088d4c..8a346a88ad 100644
--- a/README.md
+++ b/README.md
@@ -43,14 +43,6 @@ To clone with `use-package` and `straight`, add to config:
: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 work, your port and version of emacs must correctly
display the `:stipple` face attribute. **Most do.**
diff --git a/indent-bars.el b/indent-bars.el
index 744252b80c..c97475da63 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -895,13 +895,20 @@ 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 (daemonp)
+ (add-hook 'after-make-frame-functions #'indent-bars-setup-and-remove)
+ (indent-bars-setup))
(indent-bars-teardown)))
(provide 'indent-bars)