如何在组织模式下将密钥绑定到特定的议程命令/列表


15

我为组织议程添加了自定义键,以显示Sacha Chua之后所有未计划的TODO项目:

(defun sacha/org-agenda-skip-scheduled ()
  (org-agenda-skip-entry-if 'scheduled 'deadline 'regexp "\n]+>"))

(setq org-agenda-custom-commands
   '(("u" "Unscheduled tasks" alltodo ""
      ((org-agenda-skip-function 'sacha/org-agenda-skip-scheduled)
       (org-agenda-overriding-header "Unscheduled TODO entries: ")))))

我可以用调出该列表C-c a u,但我只想将其绑定到一个键上。目前,我有一个简单的方法:

(global-set-key (kbd "<f8>") 'org-todo-list)

但是我想使用上面的自定义命令。我已经仔细阅读了手册,但看不到如何做。

Answers:


12

您可以通过将调用包装org-agenda到自定义命令中并将其绑定到键来实现:

(defun org-agenda-show-unscheduled (&optional arg)
  (interactive "P")
  (org-agenda arg "u"))

(define-key org-mode-map (kbd "<f8>") 'org-agenda-show-unscheduled)

1

我不喜欢创建显式函数,因此我在lambda中滚动了地图:

(define-key org-mode-map (kbd "<f8>") '(lambda (&optional arg) (interactive "P")(org-agenda arg "u")))
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.