summaryrefslogtreecommitdiff
path: root/common.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-11-17 12:50:07 +0800
committerJSDurand <mmemmew@gmail.com>2022-11-17 12:50:07 +0800
commit983bf3a1725ed7eb8df6973ca1393e75d3eb68e4 (patch)
tree5612e9374568f84ba1bf39c55a548a3c638f4442 /common.el
parent7edf313d2c8892818fc64dc125b30f967bb565ce (diff)
bongo: Add cache
* common.el (durand-take): Declare as pure and side-effect free. * durand-bongo.el (bongo-sub-redisplay): Do nothing when not playing, to avoid clearing the subtitles buffer when stopped. (durand-bongo-time-process): A helper to replace nil values by 0 in the return value of `parse-time-string'. (bongo-sub-status-string): Use a cache to avoid searching for the subtitle every second.
Diffstat (limited to 'common.el')
-rw-r--r--common.el1
1 files changed, 1 insertions, 0 deletions
diff --git a/common.el b/common.el
index 871f069..94cbe3c 100644
--- a/common.el
+++ b/common.el
@@ -461,6 +461,7 @@ current line; negative ARG means to put the line upwards."
(defun durand-take (n ls)
"Return the first N items of LS.
If the length of LS is less than N, then return the whole LS."
+ (declare (pure t) (side-effect-free t))
(cond
((< (length ls) n) ls)
((let ((i 0) result)