aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-06-23 09:42:22 +1000
committerYuchen Pei <id@ypei.org>2023-06-23 09:42:22 +1000
commit56bf9566d2d1ff6814ec32e38550c84962d7f15b (patch)
tree7952cb84eadc752d96d8cdd6b13557f2b84ff27f /emacs/.emacs.d/lisp/my
parentbdc3969b723efdf9baad34e22f3f90702352a0a5 (diff)
adding votes to org entries
Diffstat (limited to 'emacs/.emacs.d/lisp/my')
-rw-r--r--emacs/.emacs.d/lisp/my/my-org.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el
index cb72677..28c5354 100644
--- a/emacs/.emacs.d/lisp/my/my-org.el
+++ b/emacs/.emacs.d/lisp/my/my-org.el
@@ -999,5 +999,19 @@ When BLOCK-REGEXP is non-nil, use this regexp to find blocks."
((org-footnote-at-reference-p) nil)
(t (apply orig-fun args)))))
+(defun my-org-vote-up (&optional points)
+ (interactive "p")
+ (org-entry-put
+ (point)
+ "Vote"
+ (number-to-string
+ (+ (or points 1)
+ (string-to-number
+ (or (org-entry-get (point) "Vote") "0"))))))
+
+(defun my-org-vote-down (&optional points)
+ (interactive "p")
+ (my-org-vote-up (- points)))
+
(provide 'my-org)
;;; my-org.el ends here