diff options
-rw-r--r-- | init.el | 9 | ||||
-rw-r--r-- | lisp/+elfeed.el | 55 |
2 files changed, 47 insertions, 17 deletions
diff --git a/init.el b/init.el index b930513..151bc69 100644 --- a/init.el +++ b/init.el | |||
@@ -488,7 +488,7 @@ | |||
488 | org-tags-column (- (- fill-column (length org-ellipsis))) | 488 | org-tags-column (- (- fill-column (length org-ellipsis))) |
489 | org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" | 489 | org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" |
490 | "|" "DONE(d!)") | 490 | "|" "DONE(d!)") |
491 | (sequence "|" "CANCELED(k!)") | 491 | (sequence "|" "CANCELED(k@)") |
492 | (sequence "MEETING(m)"))) | 492 | (sequence "MEETING(m)"))) |
493 | (:bind "RET" #'+org-return-dwim | 493 | (:bind "RET" #'+org-return-dwim |
494 | "<S-return>" #'+org-table-copy-down | 494 | "<S-return>" #'+org-table-copy-down |
@@ -609,7 +609,11 @@ | |||
609 | (:option tab-bar-tab-name-function '+tab-bar-basename | 609 | (:option tab-bar-tab-name-function '+tab-bar-basename |
610 | tab-bar-tab-name-truncated-max 20 | 610 | tab-bar-tab-name-truncated-max 20 |
611 | tab-bar-tab-name-ellipsis truncate-string-ellipsis | 611 | tab-bar-tab-name-ellipsis truncate-string-ellipsis |
612 | tab-bar-show t) | 612 | tab-bar-show t |
613 | tab-bar-close-button-show t | ||
614 | tab-bar-close-button (propertize " ✕ " 'display t | ||
615 | 'close-tab t) | ||
616 | tab-bar-new-button (propertize "+ " 'display t)) | ||
613 | (tab-bar-mode +1) | 617 | (tab-bar-mode +1) |
614 | (if (version< emacs-version "28.0") | 618 | (if (version< emacs-version "28.0") |
615 | (+tab-bar-misc-info-mode +1) | 619 | (+tab-bar-misc-info-mode +1) |
@@ -1089,6 +1093,7 @@ See also `crux-reopen-as-root-mode'." | |||
1089 | "&" #'+elfeed-show-browse-generic | 1093 | "&" #'+elfeed-show-browse-generic |
1090 | "RET" #'shr-browse-url) | 1094 | "RET" #'shr-browse-url) |
1091 | (:hook #'reading-mode) | 1095 | (:hook #'reading-mode) |
1096 | (:option +elfeed--update-first-time 60) | ||
1092 | (+elfeed-update-async-mode +1))) | 1097 | (+elfeed-update-async-mode +1))) |
1093 | 1098 | ||
1094 | (setup (:straight elfeed-org) | 1099 | (setup (:straight elfeed-org) |
diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index ef93347..4a874c3 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el | |||
@@ -40,7 +40,7 @@ | |||
40 | 40 | ||
41 | (defun +elfeed-update-command () | 41 | (defun +elfeed-update-command () |
42 | (interactive) | 42 | (interactive) |
43 | (let ((script (expand-file-name "~/.local/bin/elfeed"))) | 43 | (let ((script (expand-file-name "~/.local/bin/elfeed-update.el"))) |
44 | (message "[Elfeed] Updating in the background.") | 44 | (message "[Elfeed] Updating in the background.") |
45 | (setq +elfeed--update-running t) | 45 | (setq +elfeed--update-running t) |
46 | (elfeed-db-save) | 46 | (elfeed-db-save) |
@@ -51,21 +51,46 @@ | |||
51 | (unless (file-exists-p script) | 51 | (unless (file-exists-p script) |
52 | (make-directory (file-name-directory script) :parents) | 52 | (make-directory (file-name-directory script) :parents) |
53 | (with-temp-buffer | 53 | (with-temp-buffer |
54 | (insert "(progn\n" | 54 | (insert |
55 | " (load (locate-user-emacs-file \"early-init\"))\n" | 55 | (nconcat nil |
56 | " (straight-use-package 'elfeed)\n" | 56 | "#!/usr/bin/env -S emacs --script" |
57 | " (require 'elfeed)\n" | 57 | ;; I have to load the necessary files |
58 | " (elfeed)\n" | 58 | "(load (locate-user-emacs-file \"early-init\"))" |
59 | " (elfeed-update)\n" | 59 | "(straight-use-package 'elfeed)" |
60 | " (while (> (elfeed-queue-count-total) 0)\n" | 60 | "(straight-use-package 'elfeed-org)" |
61 | " (sleep-for 5)\n" | 61 | "(require 'elfeed)" |
62 | " (message \"%s\" (elfeed-queue-count-total))\n" | 62 | "(require 'elfeed-org)" |
63 | " (accept-process-output))\n" | 63 | ;; And set needed variables |
64 | " (elfeed-db-save-safe)\n" | 64 | `("(setq rmh-elfeed-org-files '(" |
65 | " (elfeed-db-gc-safe))") | 65 | ,(mapconcat (lambda (el) |
66 | (write-file script))) | 66 | (format "\"%s\"" el)) |
67 | rmh-elfeed-org-files | ||
68 | " ") | ||
69 | "))") | ||
70 | ;; Overwrite log function to go to stdout | ||
71 | "(defun elfeed-log (level fmt &rest objects)" | ||
72 | " (princ (format \"[%s] [%s]: %s\\n\"" | ||
73 | " (format-time-string \"%F %T\")" | ||
74 | " level" | ||
75 | " (apply #'format fmt objects))))" | ||
76 | ;; Load elfeed | ||
77 | "(elfeed-org)" | ||
78 | "(elfeed-db-load)" | ||
79 | "(elfeed)" | ||
80 | ;; Update elfeed | ||
81 | "(elfeed-update)" | ||
82 | ;; Wait to finish ... I think. | ||
83 | "(while (> (elfeed-queue-count-total) 0)" | ||
84 | " (sleep-for 5)" | ||
85 | " (message \"%s\" (elfeed-queue-count-total))" | ||
86 | " (accept-process-output))" | ||
87 | ;; Save and garbage-collect | ||
88 | "(elfeed-db-save)" | ||
89 | "(elfeed-db-gc)")) | ||
90 | (write-file script)) | ||
91 | (chmod script #o777)) | ||
67 | (set-process-sentinel (start-process-shell-command | 92 | (set-process-sentinel (start-process-shell-command |
68 | "Elfeed" nil (concat "emacs --script " script)) | 93 | "Elfeed" nil script) |
69 | (lambda (a b) | 94 | (lambda (a b) |
70 | (advice-remove 'elfeed #'+elfeed--update-message) | 95 | (advice-remove 'elfeed #'+elfeed--update-message) |
71 | (setq +elfeed--update-running nil) | 96 | (setq +elfeed--update-running nil) |