Skip to content

Commit e7bdd28

Browse files
committed
(feat) vulpea-utils-note-hash
1 parent 2a516b3 commit e7bdd28

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Diff for: CHANGELOG.org

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Primarily a stabilization and bug-fix release.
2929
modification time.
3030
- [[https://github.com/d12frosted/vulpea/pull/86][vulpea#86]] Use =vulpea-db-query= in =vulpea-select= instead of heavy
3131
=org-roam-db-query=.
32+
- =vulpea-utils-note-hash= function to calculate =sha1= of a given =NOTE=.
3233

3334
*Fixes*
3435

Diff for: README.org

+2-1
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,11 @@ of interest:
154154
- =vulpea-utils-with-note= - function to execute =BODY= with point at =NOTE=.
155155
Supports file-level notes as well as heading notes.
156156
- =vulpea-utils-link-make-string= - make a bracket link to =NOTE=.
157+
- =vulpea-utils-note-hash= function to calculate =sha1= of a given =NOTE=.
157158

158159
** =vulpea-db=
159160
:PROPERTIES:
160-
:ID: 55717e59-d850-4659-8a02-8153fda52fef
161+
:ID: 55717e59-d850-4659-8a02-8153fda52fef
161162
:END:
162163

163164
This module contains functions to query notes data base. Functions of interest:

Diff for: vulpea-utils.el

+7
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,12 @@ beginning of the buffer. Otherwise at the heading with note id."
6464
(concat "id:" (vulpea-note-id note))
6565
(vulpea-note-title note)))
6666

67+
(defun vulpea-utils-note-hash (note)
68+
"Compute the hash of NOTE."
69+
(with-temp-buffer
70+
(set-buffer-multibyte nil)
71+
(insert-file-contents-literally (vulpea-note-path note))
72+
(secure-hash 'sha1 (current-buffer))))
73+
6774
(provide 'vulpea-utils)
6875
;;; vulpea-utils.el ends here

0 commit comments

Comments
 (0)