reddit / emacs

Problem loading init.el for emacsclient on macos

acidoglutammico · 2022-11-30 13:26
I'm trying to reduce startup time for emacs, so naturally emacsclient could be a solution. Before creating a plist and automatically load emacs at launch I'm trying to see if my configs work. I start from terminal `emacs --deamon` and after i call `emacsclient -c` https://imgur.com/h6P7xDw This is what the emacsclient window shows: https://imgur.com/ct3j1yG This is what the emacs started normally (from terminal `emacs`): shows https://imgur.com/6kNC8DI this is the `*Messages*` buffer for emacsclient: Loading /Users/elvisrossi/.emacs.d/config.el (source)... [yas] Prepared just-in-time loading of snippets successfully. [2 times] Loading /Users/elvisrossi/.emacs.d/config.el (source)...done Loaded ~/.emacs.d/config.el Turning on magit-auto-revert-mode...done Starting Emacs daemon. Unable to load color "brightblack" Unable to load color "brightcyan" Unable to load color "brightblack" [2 times] Unable to load color "unspecified-bg" Unable to load color "brightblack" [4 times] Unable to load color "brightcyan" Unable to load color "brightblack" [2 times] Unable to load color "unspecified-bg" Unable to load color "brightblack" [4 times] When done with this frame, type C-x 5 0 Error during redisplay: (eval (spaceline-ml-main)) signaled (wrong-number-of-arguments (3 . 4) 0) Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp nil) Unable to load color "brightcyan" [2 times] Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp nil) [197 times] Error during redisplay: (eval (spaceline-ml-main)) signaled (wrong-number-of-arguments (3 . 4) 0) Error during redisplay: (eval (centaur-tabs-line)) signaled (wrong-type-argument stringp nil) The last two lines are repeated a bunch of times. In my `.init.el`I have: (require 'package) (setq package-enable-at-startup nil) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (when (< emacs-major-version 27) (package-initialize)) (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) (unless (package-installed-p 'nord-theme) (package-refresh-contents) (package-install 'nord-theme)) ;; add to path (add-to-list 'load-path (concat user-emacs-directory "lisp")) ;; sync PATH to shell PATH when started from gui (defun set-exec-path-from-shell-PATH () (interactive) (let ((path-from-shell (replace-regexp-in-string "[ \t\n]*$" "" (shell-command-to-string "$SHELL --login -c 'echo $PATH'" )))) (setenv "PATH" path-from-shell) (setq exec-path (split-string path-from-shell path-separator)))) (set-exec-path-from-shell-PATH) ;;;;;;;;;;;;;;;;;;;;;;;;; ;; use config.org file as source (org-babel-load-file (concat user-emacs-directory "config.org")) and after custom-set-variables. Any help is appreciated
thatsrelativity · 2022-11-30 14:55
I see you're setting the exec path from the shell - could it be that emacs doesn't have access to your shell environment when started as a daemon? I'm just guessing here so I might be way off
acidoglutammico · 2022-11-30 15:05
I don't think that is a problem since removing `set-exec-path-from-shell-PATH` also works with `emacs`, but has the same problems with `emacsclient`. edit: I'm using emacs-plus so it's handling the path variable, but i have the same behaviour with the default emacs package from brew
11fdriver · 2022-11-30 22:04
I suspect that there's something wrong in your `config.org` one of the files in your lisp dir. Can you verify that and/or track down which one is causing the error? I believe those colours are only available in terminal emacs. If you run `emacsclient -t` do you get the same messages? As a side note, `emacsclient` opens with the `*scratch*` buffer by default. You should throw something in the make-frame hook to change that. `(add-hook 'server-after-make-frame-hook 'about-emacs)`
acidoglutammico · 2022-11-30 22:43
I tried completely disabling `config.org` and still the issue persists. Also emacsclient in terminal mode has the same problems. If it would be of any help I could upload my emacs config files, but i doubt that the problem is in there. edit: uploaded all my config files here: https://gitlab.com/AcidoGlutammico/emacs_configs
graduale · 2022-12-01 14:04
You write > I tried completely disabling  config.org  and still the issue persists. What do you mean by that? Many of the issues listed above come from emacs calling functions from e.g. Centaur-tabs, but that’s only being loaded in config.org. So what are the issues that persist?