Skip to content

Commit

Permalink
✨ Have different commands for setting and adding tags
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Jun 7, 2019
1 parent 84512aa commit b9577a6
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions pinboard.el
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,13 @@ FILTER."
(interactive)
(pinboard-redraw (lambda (pin) (string= (alist-get 'shared pin) "no"))))

(defun pinboard-tagged (tag)
(defun pinboard-read-tag ()
"Read and return a Pinboard tag from the user."
(completing-read "Tag: " (pinboard-get-tags)))

(defun pinboard-extend-tagged (tag)
"Add TAG to the current tag filter and redraw."
(interactive (list (completing-read "Tag: " (pinboard-get-tags))))
(interactive (list (pinboard-read-tag)))
(cl-pushnew (downcase tag) pinboard-tag-filter :test #'equal)
(pinboard-redraw
(lambda (pin)
Expand All @@ -377,6 +381,12 @@ FILTER."
(length pinboard-tag-filter))))
(message "Showing all pins tagged: %s" (string-join pinboard-tag-filter ", ")))

(defun pinboard-tagged (tag)
"Show all pins tagged with TAG."
(interactive (list (pinboard-read-tag)))
(setq pinboard-tag-filter nil)
(pinboard-extend-tagged tag))

(defun pinboard-untagged ()
"Only show pints that have no tags."
(interactive)
Expand Down Expand Up @@ -623,8 +633,9 @@ evaluated, otherwise BODY is evaluated."
(define-key map "P" #'pinboard-private)
(define-key map "u" #'pinboard-unread)
(define-key map "r" #'pinboard-read)
(define-key map "t" #'pinboard-tagged)
(define-key map "T" #'pinboard-untagged)
(define-key map "t" #'pinboard-extend-tagged)
(define-key map "T" #'pinboard-tagged)
(define-key map "U" #'pinboard-untagged)
(define-key map "/" #'pinboard-search)
(define-key map " " #'pinboard-view)
(define-key map (kbd "RET") #'pinboard-open)
Expand Down

0 comments on commit b9577a6

Please sign in to comment.