1 ;;; planner-experimental.el --- Experimental functions for Emacs planner mode
2 ;;; Experimental functions for planner.el
4 ;; Copyright (C) 2004 Free Software Foundation, Inc.
8 ;; This file is not part of GNU Emacs.
10 ;; This is free software; you can redistribute it and/or modify it under
11 ;; the terms of the GNU General Public License as published by the Free
12 ;; Software Foundation; either version 2, or (at your option) any later
15 ;; This is distributed in the hope that it will be useful, but WITHOUT
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
33 (defun planner-search-notes-next-match ()
34 "Jump to the next matching entry. Call after `planner-search-notes.'"
36 (if (buffer-live-p (get-buffer planner-search-notes-buffer
))
38 (set-buffer planner-search-notes-buffer
)
40 (goto-char (planner-line-beginning-position))
41 (planner-follow-name-at-point))
42 (error "No current search.")))
44 (defun planner-search-notes-previous-match ()
45 "Jump to the previous matching entry. Call after `planner-search-notes.'"
47 (if (buffer-live-p (get-buffer planner-search-notes-buffer
))
49 (set-buffer planner-search-notes-buffer
)
51 (goto-char (planner-line-beginning-position))
52 (planner-follow-name-at-point))
53 (error "No current search.")))
57 (defun planner-remove-duplicates ()
58 "Remove duplicate tasks."
60 (goto-char (point-min))
61 (let ((today (planner-today))
62 (on-date (string-match planner-date-regexp
(planner-page-name))))
63 (while (re-search-forward "^#[A-C][0-9]*\\s-+\\(.+\\)$" nil t
)
65 (let* ((task-info (planner-current-task-info))
66 (keep (planner-task-date task-info
))
69 (start (match-beginning 0)))
70 (goto-char (planner-line-beginning-position))
73 (while (planner-find-task task-info
(point))
74 ;; Determine the most recent one
75 (setq date
(planner-task-date (planner-current-task-info)))
76 (when (or (and (string< keep today
)
81 (while (planner-find-task task-info
(point))
83 (planner-task-date (planner-current-task-info)))
85 (delete-region (planner-line-beginning-position)
86 (min (1+ (planner-line-end-position))
90 (planner-delete-task))))))))
92 ;;;_* Local emacs vars.
94 ;;;allout-layout: (-1 0 : )
97 (provide 'planner-experimental
)
99 ;;; planner-experimental.el ends here