Add dependency on ‘dash’

Emacs 28.2 doesn't yet have the ‘take’ function. That's a 29.1 thing. The ‘dash’
library has the same function though.
This commit is contained in:
Tom Willemse 2023-07-27 01:10:10 -07:00
parent 0875226500
commit 3b92ec31f8

View file

@ -358,6 +358,8 @@ PROPS is used as an aid in getting the right information from the file."
Finally the last function mushes it all together and actually generates an =index.org= file. I just looks through the =posts/= directory and finds any files that start with a date. It compares the last modification time of the =index.org= and that of the latest modified post, and skips generating if the =index.org= is newer. Then it takes the 30 latest posts and extracts the necessary information from them and writes it all into =index.org=.
#+begin_src emacs-lisp
(require 'dash)
(defun publish-generate-index (props)
"Generate an index from my posts.
Argument PROPS
@ -380,7 +382,7 @@ Argument PROPS
(insert "\n")
(apply 'insert
(mapcar (lambda (file) (publish-extract-summary-from-file file props))
(take 30 (reverse files))))
(-take 30 (reverse files))))
(write-file "posts/index.org"))))))
#+end_src