My Emacs Setup
Overview
I’m going to keep this post updated with my latest Emacs setup. This is more for me to remember how I have it setup in case I ever have to set it up again.
My dotfiles are stored here:
https://github.com/htemuri/dotfiles.git 
Run as daemon
In order to persist my emacs sessions between different client processes, I start up an Emacs daemon on boot through systemd. My system unit file looks like below and is stored in /etc/systemd/system/emacs.service:
[Unit]
Description=Emacs Daemon
Documentation=man:emacs(1)
[Service]
Type=simple
ExecStart=/usr/bin/emacs --fg-daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Restart=on-failure
[Install]
Wanted=default.targetAfter creating this service unit file, if you’re running a RHEL distribution with SELinux enabled, you have to reevaluate the security context for the file with the following command:
sudo /sbin/restorecon -v /etc/systemd/system/emacs.serviceThen you should be able to start and enable the service
sudo systemctl start emacs
sudo systemctl enable emacs/etc/systemd/user/emacs.service and add the --user flag to the systemctl commands above.Client Desktop App
I’m running on GNOME desktop with dark mode, and because Emacs is still running on legacy gtk, you have to set the theme manually with an environment variable when starting the Emacs client1. I updated the Emacs desktop app configuration (in /usr/share/applications/emacs.desktop) to the following:
[Desktop Entry]
Name=Emacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=env GTK_THEME=Adwaita:dark emacs %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupNotify=trueFootnotes
-
Found this solution in this reddit comment . ↩