[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emacs-wiki-discuss] Re: Some comments after using planner.el for a
From: |
Niklas Morberg |
Subject: |
Re: [emacs-wiki-discuss] Re: Some comments after using planner.el for a while |
Date: |
Tue, 01 Jun 2004 10:09:08 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
"Gary V. Vaughan" <address@hidden> writes:
> Sacha Chua wrote:
> | Niklas Morberg <address@hidden> writes:
> | >
> | >3 When publishing the wiki, it would be nice to have a
> | > "today.html" file. That way I could use that as a start
> | > page in my browser, and it would always have the current
> | > day.
> |
> | I do that dynamically, but maybe something like that is part of
> | planner-calendar...
planner-calendar wasn't included in my debian package of
planner.el. I got the version from
<http://sacha.free.net.ph/notebook/emacs/emacs-wiki/dev/planner/planner-calendar.el>.
> (defsubst planner-calendar-today (&optional max-days)
> ~ "Return today or the first day before today with a day page."
> ~ (planner-calendar-prev-date
> ~ (planner-calendar-tomorrow (calendar-current-date))))
>
> (defun planner-calendar-create-today-link (&optional name)
> ~ "Create a link to the newest published day page."
> ~ (let ((target-file (emacs-wiki-published-file (or name "today")))
> ~ (source-file (emacs-wiki-published-file
> ~ (planner-calendar-date-to-filename
> ~ (planner-calendar-today)))))
> ~ (when (file-exists-p target-file)
> ~ (funcall planner-delete-file-function target-file))
> ~ (shell-command
> ~ (format "ln -s %s %s" source-file target-file))))
>
> (add-hook 'emacs-wiki-after-file-publish-hook
> ~ 'planner-create-today-link nil t)
>
> Let me know if it works and I'll commit it.
The code works (at least on a GNU/Linux system). I had
problems getting the hook to work (even after changing it
to run planner-calendar-create-today-link :). The hook did
not seem to be active in my planner buffers. I saw Sacha
had a strange hook construct for auto-publishing:
(add-hook 'emacs-wiki-mode-hook
(lambda () (add-hook 'after-save-hook
'sacha/emacs-wiki-auto-publish nil t)))
and with the same construct, I could make the hook work:
(add-hook 'emacs-wiki-mode-hook
(lambda () (add-hook 'after-save-hook
'planner-calendar-create-today-link nil t)))
Thanks for your help, this was just what I was looking for.
Niklas
- Re: [emacs-wiki-discuss] Re: Some comments after using planner.el for a while,
Niklas Morberg <=