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.
This commit is contained in:
parent
5407eeb146
commit
ef881e059b
1 changed files with 9 additions and 4 deletions
|
@ -27,6 +27,7 @@
|
||||||
(require 'maybe)
|
(require 'maybe)
|
||||||
(require 'set)
|
(require 'set)
|
||||||
(require 'cycle)
|
(require 'cycle)
|
||||||
|
(require 'struct)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Library
|
;; Library
|
||||||
|
@ -112,14 +113,18 @@ Return a reference to that buffer."
|
||||||
(if (> (ts-diff (ts-now) last-called)
|
(if (> (ts-diff (ts-now) last-called)
|
||||||
buffer/source-code-timeout)
|
buffer/source-code-timeout)
|
||||||
(progn
|
(progn
|
||||||
(setf (source-code-cycle-cycle buffer/source-code-cycle-state)
|
(struct/set! source-code-cycle
|
||||||
(cycle/from-list (buffer/source-code-buffers)))
|
cycle
|
||||||
|
(cycle/from-list (buffer/source-code-buffers))
|
||||||
|
buffer/source-code-cycle-state)
|
||||||
(let ((cycle (source-code-cycle-cycle
|
(let ((cycle (source-code-cycle-cycle
|
||||||
buffer/source-code-cycle-state)))
|
buffer/source-code-cycle-state)))
|
||||||
(funcall cycle-fn cycle)
|
(funcall cycle-fn cycle)
|
||||||
(switch-to-buffer (cycle/current cycle)))
|
(switch-to-buffer (cycle/current cycle)))
|
||||||
(setf (source-code-cycle-last-called buffer/source-code-cycle-state)
|
(struct/set! source-code-cycle
|
||||||
(ts-now)))
|
last-called
|
||||||
|
(ts-now)
|
||||||
|
buffer/source-code-cycle-state))
|
||||||
(progn
|
(progn
|
||||||
(funcall cycle-fn cycle)
|
(funcall cycle-fn cycle)
|
||||||
(switch-to-buffer (cycle/current cycle))))))
|
(switch-to-buffer (cycle/current cycle))))))
|
||||||
|
|
Loading…
Reference in a new issue