SqrtMinusOne / dotfiles

This road is never-ending
https://sqrtminusone.xyz/config
Apache License 2.0
51 stars 3 forks source link

Minor obstacles when trying to apply Emacs.org on other systems. #2

Open paxsali opened 2 years ago

paxsali commented 2 years ago

Hi,

I stumbled over a reddit post about this Emacs config and I was curious to try out and see what I could learn and adapt for my own Emacs configs.

By doing so I identified and overcame some minor obstacles, and I wanted to share this information in case you're interested into making your Emacs config more accessible for people who are trying it out on their systems.

Sources:

Feel free to discuss.

Steps

The following is a series of steps that I have re-done twice, once for getting it done and the second time for the purpose of reproducability and documentation.

preparations

create fake home directory to not interfere with your own Emacs

mkdir -p ~/.home/SqrtMinusOne
cd ~/.home/SqrtMinusOne

download SqrtMinusOne Emacs config

wget https://raw.githubusercontent.com/SqrtMinusOne/dotfiles/master/Emacs.org

change to the fake home environment

env HOME="$PWD" bash
export PS1='(SqrtMinusOne) \u@\h \w $ '

tangle the Emacs config into ~/.emacs.d/init.el (inside fake home)

Attempt No.1:

emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "Emacs.org")'

Error message:

Could not read org-id-values from ~/.emacs.d/.org-id-locations.  Setting it to nil.
Evaluate this emacs-lisp code block (packages) on your system? (yes or no) yes
executing Emacs-Lisp code block (packages)...
Symbol’s function definition is void: my/format-guix-dependencies

issue No.1

my/format-guix-dependencies apparently only makes sense on systems with GUIX, I assume.

workaround for issue No.1

Uncomment the offending lines:

--- Emacs-orig.org      2022-02-13 15:02:58.589128700 +0100
+++ Emacs.org   2022-02-13 15:06:17.379128700 +0100
@@ -4978,7 +4978,7 @@
 #+begin_example
 #+NAME: packages
 #+begin_src emacs-lisp :tangle no :var category=""
-(my/format-guix-dependencies category)
+;; (my/format-guix-dependencies category)
 #+end_src
 #+end_example

@@ -6578,7 +6578,7 @@

 #+NAME: packages
 #+begin_src emacs-lisp :tangle no
-(my/format-guix-dependencies)
+;; (my/format-guix-dependencies)
 #+end_src

 #+begin_src scheme :tangle .config/guix/manifests/emacs.scm :noweb yes

tangle the Emacs config attempt No.2

emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "Emacs.org")'

Output:

Could not read org-id-values from ~/.emacs.d/.org-id-locations.  Setting it to nil.
Evaluate this emacs-lisp code block (packages) on your system? (yes or no) yes
executing Emacs-Lisp code block (packages)...
nil
Setting up indent for shell type bash
Indentation variables are now local.
Indentation setup for shell type bash
Tangled 335 code blocks from Emacs.org

Successfully tangled Emacs.org into .emacs.d/init.el.

starting Emacs attempt No.1

emacs

Error message:

Warning (initialization): An error occurred while loading ‘/home/paxsali/.home/SqrtMinusOne/.emacs.d/init.el’:

error: Font not available, #<font-spec nil nil JetBrainsMono Nerd Font nil nil nil nil nil 10.0 nil nil nil ((:name . JetBrainsMono Nerd Font 10) (:user-spec . JetBrainsMono Nerd Font 10))>

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

issue No.2

JetBrains Mono font is configured as per default. On systems without this font, above error message will prevent the start of Emacs.

workaround for issue No.2

Either change the font in the init.el to an available font or download JetBrains Mono from nerd-fonts.

download & extract JetBrains fonts from nerd-fonts (github.com)

mkdir ~/.fonts
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/JetBrainsMono.zip
cd ~/.fonts
unzip ~/JetBrainsMono.zip
cd ~
fc-cache

starting Emacs attempt No.2

emacs

Error message:

Warning (initialization): An error occurred while loading ‘/home/paxsali/.home/SqrtMinusOne/.emacs.d/init.el’:

File is missing: Opening directory, No such file or directory, /home/paxsali/.home/SqrtMinusOne/Documents/org-mode/trello

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

issue No.3

Apparently the Emacs.org config references a directory without checking first, if it exists, and without creating it silently.

workaround for issue No.3

Create the refered directory.

mkdir -p Documents/org-mode/trello

starting Emacs attempt No.3

emacs

Error message:

Warning (initialization): An error occurred while loading ‘/home/paxsali/.home/SqrtMinusOne/.emacs.d/init.el’:

File is missing: Cannot open load file, No such file or directory, /home/paxsali/.home/SqrtMinusOne/.emacs.d/mail.el

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

issue No.4

Apparently init.el attempts to load mail.el without checking if it exists first.

workaround for issue No.4

Uncomment the offending line in init.el.

--- init-orig.el        2022-02-13 15:06:35.379128700 +0100
+++ init.el     2022-02-13 15:27:51.359128700 +0100
@@ -3774,8 +3774,8 @@
 (my-leader-def
   "cf" '(my/open-yadm-file :wk "yadm file"))

-(unless (or my/is-termux my/remote-server)
-  (load-file (expand-file-name "mail.el" user-emacs-directory)))
+;; (unless (or my/is-termux my/remote-server)
+;;   (load-file (expand-file-name "mail.el" user-emacs-directory)))

 (use-package elfeed
   :straight (:repo "SqrtMinusOne/elfeed" :host github)
SqrtMinusOne commented 2 years ago

Thank you! I didn't think someone would actually try to launch my config. Pretty cool that you made it though.

I've added checks for the problems you had, so Emacs should at least be able to launch, but I'll keep this issue open for now. At least until I decide to document the deployment process.