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:
parent
0875226500
commit
3b92ec31f8
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue