Org-capture: Todo goes to default capture file

試著忘記壹切 提交于 2020-01-06 05:16:07

问题


My .emacs:

;; enable orgmode en set files
(require 'org-install)
(setq org-directory "~/Dropbox/GTD/")
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(setq org-agenda-files (list (concat org-directory "nextactions.org")
                             (concat org-directory "projects.org") 
                 (concat org-directory "birthday.org")))
;; Daily action list
(setq org-agenda-custom-commands
'(
("D" "Daily Action List"
      (
           (agenda "" ((org-agenda-ndays 1)
                       (org-agenda-sorting-strategy
                       (quote ((agenda time-up priority-down tag-up) )))
                       (org-deadline-warning-days 0)
                       ))))
;; Office list
("H" "Office and Home Lists"
     ((agenda)
      (tags-todo "OFFICE")
      (tags-todo "HOME")))
)
)
;; Turn on diary within org-mode
(setq org-agenda-include-diary t)
;; Turn on Capture
(setq org-default-notes-file (concat org-directory "notes.org"))
(define-key global-map "\C-cc" 'org-capture)
;; Capture templates
(setq org-capture-templates
  '(
   ("t" "Todo" entry (file+headline (concat org-directory "nextactions.org") "Inbox") "* TODO %?\n  %i\n  %a")
   ("j" "Journal" entry (file+datetree (concat org-directory "journal.org")) "* %?\nEntered on %U\n  %i\n  %a")
   )
)

C-c c presents the capture menu buffer. I press then t and capture the buffer that appears (CAPTURE-notes.org). After C-c C-c the entry is added to notes.org instead of nextactions.org section "Inbox".

I have no .emacs parsing errors, how can I fix this so the todo capture-template puts its entry in nextactions.org?

Edit: Setting org-default-notes-file to nextactions.org lets me operate at least the first org-capture template (because its file is the same anyway). The second one stays writing to the default-notes-file.


回答1:


What org-mode version are you using? I don't remember the exact version, but quoted capture templates were not eval'ed before that.

So you should try either

  • Update org-mode
  • use backquotes

    (setq org-capture-templates
       `(("t" "Todo" entry (file+headline ,(concat org-directory "nextactions.org")
                                         "Inbox")
          "* TODO %?\n  %i\n  %a")
         ("j" "Journal" entry (file+datetree ,(concat org-directory "journal.org"))
          "* %?\nEntered on %U\n  %i\n  %a")
        ))
    
  • use the literal filepath

    (setq org-capture-templates
       '(("t" "Todo" entry (file+headline "~/Dropbox/GTD/nextactions.org"
                                         "Inbox")
          "* TODO %?\n  %i\n  %a")
         ("j" "Journal" entry (file+datetree "~/Dropbox/GTD/journal.org")
          "* %?\nEntered on %U\n  %i\n  %a")
        ))
    

Apart from that I see no problem with your config, I use a similar one.




回答2:


infact you can even refile from the capture buffer to which ever agenda file you want to with C-c C-w.



来源:https://stackoverflow.com/questions/6580620/org-capture-todo-goes-to-default-capture-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!