emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] Recent entries (was Re: question about planner-mode


From: Sacha Chua
Subject: [emacs-wiki-discuss] Recent entries (was Re: question about planner-mode)
Date: Mon, 25 Apr 2005 23:52:16 +0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

Cc'ing the mailing list at address@hidden
(http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss). =) If
you prefer to use Gmane (a mailing list->NNTP/blog gateway), check out
http://blog.gmane.org/gmane.emacs.wiki.general .

Welcome to Planner! =)

eyee <address@hidden> writes:

>    still someting confusing me: How did you put all notes entries in
>    the sidebar?(The "Recent entries" in each page.) I did not found
>    the implement in you PHP hack files. I tried to put "<contents>"
>    or "<notes>" tag into my ".header" file, but it doesn't work. :(
>    thank you. Tang.Y.L

http://sacha.free.net.ph/notebook/wiki/include/header.inc.phps
http://sacha.free.net.ph/notebook/wiki/include/footer.inc.phps
(rename to .php when you're using them).

The following code adds the most recent entry to footer.inc.phps,
in between the lines reading

<!--recent-->
<!--end of recent-->

You'll need to edit the following code to fit your configuration.

(defun sacha/planner-add-recent ()
  "Add the current note to the list of recent entries, trimmed at 10."
  (interactive)
  (let* ((info (planner-current-note-info))
         (url (concat 
               "http://sacha.free.net.ph/notebook/wiki/";
               (emacs-wiki-published-name (planner-note-page info))
               "#" (planner-note-anchor info))))
    (when info
      (with-current-buffer
          (find-file-noselect 
"/home/sacha/notebook/wiki/include/footer.inc.php")
        (goto-char (point-min))
        (when (re-search-forward "<!--recent-->" nil t)
          (save-restriction
            (narrow-to-region (1+ (line-end-position))
                              (progn
                                (re-search-forward "<!--end of recent-->" nil t)
                                (line-beginning-position)))
            (goto-char (point-min))
            (insert "<a href=\"" url "\">"
                    (planner-note-title info)
                    "</a><br/>\n")
            (forward-line 14)
            (delete-region (point) (point-max))
            (save-buffer))))))
  nil)
        
(add-hook 'remember-planner-append-hook 'sacha/planner-add-recent t)

It works when you use M-x remember and remember-planner. There are
other ways to do it, I guess, but this was the easiest for me to code.
<impish grin>

-- 
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, CS ed
sachac on irc.freenode.net#emacs . YM: sachachua83




reply via email to

[Prev in Thread] Current Thread [Next in Thread]