Hello,
after planner-notes-index-page that allow to have a new buffer with the
notes of an project page, i finish a function to have the index of my
notes in the project page with the possibility to toggle between 
==> index/no index:

Now my project pages are like that:

* Tasks

* Notes-index
* Notes
.#1 ....
.#2 ....

When i call in this page planner-notes-index-page-in-page
i have:

* Tasks

* Notes-index
project_page#1 ...
project_page#2 ...

* Notes
.#1 ...
.#2 ...

And if i call again planner-notes-index-page-in-page
i come back to the first state.

I think it's very useful to have an index for page with a lot of notes.
If some body is interested to test this code and may be correct it 
it should be added to planner-notes-index.el.

To use it just insert this code in planner config:
if project page already exist, you have to had just before * Notes

* Notes-index
(that can be customized in future)

Here it is:

--8<---------------cut here---------------start------------->8---
;; template for indexing notes
(setq planner-plan-page-template "* Tasks\n\n\n* Notes-index\n\n\n* 
Notes\n\n\n")

(defvar index-page-statut t)

(defun planner-notes-index-page-in-page (&optional limit)
  (interactive)
  (let* ((limit (if (equal limit "")
                   (setq limit nil)))
         (current-page (planner-current-file))
         (page (replace-regexp-in-string "\.muse" ""
                                         (nth (- (length (split-string 
current-page "/")) 1)
                                              (split-string current-page "/"))))
         (liste-notes (planner-notes-index-headlines-on-page page limit)))
    (goto-char (point-min))
    (when (re-search-forward "^\* Notes-index *$" nil t)
        (forward-line)
        (delete-region (point)
                       (if (re-search-forward "^\\*" nil t)
                           (line-beginning-position)
                         (point-max))))
    (goto-char (point-min))
    (if index-page-statut
        (when (re-search-forward "^\* Notes-index *$" nil t)
          (newline)
          (dolist (x liste-notes)
            (insert (concat "[[" page (car x) "]] " (cdr x) "\n")))
          (setq index-page-statut nil))
      (setq index-page-statut t)))
  (goto-char (point-min))
  (when (re-search-forward "^\* Notes-index *$" nil t)
    (forward-line)))

(define-key planner-mode-map (kbd "<f9> p i") 'planner-notes-index-page-in-page)
--8<---------------cut here---------------end--------------->8---

-- 
A + Thierry
Pub key: http://pgp.mit.edu

_______________________________________________
Planner-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/planner-el-discuss

Reply via email to