aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs/.emacs.d/init/ycp-org.el2
-rw-r--r--emacs/.emacs.d/lisp/my/my-org.el14
2 files changed, 16 insertions, 0 deletions
diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el
index 93d192f..6dbc26e 100644
--- a/emacs/.emacs.d/init/ycp-org.el
+++ b/emacs/.emacs.d/init/ycp-org.el
@@ -250,6 +250,8 @@
(setq org-use-speed-commands t)
(setq org-speed-commands
'(("User commands")
+ ("+" . my-org-vote-up)
+ ("-" . my-org-vote-down)
("m" . my-magit-clone-org-source)
("c" . my-org-copy-property-value)
("x" . my-org-osm-goto)
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