开发者

Org-capture: Todo goes to default capture file

开发者 https://www.devze.com 2023-03-17 03:21 出处:网络
My .emacs: ;; enable orgmode en set files (require \'org-install) (setq org-directory \"~/Dropbox/GTD/\")

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 (开发者_Python百科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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号