Merge branch 'main' of tildegit.org:acdw/emacs
This commit is contained in:
commit
a0b156b7e1
6
init.el
6
init.el
|
@ -847,6 +847,12 @@
|
|||
(:require +scratch)
|
||||
(:option initial-major-mode #'lisp-interaction-mode
|
||||
initial-scratch-message (+scratch-fortune))
|
||||
(:+leader "." #'+scratch-switch-to-scratch
|
||||
"C-." #'+scratch-switch-to-scratch
|
||||
"," #'+scratch-switch-to-text
|
||||
"C-," #'+scratch-switch-to-text)
|
||||
(+with-ensure-after-init
|
||||
(+scratch-text-scratch))
|
||||
(add-hook 'kill-buffer-query-functions #'+scratch-immortal))
|
||||
|
||||
(setup shr
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue