【问题标题】:How to vote for a heading in org-mode?如何在 org-mode 中为标题投票?
【发布时间】:2015-01-14 07:03:52
【问题描述】:

我在 org-mode 议程文件中有数千个标题,并且长期使用这种结构。我想设置 org-mode 以便它有一个投票系统。我按下一个热键,org-mode 为标题添加 +1,然后我可以按投票数过滤标题。


更新。我必须澄清这个问题。我可以看到如何做到这一点:

* heading
  :PROPERTIES:
  :VOTES:    5
  :END:

1) 属性抽屉是可搜索的http://orgmode.org/worg/org-tutorials/advanced-searching.html,所以我可以使用比较运算符进行过滤,例如VOTES>4.

2) 我可以使用属性 API http://orgmode.org/manual/Using-the-property-API.html 来增加和减少计数器。

【问题讨论】:

  • 您似乎忘记在问题中包含问题。
  • 呃,不,你没有。我们仍然不知道您需要什么帮助。
  • 组织模式有很多特点。如果有人已经创建了“组织模式下的投票系统”之类的东西,他可能会帮助我。
  • 我建议你把你的投票系统设置为tag -- 类似:1: 已经有使用热键插入标签的功能,当然org-mode 有各种搜索选项--org-tags-view; org-search-view; org-agenda-list.
  • 谢谢,但我需要计算选票的能力。我想我必须使用 :PROPERTIES: 整数值 :VOTES: 例如。

标签: emacs org-mode voting


【解决方案1】:

这里是解决方案。我在 org 模式下将 + 添加到速度命令。您也可以将其绑定到某个键。

(defun plusone ()
  "Increase the VOTES property in an org-heading by one. Create
the property if needed."
  (interactive)
  (org-entry-put
   (point)
   "VOTES"
   (format "%s" (+ 1 (string-to-number
              (or
               (org-entry-get (point) "VOTES")
               "0"))))))

(add-to-list 'org-speed-commands-user '("+" . (plusone)))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多