Compare commits

...

3 Commits

Author SHA1 Message Date
30892f9ca0
docs(emacs): remove garbage collection code
Some checks failed
deploy / build (push) Failing after 0s
It actually made Emacs hang a lot, which isn’t good
2024-09-12 21:02:16 +02:00
ba39302238
docs(hyprland): remove unused master layout 2024-09-12 21:01:01 +02:00
25e3b3db92
chore: update dependencies 2024-09-12 21:00:43 +02:00
3 changed files with 24 additions and 58 deletions

View File

@ -27,53 +27,6 @@ loaded, speeding Emacs up a bit.
(blink-cursor-mode 0) ; disable blinking cursor (blink-cursor-mode 0) ; disable blinking cursor
#+end_src #+end_src
*** Better garbage collection
Emacs sometimes freezes up a bit when doing some garbage collection,
which is not super. So, in order to fix that, I do two things:
1. Set up a really high threshold (I have a lot of RAM to spare, so I
dont really care),
2. Hook garbage collection thirty seconds after Emacs loses focus and
every thirty seconds after that,
3. Cancel garbage collection if Emacs gains focus back within this
thirty seconds window.
With a garbage collection threshold, Emacs should never garbage
collect on its own, and Emacs is free to freeze up for a few seconds
when it loses focus since Im looking away.
#+begin_src emacs-lisp
(setq garbage-collection-messages t ;; tell me when garbage collecting
gc-cons-threshold (* 16 1024 1024 1024)) ;; 16GiB of RAM
(defmacro my/time (&rest body)
`(let ((time (current-time)))
,@body
(float-time (time-since time))))
(defun my/garbage-collect ()
"Garbage collect and tell the user how much time it took."
(message "Garbage collector ran for %.06fs"
(my/time (garbage-collect))))
(defvar my/gc-timer nil
"Timer for garbage collection. See
`my/garbage-collect-on-focus-lost'.")
(defun my/garbage-collect-on-focus-lost ()
"Garbage collect when Emacs loses focus.
Garbage collection is only triggered thirty seconds after losing
focus, and only once."
(if (frame-focus-state)
(when (timerp my/gc-timer)
(cancel-timer my/gc-timer))
(setq my/gc-timer (run-with-idle-timer 30 nil #'my/garbage-collect))))
(add-function :after after-focus-change-function #'my/garbage-collect-on-focus-lost)
#+end_src
To write this, I mostly based myself on [[https://news.ycombinator.com/item?id=39190110][this HackerNews thread]] and [[https://akrl.sdf.org/#orgc15a10d][its
related article]].
** Emacs Behavior ** Emacs Behavior
*** Editing Text in Emacs *** Editing Text in Emacs
I *never* want to keep trailing spaces in my files, which is why Im I *never* want to keep trailing spaces in my files, which is why Im

View File

@ -135,18 +135,13 @@ animations {
Now, we can take care of the configuration of the layouts. The only Now, we can take care of the configuration of the layouts. The only
notable thing here is that I prefer to have no gaps when there is only notable thing here is that I prefer to have no gaps when there is only
one window in the dwindle layout. Not much is done with the master one window in the dwindle layout.
layout, as I dont use it.
#+begin_src conf #+begin_src conf
dwindle { dwindle {
pseudotile = true pseudotile = true
preserve_split = true preserve_split = true
no_gaps_when_only = 1 no_gaps_when_only = 1
} }
master {
new_is_master = true
}
#+end_src #+end_src
** Autolaunch of programs ** Autolaunch of programs

View File

@ -1111,7 +1111,16 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"braces@npm:^3.0.2, braces@npm:~3.0.2": "braces@npm:^3.0.3":
version: 3.0.3
resolution: "braces@npm:3.0.3"
dependencies:
fill-range: "npm:^7.1.1"
checksum: 10c0/7c6dfd30c338d2997ba77500539227b9d1f85e388a5f43220865201e407e076783d0881f2d297b9f80951b4c957fcf0b51c1d2d24227631643c3f7c284b0aa04
languageName: node
linkType: hard
"braces@npm:~3.0.2":
version: 3.0.2 version: 3.0.2
resolution: "braces@npm:3.0.2" resolution: "braces@npm:3.0.2"
dependencies: dependencies:
@ -1631,6 +1640,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"fill-range@npm:^7.1.1":
version: 7.1.1
resolution: "fill-range@npm:7.1.1"
dependencies:
to-regex-range: "npm:^5.0.1"
checksum: 10c0/b75b691bbe065472f38824f694c2f7449d7f5004aa950426a2c28f0306c60db9b880c0b0e4ed819997ffb882d1da02cfcfc819bddc94d71627f5269682edf018
languageName: node
linkType: hard
"foreground-child@npm:^3.1.0": "foreground-child@npm:^3.1.0":
version: 3.1.1 version: 3.1.1
resolution: "foreground-child@npm:3.1.1" resolution: "foreground-child@npm:3.1.1"
@ -2162,12 +2180,12 @@ __metadata:
linkType: hard linkType: hard
"micromatch@npm:^4.0.4": "micromatch@npm:^4.0.4":
version: 4.0.5 version: 4.0.8
resolution: "micromatch@npm:4.0.5" resolution: "micromatch@npm:4.0.8"
dependencies: dependencies:
braces: "npm:^3.0.2" braces: "npm:^3.0.3"
picomatch: "npm:^2.3.1" picomatch: "npm:^2.3.1"
checksum: 10c0/3d6505b20f9fa804af5d8c596cb1c5e475b9b0cd05f652c5b56141cf941bd72adaeb7a436fda344235cef93a7f29b7472efc779fcdb83b478eab0867b95cdeff checksum: 10c0/166fa6eb926b9553f32ef81f5f531d27b4ce7da60e5baf8c021d043b27a388fb95e46a8038d5045877881e673f8134122b59624d5cecbd16eb50a42e7a6b5ca8
languageName: node languageName: node
linkType: hard linkType: hard