-
Notifications
You must be signed in to change notification settings - Fork 7
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
ADDED new api interfaces for interacting with tags. #17
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -853,6 +853,53 @@ If an argument is excluded, get it from `ebuku-cache-default-args'." | |
(setq tags (nconc (map-elt bookmark 'tags) tags))) | ||
(setq ebuku-tags (sort (seq-uniq tags) 'string-collate-lessp)))) | ||
|
||
(defun ebuku-append-tag-to-bookmark () | ||
"Append tag to bookmark at point." | ||
(interactive) | ||
(ebuku-update-tags-cache) | ||
(let ((tag (completing-read "Append tag? " ebuku-tags)) | ||
(index (ebuku--get-index-at-point)) | ||
(inhibit-read-only t)) | ||
(ebuku--tags-add index tag) | ||
(ebuku-refresh) | ||
(message "Added tag to bookmark"))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add "." to end of message. |
||
|
||
(defun ebuku--tags-join (tags) | ||
"Internal function to join a list of TAGS into a comma separated string." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Internal function to join TAGS into a comma-separated string." |
||
(cond ((stringp tags) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix indentation for this |
||
tags) | ||
((listp tags) | ||
(mapconcat 'identity tags ",")) | ||
(t | ||
(error "Tags need to be either a string or list")))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Input must be a string or list of strings" |
||
|
||
(defun ebuku--tags-add (index tags) | ||
"Internal function to append TAGS to the list of tags on the INDEX." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Internal function to append TAGS to the tags for INDEX." |
||
(with-temp-buffer | ||
(ebuku--call-buku | ||
`("--update" , index | ||
"--tag", "+" , (ebuku--tags-join tags))))) | ||
|
||
(defun ebuku--tags-remove (index tags) | ||
"Internal function to remove TAGS from the list of tags on the INDEX." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Internal function to remove TAGS from the tags for INDEX." |
||
(with-temp-buffer | ||
(ebuku--call-buku | ||
`("--update" , index | ||
"--tag", "-" , (ebuku--tags-join tags))))) | ||
|
||
(defun ebuku--tags-set (index tags) | ||
"Internal function to set TAGS on the INDEX. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Internal function to set tags for INDEX to TAGS." |
||
|
||
This function does not append to the current list of TAGS it replaces it." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "This function is destructive: it does not append to the list of tags, but replaces it." |
||
(with-temp-buffer | ||
(ebuku--call-buku | ||
`("--update" , index | ||
"--tag", (ebuku--tags-join tags))))) | ||
|
||
(defun ebuku--tags-clear (index) | ||
"Internal function to clear all tags from INDEX." | ||
(ebuku--tags-set index "")) | ||
|
||
|
||
;;;###autoload | ||
(define-derived-mode ebuku-mode special-mode "Ebuku" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation for this
let
.