1 ;;; planner-experimental.el --- Experimental functions for Emacs planner mode
3 ;; Copyright (C) 2004 Free Software Foundation, Inc.
7 ;; This file is part of Planner. It is not part of GNU Emacs.
9 ;; Planner is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; Planner is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with Planner; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
32 (defun planner-search-notes-next-match ()
33 "Jump to the next matching entry. Call after `planner-search-notes.'"
35 (if (buffer-live-p (get-buffer planner-search-notes-buffer
))
37 (set-buffer planner-search-notes-buffer
)
39 (goto-char (planner-line-beginning-position))
40 (planner-follow-name-at-point))
41 (error "No current search.")))
43 (defun planner-search-notes-previous-match ()
44 "Jump to the previous matching entry. Call after `planner-search-notes.'"
46 (if (buffer-live-p (get-buffer planner-search-notes-buffer
))
48 (set-buffer planner-search-notes-buffer
)
50 (goto-char (planner-line-beginning-position))
51 (planner-follow-name-at-point))
52 (error "No current search.")))
56 (defun planner-remove-duplicates ()
57 "Remove duplicate tasks."
59 (goto-char (point-min))
60 (let ((today (planner-today))
61 (on-date (string-match planner-date-regexp
(planner-page-name))))
62 (while (re-search-forward "^#[A-C][0-9]*\\s-+\\(.+\\)$" nil t
)
64 (let* ((task-info (planner-current-task-info))
65 (keep (planner-task-date task-info
))
68 (start (match-beginning 0)))
69 (goto-char (planner-line-beginning-position))
72 (while (planner-find-task task-info
(point))
73 ;; Determine the most recent one
74 (setq date
(planner-task-date (planner-current-task-info)))
75 (when (or (and (string< keep today
)
80 (while (planner-find-task task-info
(point))
82 (planner-task-date (planner-current-task-info)))
84 (delete-region (planner-line-beginning-position)
85 (min (1+ (planner-line-end-position))
89 (planner-delete-task))))))))
91 ;;;_* Local emacs vars.
93 ;;;allout-layout: (-1 0 : )
96 (provide 'planner-experimental
)
98 ;;; planner-experimental.el ends here