emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-advertized-archive-subtree: Symbol's function definition is void: org-datetree-find-year-create
@ 2011-02-18 10:16 Urs Rau
  2011-03-19 11:29 ` Matt Lundin
  0 siblings, 1 reply; 2+ messages in thread
From: Urs Rau @ 2011-02-18 10:16 UTC (permalink / raw)
  To: emacs-orgmode

I am trying to archive completed tasks to a datetree. I am using "Move
Subtree to Archive file" (C-c C-x -C-s) And I get the following error:

release_7.4-419-g68114f
Org-mode version 7.4 (release_7.4.419.g68114f)
afile=/Users/ursr/org/tasksnotes.org_archive
org-advertized-archive-subtree: Symbol's function definition is void:
org-datetree-find-year-create

And I had done a C-c C-x ! to reload all org files, jsut in case. ;-)

I have added the following settings taken from the worg site page:
http://orgmode.org/worg/org-hacks.html

Topic: Archive in a date tree
Posted to Org-mode mailing list by Osamu Okano

(setq org-archive-location "%s_archive::date-tree")
(defadvice org-archive-subtree
  (around org-archive-subtree-to-data-tree activate)
  "org-archive-subtree to date-tree"
  (if
      (string= "date-tree"
               (org-extract-archive-heading
                (org-get-local-archive-location)))
      (let* ((dct (decode-time (org-current-time)))
             (y (nth 5 dct))
             (m (nth 4 dct))
             (d (nth 3 dct))
             (this-buffer (current-buffer))
             (location (org-get-local-archive-location))
             (afile (org-extract-archive-file location))
             (org-archive-location
              (format "%s::*** %04d-%02d-%02d %s" afile y m d
                      (format-time-string "%A" (encode-time 0 0 0 d m y)))))
        (message "afile=%s" afile)
        (unless afile
          (error "Invalid `org-archive-location'"))
        (save-excursion
          (switch-to-buffer (find-file-noselect afile))
          (org-datetree-find-year-create y)
          (org-datetree-find-month-create y m)
          (org-datetree-find-day-create y m d)
          (widen)
          (switch-to-buffer this-buffer))
        ad-do-it)
    ad-do-it))
;;

How do I fix this and make sure I can file into a datetree? Also is
this going to be based on USA dates or will it work right with
European dates?

Thanks.

--
Urs Rau

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-advertized-archive-subtree: Symbol's function definition is void: org-datetree-find-year-create
  2011-02-18 10:16 org-advertized-archive-subtree: Symbol's function definition is void: org-datetree-find-year-create Urs Rau
@ 2011-03-19 11:29 ` Matt Lundin
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Lundin @ 2011-03-19 11:29 UTC (permalink / raw)
  To: Urs Rau; +Cc: emacs-orgmode

Urs Rau <urs.rau@uk.om.org> writes:

> I am trying to archive completed tasks to a datetree. I am using "Move
> Subtree to Archive file" (C-c C-x -C-s) And I get the following error:
>
> release_7.4-419-g68114f
> Org-mode version 7.4 (release_7.4.419.g68114f)
> afile=/Users/ursr/org/tasksnotes.org_archive
> org-advertized-archive-subtree: Symbol's function definition is void:
> org-datetree-find-year-create

I think you'll need (require 'org-datetree) in your .emacs. The problem
is that the advice calls functions from that file that are not
autoloaded.

Best,
Matt

>
> And I had done a C-c C-x ! to reload all org files, jsut in case. ;-)
>
> I have added the following settings taken from the worg site page:
> http://orgmode.org/worg/org-hacks.html
>
> Topic: Archive in a date tree
> Posted to Org-mode mailing list by Osamu Okano
>
> (setq org-archive-location "%s_archive::date-tree")
> (defadvice org-archive-subtree
>   (around org-archive-subtree-to-data-tree activate)
>   "org-archive-subtree to date-tree"
>   (if
>       (string= "date-tree"
>                (org-extract-archive-heading
>                 (org-get-local-archive-location)))
>       (let* ((dct (decode-time (org-current-time)))
>              (y (nth 5 dct))
>              (m (nth 4 dct))
>              (d (nth 3 dct))
>              (this-buffer (current-buffer))
>              (location (org-get-local-archive-location))
>              (afile (org-extract-archive-file location))
>              (org-archive-location
>               (format "%s::*** %04d-%02d-%02d %s" afile y m d
>                       (format-time-string "%A" (encode-time 0 0 0 d m y)))))
>         (message "afile=%s" afile)
>         (unless afile
>           (error "Invalid `org-archive-location'"))
>         (save-excursion
>           (switch-to-buffer (find-file-noselect afile))
>           (org-datetree-find-year-create y)
>           (org-datetree-find-month-create y m)
>           (org-datetree-find-day-create y m d)
>           (widen)
>           (switch-to-buffer this-buffer))
>         ad-do-it)
>     ad-do-it))
> ;;
>
> How do I fix this and make sure I can file into a datetree? Also is
> this going to be based on USA dates or will it work right with
> European dates?
>
> Thanks.
>
> --
> Urs Rau
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-19 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18 10:16 org-advertized-archive-subtree: Symbol's function definition is void: org-datetree-find-year-create Urs Rau
2011-03-19 11:29 ` Matt Lundin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).