summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el6
-rw-r--r--lisp/+elfeed.el12
-rw-r--r--lisp/+scratch.el25
3 files changed, 38 insertions, 5 deletions
diff --git a/init.el b/init.el index 9819ca6..2be6de0 100644 --- a/init.el +++ b/init.el
@@ -847,6 +847,12 @@
847 (:require +scratch) 847 (:require +scratch)
848 (:option initial-major-mode #'lisp-interaction-mode 848 (:option initial-major-mode #'lisp-interaction-mode
849 initial-scratch-message (+scratch-fortune)) 849 initial-scratch-message (+scratch-fortune))
850 (:+leader "." #'+scratch-switch-to-scratch
851 "C-." #'+scratch-switch-to-scratch
852 "," #'+scratch-switch-to-text
853 "C-," #'+scratch-switch-to-text)
854 (+with-ensure-after-init
855 (+scratch-text-scratch))
850 (add-hook 'kill-buffer-query-functions #'+scratch-immortal)) 856 (add-hook 'kill-buffer-query-functions #'+scratch-immortal))
851 857
852(setup shr 858(setup shr
diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index c0b74f0..9257c8d 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el
@@ -105,10 +105,14 @@ If multiple items are selected, don't advance."
105 (elfeed-db-load) 105 (elfeed-db-load)
106 (elfeed-update) 106 (elfeed-update)
107 ;; Wait for `elfeed-update' to finish 107 ;; Wait for `elfeed-update' to finish
108 (while (> (elfeed-queue-count-total) 0) 108 (let ((q<5-count 0))
109 (sleep-for 5) 109 (while (and (> (elfeed-queue-count-total) 0)
110 (message "%s" (elfeed-queue-count-total)) 110 (< q<5-count 5))
111 (accept-process-output)) 111 (sleep-for 5)
112 (message "Elfeed queue count total: %s" (elfeed-queue-count-total))
113 (when (< (elfeed-queue-count-total) 5)
114 (cl-incf q<5-count))
115 (accept-process-output)))
112 ;; Garbage collect and save the database 116 ;; Garbage collect and save the database
113 (elfeed-db-gc) 117 (elfeed-db-gc)
114 (elfeed-db-save) 118 (elfeed-db-save)
diff --git a/lisp/+scratch.el b/lisp/+scratch.el index bd16ec2..e9b825a 100644 --- a/lisp/+scratch.el +++ b/lisp/+scratch.el
@@ -7,7 +7,8 @@
7(defun +scratch-immortal () 7(defun +scratch-immortal ()
8 "Bury, don't kill \"*scratch*\" buffer. 8 "Bury, don't kill \"*scratch*\" buffer.
9For `kill-buffer-query-functions'." 9For `kill-buffer-query-functions'."
10 (if (eq (current-buffer) (get-buffer "*scratch*")) 10 (if (or (eq (current-buffer) (get-buffer "*scratch*"))
11 (eq (current-buffer) (get-buffer "*text*")))
11 (progn (bury-buffer) 12 (progn (bury-buffer)
12 nil) 13 nil)
13 t)) 14 t))
@@ -35,5 +36,27 @@ For `kill-buffer-query-functions'."
35 (concat (replace-regexp-in-string "^" ";; " s) 36 (concat (replace-regexp-in-string "^" ";; " s)
36 "\n\n"))) 37 "\n\n")))
37 38
39;; [[https://old.reddit.com/r/emacs/comments/ui1q41/weekly_tips_tricks_c_thread/i7ef4xg/][u/bhrgunatha]]
40(defun +scratch-text-scratch ()
41 "Create a \"*text*\" scratch buffer in Text mode."
42 (with-current-buffer (get-buffer-create "*text*")
43 (text-mode)))
44
45(defun +scratch-toggle (buffer)
46 "Switch to BUFFER, or to the previous buffer."
47 (switch-to-buffer (unless (eq (current-buffer)
48 (get-buffer buffer))
49 buffer)))
50
51(defun +scratch-switch-to-scratch ()
52 "Switch to scratch buffer."
53 (interactive)
54 (+scratch-toggle "*scratch*"))
55
56(defun +scratch-switch-to-text ()
57 "Switch to text buffer."
58 (interactive)
59 (+scratch-toggle "*text*"))
60
38(provide '+scratch) 61(provide '+scratch)
39;;; +scratch.el ends here 62;;; +scratch.el ends here