Skip to content

Commit

Permalink
Automatically turn SHA sums into S-expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
lassik committed Jan 9, 2021
1 parent 5ee4bc9 commit 293e9a6
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions tools/scheme-bibliography.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,23 @@
(push basename non-compressed-basenames)))))))
(when non-compressed-basenames
(let ((default-directory scheme-bibliography-pdf-directory))
(message "%s"
(shell-command
(string-join (cons "shasum"
(mapcar
#'shell-quote-argument
non-compressed-basenames))
" "))))))))
(let ((output
(shell-command-to-string
(string-join (cons "shasum"
(mapcar
#'shell-quote-argument
non-compressed-basenames))
" "))))
(with-temp-buffer
(insert output)
(goto-char (point-min))
(while (not (eobp))
(when (looking-at
"^\\([0-9a-f]\\{40\\}\\) .*\\.\\(.*?\\)$")
(let ((sum (match-string 1))
(ext (match-string 2)))
(message (format "(%s-sha1 %S)" ext sum))
(goto-char (1+ (point-at-eol)))))))))))))
;; Highlight the title of the paper for copy-pasting into a search engine.
(goto-char (point-at-bol))
(re-search-forward "\. \"\\(.*?\\)\".")
Expand Down

0 comments on commit 293e9a6

Please sign in to comment.