aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-10-03 12:02:21 -0300
committerEuAndreh <eu@euandre.org>2020-10-03 12:02:21 -0300
commit30b0f254e16f45f29d701926011863efa2ae83ad (patch)
tree22a48d27ec61277671383ccad499c4ca57dd9e07
parentTODOs.org: Add link on Emacs on Nix (diff)
downloaddotfiles-30b0f254e16f45f29d701926011863efa2ae83ad.tar.gz
dotfiles-30b0f254e16f45f29d701926011863efa2ae83ad.tar.xz
Emacs: Add back elfeed
Long-live Emacs! Good-bye, "LiveMarks"!
-rw-r--r--bash/fake-symlinks.sh2
-rw-r--r--nixos/common.nix1
-rw-r--r--nixos/usurpador.nix1
-rwxr-xr-xscripts/ad-hoc/backup.sh3
-rwxr-xr-xscripts/ad-hoc/elfeed.sh9
-rwxr-xr-xscripts/cron/elfeed-job.sh25
-rw-r--r--spacemacs.el14
7 files changed, 53 insertions, 2 deletions
diff --git a/bash/fake-symlinks.sh b/bash/fake-symlinks.sh
index 3ee5588f..13c59ba3 100644
--- a/bash/fake-symlinks.sh
+++ b/bash/fake-symlinks.sh
@@ -63,7 +63,7 @@ for r in boneco website dotfiles; do
chmod +x "$HOME/dev/libre/$r/.git/hooks/pre-push"
done
-for job in annex backup repo-update notmuch-dump mbox-archive nix-search-update mr-remotes-backup; do
+for job in annex elfeed backup repo-update notmuch-dump mbox-archive nix-search-update mr-remotes-backup; do
sed "s/__JOB__/$job/" cronjob-with-email.sh > "$HOME/dev/libre/dotfiles/scripts/cron/${job}-job.sh"
chmod +x "$HOME/dev/libre/dotfiles/scripts/cron/${job}-job.sh"
done
diff --git a/nixos/common.nix b/nixos/common.nix
index f66f0c73..d8c4d0f1 100644
--- a/nixos/common.nix
+++ b/nixos/common.nix
@@ -9,6 +9,7 @@ let
deliver-queued-mail = every-hour;
annex-job = daily-at-12h30min;
+ elfeed-job = daily-at-12h30min;
backup-job = daily-at-12h30min;
repo-update-job = daily-at-12h30min;
notmuch-dump-job = daily-at-12h30min;
diff --git a/nixos/usurpador.nix b/nixos/usurpador.nix
index ce78fb8e..66462ce0 100644
--- a/nixos/usurpador.nix
+++ b/nixos/usurpador.nix
@@ -15,6 +15,7 @@ in rec {
common.crons.deliver-queued-mail
common.crons.annex-job
+ common.crons.elfeed-job
common.crons.backup-job
common.crons.repo-update-job
common.crons.notmuch-dump-job
diff --git a/scripts/ad-hoc/backup.sh b/scripts/ad-hoc/backup.sh
index 6bd3544e..112cccac 100755
--- a/scripts/ad-hoc/backup.sh
+++ b/scripts/ad-hoc/backup.sh
@@ -25,7 +25,8 @@ borg create \
~/.mozilla/ \
~/.config/quodlibet/ \
~/gPodder/ \
- ~/dev/libre/website/
+ ~/dev/libre/website/ \
+ ~/.elfeed/
# add folders to be backed up here
cd ~/dev/libre/borg/
diff --git a/scripts/ad-hoc/elfeed.sh b/scripts/ad-hoc/elfeed.sh
new file mode 100755
index 00000000..e6d31047
--- /dev/null
+++ b/scripts/ad-hoc/elfeed.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+
+timeout 120 \
+ emacs \
+ -batch \
+ -l ~/.emacs.d/init.el \
+ --eval "(run-hooks 'emacs-startup-hook)" \
+ --eval '(euandreh/elfeed-batch-update)'
diff --git a/scripts/cron/elfeed-job.sh b/scripts/cron/elfeed-job.sh
new file mode 100755
index 00000000..29e675a0
--- /dev/null
+++ b/scripts/cron/elfeed-job.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+LOG_FILE="$(mktemp)"
+exec &> >(tee -a "$LOG_FILE")
+
+finish() {
+ status=$?
+ if [[ $status = 0 ]]; then
+ STATUS="✅ SUCCESS (status $status)"
+ else
+ STATUS="❌ FAILURE (status $status)"
+ fi
+
+ echo "Sending report email..."
+
+ SUBJECT="Job report on $(hostname): ${STATUS} for elfeed-job.sh"
+ gpg -easr eu@euandre.org < "$LOG_FILE" | \
+ mail -s "$SUBJECT" eu@euandre.org
+ echo 'Mail sent!'
+}
+trap finish EXIT
+
+echo "Starting: $(date -Is)"
+~/dev/libre/dotfiles/scripts/ad-hoc/elfeed.sh
+echo "Finishing: $(date -Is)"
diff --git a/spacemacs.el b/spacemacs.el
index a64f1101..d72024e3 100644
--- a/spacemacs.el
+++ b/spacemacs.el
@@ -57,6 +57,8 @@ This function should only modify configuration layer settings."
docker
elixir
erc
+ (elfeed :variables
+ rmh-elfeed-org-files '("~/.emacs.d/private/elfeed.org"))
elm
emacs-lisp
epub
@@ -744,6 +746,17 @@ through `notmuch-message-attach-regex'."
commit
start)))
+(defun euandreh/elfeed-batch-update ()
+ (message "Starting (elfeed-update).")
+ (elfeed-org)
+ (elfeed)
+ (elfeed-update)
+ (while (> (elfeed-queue-count-total) 0)
+ (print (elfeed-queue-count-total))
+ (sleep-for 1)
+ (accept-process-output))
+ (message "Done."))
+
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after layers configuration.
@@ -770,6 +783,7 @@ This is the place where most of your configurations should be done. Unless it is
"p C-r" 'euandreh/projectile-reload-known-projects
"an" 'notmuch
"ai" 'erc-track-switch-buffer
+ "af" 'elfeed
"w/" 'split-window-right-and-focus
"w-" 'split-window-below-and-focus
"glh" 'git-link-homepage