summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-07-13 17:24:46 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-07-13 19:01:02 -0700
commit1f6664f8f6a58da7f6b5718b99bba701c4b51666 (patch)
tree5df12a8e39874106fb586d15ee3cee523844dffa
parent25f56c891535be2d0fbd9307fab7c653ab27adff (diff)
downloaddotfiles-1f6664f8f6a58da7f6b5718b99bba701c4b51666.tar.gz
raise GC thresholds while starting up Gnus
-rw-r--r--.emacs.d/init.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 47d6ec3a..4f693955 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -549,6 +549,13 @@ that's something we can determine.")
(set-window-prev-buffers nil ,prev-buffers))
. ,keyword-arguments)))
+(defmacro spw/with-less-gc (&rest forms)
+ "Execute FORMS with temporarily much higher GC thresholds."
+ (declare (indent 0))
+ `(let ((gc-cons-percentage 0.6)
+ (gc-cons-threshold 402653184))
+ ,@forms))
+
;;;; The *scratch* and *notes* buffers
@@ -1814,7 +1821,7 @@ The ideas behind these behaviours are as follows.
;; pass to that function, and if blank, do what function does now).
(defun spw/browse-gmane ()
(interactive)
- (gnus-no-server)
+ (spw/with-less-gc (gnus-no-server))
(gnus-group-browse-foreign-server '(nntp "news.gmane.io")))
(global-set-key "\C-cgG" #'spw/browse-gmane)
@@ -2722,14 +2729,16 @@ mutt's review view, after exiting EDITOR."
(if (and (daemonp) (file-directory-p "~/.fmail/")
(not (file-exists-p "~/.newsrc.eld")))
(user-error "Must use dedicated Emacs for Gnus first run")
- (gnus))))
+ (spw/with-less-gc (gnus)))))
(require 'gnus)
(if (not fetch-and-inbox)
- (if (gnus-alive-p) (pop-to-buffer-same-window gnus-group-buffer) (gnus))
+ (if (gnus-alive-p)
+ (pop-to-buffer-same-window gnus-group-buffer)
+ (spw/with-less-gc (gnus)))
;; We want to see mail that we think has just come in. This is the only
;; time we call 'notmuch new' without --no-hooks from Emacs rather than
;; just waiting for cron, because it's slow.
- (unless (gnus-alive-p) (gnus))
+ (unless (gnus-alive-p) (spw/with-less-gc (gnus)))
(with-temp-message "Fetching & indexing mail ..."
(call-process "notmuch" nil nil nil "new"))
(if (not (get-buffer "*Summary nnselect:Process-Weekday*"))
@@ -2743,7 +2752,7 @@ mutt's review view, after exiting EDITOR."
(and current-prefix-arg
(prefix-numeric-value current-prefix-arg))))
(require 'gnus)
- (unless (gnus-alive-p) (gnus))
+ (unless (gnus-alive-p) (spw/with-less-gc (gnus)))
(gnus-group-read-ephemeral-group
(concat "nnselect-" (message-unique-id)) (list 'nnselect "nnselect")
nil (cons (current-buffer) gnus-current-window-configuration) nil nil
@@ -2859,7 +2868,7 @@ mutt's review view, after exiting EDITOR."
(setq spw/gnus-all-process-groups
(spw/nm| (mapcar #'cdr process-groups)))
(require 'gnus) (require 'nnselect)
- (unless (gnus-alive-p) (gnus-no-server))
+ (unless (gnus-alive-p) (spw/with-less-gc (gnus-no-server)))
;; Kill all summaries in case any of their queries have changed.
(catch 'done