简体   繁体   English

当前缓冲区的日程视图

[英]Agenda view of the current buffer

EDIT: The solution was simple but "bonus points" for anyone that can explain why my method didn't work. 编辑:解决方案很简单,但任何人的“奖励积分”可以解释为什么我的方法不起作用。

ORIG: I would like an org-mode-custom-command to display an agenda which is only made from the current buffer. ORIG:我想要一个org-mode-custom-command来显示一个只能从当前缓冲区创建的议程。

The following snippet shows the kind of view that I want. 以下代码段显示了我想要的视图类型。

(setq org-agenda-custom-commands
      '(("b" "Buffer summary"
     ((todo "TODO" ((org-agenda-files '("~/.agenda/notes.org"))))))))

But, I don't want to specify a filename, rather I want to use the current buffer. 但是,我不想指定文件名,而是想使用当前缓冲区。 Here is my stab at it. 这是我的抨击。

(setq org-agenda-custom-commands
      '(("b" "Buffer summary"
     ((todo "TODO" ((org-agenda-files (buffer-file-name))))))))

When I open an org-buffer and run this agenda command the result is just a pretty much blank agenda view. 当我打开一个组织缓冲区并运行这个议程命令时,结果只是一个非常空白的议程视图。 I presume it's because buffer-file-name is being evaluated at point later than when I press the agenda view...? 我认为这是因为缓冲区文件名的评估时间晚于我按下议程视图时......?

I'm still beginning to learn elisp, so don't hesitate to point out the obvious. 我还在开始学习elisp,所以不要犹豫,指出明显的。 Thank-you. 谢谢。

EDIT: 编辑:

Following a suggestion in the comments. 根据评论中的建议。

(setq org-agenda-custom-commands
      '(("b" "Buffer summary"
     ((todo "TODO" ((org-agenda-files (list (buffer-file-name)))))))))

I receive a backtrace. 我收到了回溯。

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-directory-p(nil)
...etc...

For me, the most obvious is NOT to create an extra agenda view, and simply call any existing view on that buffer only (limit the view to the current buffer with a call such as Cc a < a , where < limits on the current buffer). 对我来说,最明显的不是创建一个额外的议程视图,而只是简单地调用该缓冲区上的任何现有视图(使用诸如Cc a < a的调用将视图限制为当前缓冲区,其中<当前缓冲区的限制)。

If you still want to make an extra agenda view for the current buffer, I'm not sure whether that's possible with all commands. 如果您仍想为当前缓冲区创建额外的议程视图,我不确定是否可以使用所有命令。 For sure, calling occur-tree will work on the current buffer. 当然,调用occur-tree将在当前缓冲区上工作。 Not sure about todo and the like. 不确定todo等。

...The agenda view usually shows the information collected from all the agenda files For more info , first make sure that file you are trying to make agenda-viwable or trackable, by activating it via an org command Cc [ (org-agenda-file-to-front) ......议程视图通常显示从所有议程文件中收集的信息。 有关详细信息 ,请首先确保您尝试通过组织命令Cc [ (org-agenda-file-to-front)激活该文件,使其成为议程可追踪或可追踪Cc [ (org-agenda-file-to-front)

you can test the current buffe name by (message (buffer-file-name)) 您可以通过(message (buffer-file-name))测试当前的buffe名称

Normally, I use my agenda view from various files, but I can track different agendas eg done, on-progress, fixed, bug, just by using hot-keys Here is mine: 通常情况下,我使用各种文件中的议程视图,但我可以通过使用热键跟踪不同的议程,例如已完成,正在进行,已修复,错误,这是我的:

(setq org-agenda-custom-commands '( ("x" agenda) ("y" agenda*) ("o" todo "ONPROGRESS") ("n" tags-todo "+TIPS") ("d" todo "DONE") ("p" todo "PENDING") ("b" todo "BUG") ("f" todo "FIXED") ;("F" todo-tree "FIXED") )) So if I want to view eg done stuffs Cc ad this will show me all done lists regardless of which file they came. (setq org-agenda-custom-commands '( ("x" agenda) ("y" agenda*) ("o" todo "ONPROGRESS") ("n" tags-todo "+TIPS") ("d" todo "DONE") ("p" todo "PENDING") ("b" todo "BUG") ("f" todo "FIXED") ;("F" todo-tree "FIXED") ))所以如果我想查看例如已完成的东西Cc ad这将显示所有已完成的列表,无论它们来自哪个文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM