Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) vulpea-utils-note-hash #89

Merged
merged 1 commit into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Primarily a stabilization and bug-fix release.
modification time.
- [[https://github.com/d12frosted/vulpea/pull/86][vulpea#86]] Use =vulpea-db-query= in =vulpea-select= instead of heavy
=org-roam-db-query=.
- [[https://github.com/d12frosted/vulpea/pull/89][vulpea#89]] =vulpea-utils-note-hash= function to calculate =sha1= of a given
=NOTE=.

*Fixes*

Expand Down
3 changes: 2 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ of interest:
- =vulpea-utils-with-note= - function to execute =BODY= with point at =NOTE=.
Supports file-level notes as well as heading notes.
- =vulpea-utils-link-make-string= - make a bracket link to =NOTE=.
- =vulpea-utils-note-hash= function to calculate =sha1= of a given =NOTE=.

** =vulpea-db=
:PROPERTIES:
:ID: 55717e59-d850-4659-8a02-8153fda52fef
:ID: 55717e59-d850-4659-8a02-8153fda52fef
:END:

This module contains functions to query notes data base. Functions of interest:
Expand Down
7 changes: 7 additions & 0 deletions vulpea-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,12 @@ beginning of the buffer. Otherwise at the heading with note id."
(concat "id:" (vulpea-note-id note))
(vulpea-note-title note)))

(defun vulpea-utils-note-hash (note)
"Compute the hash of NOTE."
(with-temp-buffer
(set-buffer-multibyte nil)
(insert-file-contents-literally (vulpea-note-path note))
(secure-hash 'sha1 (current-buffer))))

(provide 'vulpea-utils)
;;; vulpea-utils.el ends here