Little more tweaks for Linux and Emacs
This commit is contained in:
parent
264720be8e
commit
5c887b7bd6
2 changed files with 55 additions and 47 deletions
100
README-Linux.org
100
README-Linux.org
|
@ -73,11 +73,10 @@ make -j$(nproc) && sudo make install
|
||||||
* Supporting Packages
|
* Supporting Packages
|
||||||
Now install all the extras:
|
Now install all the extras:
|
||||||
#+begin_src sh
|
#+begin_src sh
|
||||||
brew install git-delta
|
sudo apt install -y libvterm-dev
|
||||||
brew install libvterm
|
sudo apt install -y git-delta
|
||||||
brew install mu
|
sudo apt install -y mu4e isync
|
||||||
brew install isync
|
sudo apt install -y gpg
|
||||||
brew install gpg
|
|
||||||
#+end_src
|
#+end_src
|
||||||
** Mu4a
|
** Mu4a
|
||||||
See [[file:ha-email.org][ha-email]] for better instructions.
|
See [[file:ha-email.org][ha-email]] for better instructions.
|
||||||
|
@ -99,7 +98,7 @@ Basic configuration, that I actually supersede.
|
||||||
IMAPAccount gmail
|
IMAPAccount gmail
|
||||||
Host imap.gmail.com
|
Host imap.gmail.com
|
||||||
User username@gmail.com
|
User username@gmail.com
|
||||||
PassCmd "/opt/homebrew/bin/gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.password-store/mbsync/gmail.gpg"
|
PassCmd "/usr/bin/gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.password-store/mbsync/gmail.gpg"
|
||||||
AuthMechs LOGIN
|
AuthMechs LOGIN
|
||||||
SSLType IMAPS
|
SSLType IMAPS
|
||||||
|
|
||||||
|
@ -123,48 +122,57 @@ Basic configuration, that I actually supersede.
|
||||||
# ========== Gmail ==========
|
# ========== Gmail ==========
|
||||||
#+end_src
|
#+end_src
|
||||||
* Dæmon Processes
|
* Dæmon Processes
|
||||||
On the Mac, =cron= has been removed and replaced with =LaunchAgent=. I find my [[file:ha-capturing-notes.org::*Push MacOS-Specific Content][ICanHazShortcut]] process pretty simple to start Emacs, so I’m not sure about this dæmon, but …
|
According to [[https://medium.com/@nevinvalsaraj/setting-up-emacs-as-a-daemon-in-ubuntu-20-04-6c4f8c441a83][this essay]], we have several ways to launch Emacs as a daemon during startup. Since =systemd= is the =init= daemon in v20+, we register Emacs as a service under =systemd= to be launched during startup. Systemd will monitor this service and restart if the service crashes for any reason. To configure the service, we first create the file =~/.config/systemd/user/emacs.service= and copy the below:
|
||||||
** Emacs dæmon via LaunchAgent
|
|
||||||
Notice that =UserName= section should be your =$USER= value.
|
#+begin_src conf :tangle ~/.config/systemd/user/emacs.service
|
||||||
#+begin_src xml :tangle ~/Library/LaunchAgents/gnu.emacs.plist
|
[Unit]
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
Description=Emacs text editor
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
[Service]
|
||||||
<key>KeepAlive</key>
|
Type=forking
|
||||||
<true/>
|
ExecStart=/usr/local/bin/emacs --daemon
|
||||||
<key>Label</key>
|
ExecStop=/usr/local/bin/emacsclient --eval "(kill-emacs)"
|
||||||
<string>gnu.emacs</string>
|
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
|
||||||
<key>ProgramArguments</key>
|
Restart=on-failure
|
||||||
<array>
|
|
||||||
<string>/opt/homebrew/bin/emacs</string>
|
[Install]
|
||||||
<string>--fg-dæmon</string>
|
WantedBy=default.target
|
||||||
</array>
|
|
||||||
<key>RunAtLoad</key>
|
|
||||||
<true/>
|
|
||||||
<key>StandardErrorPath</key>
|
|
||||||
<string>/tmp/gnu-emacs-dæmon.log</string>
|
|
||||||
<key>StandardOutPath</key>
|
|
||||||
<string>/tmp/gnu-emacs-dæmon.log</string>
|
|
||||||
<key>UserName</key>
|
|
||||||
<string>howard</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Verify that the plist file is correct.
|
Then run the following in the terminal:
|
||||||
#+begin_src sh
|
#+begin_example
|
||||||
plutil -lint ~/Library/LaunchAgents/gnu.emacs.plist
|
systemctl enable --user emacs
|
||||||
#+end_src
|
systemctl start --user emacs
|
||||||
|
#+end_example
|
||||||
|
|
||||||
Start, stop and list service.
|
Verify that the emacs service is running by using:
|
||||||
#+begin_src sh
|
#+begin_example
|
||||||
launchctl load -w /Users/USERNAME/Library/LaunchAgents/gnu.emacs.plist
|
systemctl status --user emacs
|
||||||
launchctl unload /Users/USERNAME/Library/LaunchAgents/gnu.emacs.plist
|
#+end_example
|
||||||
launchctl list
|
|
||||||
#+end_src
|
Now, we only use =emacsclient=. We have these terminal alias:
|
||||||
|
- =e=: Open a terminal version
|
||||||
|
- =ee=: Open an Emacs frame
|
||||||
** Fetch mails periodically
|
** Fetch mails periodically
|
||||||
Let’s make another dæmon for fetching mail. Again, replace =UserName= with your user account name.
|
Let’s make another dæmon for fetching mail. Perhaps we should use [[https://github.com/rlue/little_red_flag][gnubiff]] instead.
|
||||||
|
|
||||||
|
#+begin_src conf :tangle ~/.config/systemd/user/mbsync.service
|
||||||
|
[Unit]
|
||||||
|
Description=Mbsync Mail Fetcher
|
||||||
|
Documentation=https://www.systutorials.com/docs/linux/man/1-mbsync/
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
ExecStart=/usr/bin/mbsync --daemon
|
||||||
|
ExecStop=/usr/bin/mbsync --eval "(kill-mbsync)"
|
||||||
|
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
|
|
||||||
|
#+end_src
|
||||||
#+begin_src xml :tangle ~/Library/LaunchAgents/periodic.mbsync.plist
|
#+begin_src xml :tangle ~/Library/LaunchAgents/periodic.mbsync.plist
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
@ -213,10 +221,10 @@ Script that fetches mails and updates the mail index.
|
||||||
#+begin_src sh :tangle ~/.bin/mbsync-task :shebang #!/bin/bash
|
#+begin_src sh :tangle ~/.bin/mbsync-task :shebang #!/bin/bash
|
||||||
echo ""
|
echo ""
|
||||||
echo "Running $(date +"%Y-%m-%d %H:%M")"
|
echo "Running $(date +"%Y-%m-%d %H:%M")"
|
||||||
/opt/homebrew/bin/mbsync -Va
|
/usr/bin/mbsync -Va
|
||||||
echo "Exit code:"
|
echo "Exit code:"
|
||||||
echo $?
|
echo $?
|
||||||
/opt/homebrew/bin/emacsclient -e '(mu4e-update-index)'
|
/usr/local/bin/emacsclient -e '(mu4e-update-index)'
|
||||||
echo "Exit code:"
|
echo "Exit code:"
|
||||||
echo $?
|
echo $?
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
|
@ -91,7 +91,7 @@ I'm thinking the [[https://zevlg.github.io/telega.el/][Telega package]] would be
|
||||||
:commands (telega)
|
:commands (telega)
|
||||||
:config
|
:config
|
||||||
(setq telega-user-use-avatars nil
|
(setq telega-user-use-avatars nil
|
||||||
telega-use-tracking-for '(any pin unread)
|
telega-use-tracking-for nil ; '(any pin unread)
|
||||||
telega-chat-use-markdown-formatting t
|
telega-chat-use-markdown-formatting t
|
||||||
telega-emoji-use-images t
|
telega-emoji-use-images t
|
||||||
; telega-completing-read-function #'ivy-completing-read
|
; telega-completing-read-function #'ivy-completing-read
|
||||||
|
|
Loading…
Reference in a new issue