diff options
author | William Carroll <wpcarro@gmail.com> | 2020-01-09T13·38+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-01-17T10·56+0000 |
commit | ef881e059bc5573ceceb40fe757940dd1fc83733 (patch) | |
tree | 34bff0208e5134742244b20a82ce550aeac1a90b /configs/shared | |
parent | 5407eeb146778c6d473f7729f28b7377b34f02fb (diff) |
Prefer struct/set! to setf
I originally tried using `struct/set` instead of `setf`, which I had forgotten was the *immutable* version of `struct/set!`. When this didn't work, I reverted to `setf`. After a good night's sleep and with a fresh set of eyes, I dug into the issue and discovered that `struct/set!` was what I wanted the whole. I am curious now about `struct/update` versus `struct/update!`; shouldn't the former be immutable and the latter be mutable? I'll save that investigation for a later date.
Diffstat (limited to 'configs/shared')
-rw-r--r-- | configs/shared/.emacs.d/wpc/buffer.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/configs/shared/.emacs.d/wpc/buffer.el b/configs/shared/.emacs.d/wpc/buffer.el index ea2c5945a1b7..bd10192301c5 100644 --- a/configs/shared/.emacs.d/wpc/buffer.el +++ b/configs/shared/.emacs.d/wpc/buffer.el @@ -27,6 +27,7 @@ (require 'maybe) (require 'set) (require 'cycle) +(require 'struct) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Library @@ -112,14 +113,18 @@ Return a reference to that buffer." (if (> (ts-diff (ts-now) last-called) buffer/source-code-timeout) (progn - (setf (source-code-cycle-cycle buffer/source-code-cycle-state) - (cycle/from-list (buffer/source-code-buffers))) + (struct/set! source-code-cycle + cycle + (cycle/from-list (buffer/source-code-buffers)) + buffer/source-code-cycle-state) (let ((cycle (source-code-cycle-cycle buffer/source-code-cycle-state))) (funcall cycle-fn cycle) (switch-to-buffer (cycle/current cycle))) - (setf (source-code-cycle-last-called buffer/source-code-cycle-state) - (ts-now))) + (struct/set! source-code-cycle + last-called + (ts-now) + buffer/source-code-cycle-state)) (progn (funcall cycle-fn cycle) (switch-to-buffer (cycle/current cycle)))))) |