From 3cb2f98be42b53aeea5edb65c9c1bde08a8496b1 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 9 May 2022 20:36:32 -0500 Subject: meh --- lisp/+elfeed.el | 12 ++++++++---- lisp/+scratch.el | 25 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 5 deletions(-) (limited to 'lisp') 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." (elfeed-db-load) (elfeed-update) ;; Wait for `elfeed-update' to finish - (while (> (elfeed-queue-count-total) 0) - (sleep-for 5) - (message "%s" (elfeed-queue-count-total)) - (accept-process-output)) + (let ((q<5-count 0)) + (while (and (> (elfeed-queue-count-total) 0) + (< q<5-count 5)) + (sleep-for 5) + (message "Elfeed queue count total: %s" (elfeed-queue-count-total)) + (when (< (elfeed-queue-count-total) 5) + (cl-incf q<5-count)) + (accept-process-output))) ;; Garbage collect and save the database (elfeed-db-gc) (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 @@ (defun +scratch-immortal () "Bury, don't kill \"*scratch*\" buffer. For `kill-buffer-query-functions'." - (if (eq (current-buffer) (get-buffer "*scratch*")) + (if (or (eq (current-buffer) (get-buffer "*scratch*")) + (eq (current-buffer) (get-buffer "*text*"))) (progn (bury-buffer) nil) t)) @@ -35,5 +36,27 @@ For `kill-buffer-query-functions'." (concat (replace-regexp-in-string "^" ";; " s) "\n\n"))) +;; [[https://old.reddit.com/r/emacs/comments/ui1q41/weekly_tips_tricks_c_thread/i7ef4xg/][u/bhrgunatha]] +(defun +scratch-text-scratch () + "Create a \"*text*\" scratch buffer in Text mode." + (with-current-buffer (get-buffer-create "*text*") + (text-mode))) + +(defun +scratch-toggle (buffer) + "Switch to BUFFER, or to the previous buffer." + (switch-to-buffer (unless (eq (current-buffer) + (get-buffer buffer)) + buffer))) + +(defun +scratch-switch-to-scratch () + "Switch to scratch buffer." + (interactive) + (+scratch-toggle "*scratch*")) + +(defun +scratch-switch-to-text () + "Switch to text buffer." + (interactive) + (+scratch-toggle "*text*")) + (provide '+scratch) ;;; +scratch.el ends here -- cgit 1.4.1-21-gabe81