From aebaf8d94796ffabc00c4ab92b1e19e04f04a038 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Mon, 16 Oct 2006 22:14:40 +0000 Subject: [PATCH] Add nested tag support in way that doesn't break with Muse 3.02 2006-10-16 Michael Olson * planner-authz.el (planner-authz-markup-tags): Adapt for nested tag support. * planner-notes-index.el: Use add-hook instead of add-to-list, in case muse-publish has not been loaded yet. Use muse-publish-markup-tags instead of planner-markup-tags. * planner-publish.el (planner-publish-markup-tags): Adapt for nested tag support. Make the tag nestable. * planner-timeclock.el: Use add-hook instead of add-to-list, in case muse-publish has not been loaded yet. Use muse-publish-markup-tags and muse-colors-markup-tags instead of planner-markup-tags. (planner-colors-timeclock-report-tag) (planner-publish-timeclock-report-tag): New functions created from planner-timeclock-report-tag. git-archimport-id: mwolson@gnu.org--2006-planner-el/planner-el--devel--0--patch-88 --- ChangeLog | 20 ++++++++++++++++++++ planner-authz.el | 14 ++++++++++---- planner-notes-index.el | 19 +++++++++++-------- planner-publish.el | 32 ++++++++++++++++++++++---------- planner-timeclock.el | 47 ++++++++++++++++++++++++++++++----------------- 5 files changed, 93 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 667e3dc..ab7f008 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2006-10-16 Michael Olson + + * planner-authz.el (planner-authz-markup-tags): Adapt for nested + tag support. + + * planner-notes-index.el: Use add-hook instead of add-to-list, in + case muse-publish has not been loaded yet. Use + muse-publish-markup-tags instead of planner-markup-tags. + + * planner-publish.el (planner-publish-markup-tags): Adapt for + nested tag support. Make the tag nestable. + + * planner-timeclock.el: Use add-hook instead of add-to-list, in + case muse-publish has not been loaded yet. Use + muse-publish-markup-tags and muse-colors-markup-tags instead of + planner-markup-tags. + (planner-colors-timeclock-report-tag) + (planner-publish-timeclock-report-tag): New functions created from + planner-timeclock-report-tag. + 2006-09-26 Michael Olson * planner.el (planner-setup-highlighting): Don't quote diff --git a/planner-authz.el b/planner-authz.el index 160dbe0..a29ddce 100644 --- a/planner-authz.el +++ b/planner-authz.el @@ -302,15 +302,21 @@ For more on the structure of this list, see `muse-publish-markup-regexps'." :type '(alist :key-type symbol :value-type function)) (defcustom planner-authz-markup-tags - '(("authz" t t planner-authz-tag) - ("diary-section" t t planner-authz-diary-section-tag) - ("note" t t planner-authz-note-tag) - ("task" t t planner-authz-task-tag)) + (if (featurep 'muse-nested-tags) + '(("authz" t t nil planner-authz-tag) + ("diary-section" t t nil planner-authz-diary-section-tag) + ("note" t t nil planner-authz-note-tag) + ("task" t t nil planner-authz-task-tag)) + '(("authz" t t planner-authz-tag) + ("diary-section" t t planner-authz-diary-section-tag) + ("note" t t planner-authz-note-tag) + ("task" t t planner-authz-task-tag))) "A list of tag specifications for authorization markup." :group 'planner-authz :type '(repeat (list (string :tag "Markup tag") (boolean :tag "Expect closing tag" :value t) (boolean :tag "Parse attributes" :value nil) + (boolean :tag "Nestable" :value nil) function))) (defcustom planner-authz-mason-markup-strings diff --git a/planner-notes-index.el b/planner-notes-index.el index 27188e9..7b92483 100644 --- a/planner-notes-index.el +++ b/planner-notes-index.el @@ -1,6 +1,6 @@ ;;; planner-notes-index.el --- Note indexing support for the Emacs planner -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. +;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. ;;; Commentary: @@ -332,13 +332,16 @@ The current year is included." ;;;_* Initialization -(add-to-list 'planner-markup-tags - '("planner-notes-index" nil t nil - planner-notes-index-tag)) -(add-to-list 'planner-markup-tags - '("planner-notes-index-month-table" nil t nil - planner-notes-index-month-table-tag)) -(planner-update-wiki-project) +(add-hook 'muse-publish-markup-tags + (if (featurep 'muse-nestable-tags) + '("planner-notes-index" nil t nil planner-notes-index-tag) + '("planner-notes-index" nil t planner-notes-index-tag))) +(add-hook 'muse-publish-markup-tags + (if (featurep 'muse-nestable-tags) + '("planner-notes-index-month-table" nil t nil + planner-notes-index-month-table-tag) + '("planner-notes-index-month-table" nil t + planner-notes-index-month-table-tag))) (provide 'planner-notes-index) diff --git a/planner-publish.el b/planner-publish.el index 58f2cae..26dac4d 100644 --- a/planner-publish.el +++ b/planner-publish.el @@ -101,21 +101,33 @@ For more on the structure of this list, see :group 'planner-publish) (defcustom planner-publish-markup-tags - '(("nested-section" t nil planner-publish-nested-section-tag) - ("title" t t planner-publish-title-tag) - ("content" t nil planner-publish-content-tag) - ("diary-section" t nil planner-publish-diary-section-tag) - ("tasks-section" t nil planner-publish-tasks-section-tag) - ("notes-section" t nil planner-publish-notes-section-tag) - ("notes" nil nil planner-publish-notes-tag) - ("past-notes" nil t planner-publish-past-notes-tag) - ("task" t t planner-publish-task-tag) - ("note" t t planner-publish-note-tag)) + (if (featurep 'muse-nested-tags) + '(("nested-section" t nil t planner-publish-nested-section-tag) + ("title" t t nil planner-publish-title-tag) + ("content" t nil nil planner-publish-content-tag) + ("diary-section" t nil nil planner-publish-diary-section-tag) + ("tasks-section" t nil nil planner-publish-tasks-section-tag) + ("notes-section" t nil nil planner-publish-notes-section-tag) + ("notes" nil nil nil planner-publish-notes-tag) + ("past-notes" nil t nil planner-publish-past-notes-tag) + ("task" t t nil planner-publish-task-tag) + ("note" t t nil planner-publish-note-tag)) + '(("nested-section" t nil planner-publish-nested-section-tag) + ("title" t t planner-publish-title-tag) + ("content" t nil planner-publish-content-tag) + ("diary-section" t nil planner-publish-diary-section-tag) + ("tasks-section" t nil planner-publish-tasks-section-tag) + ("notes-section" t nil planner-publish-notes-section-tag) + ("notes" nil nil planner-publish-notes-tag) + ("past-notes" nil t planner-publish-past-notes-tag) + ("task" t t planner-publish-task-tag) + ("note" t t planner-publish-note-tag))) "A list of tag specifications, for specially marking up PLANNER. See `muse-publish-markup-tags' for more information." :type '(repeat (list (string :tag "Markup tag") (boolean :tag "Expect closing tag" :value t) (boolean :tag "Parse attributes" :value nil) + (boolean :tag "Nestable" :value nil) function)) :group 'planner-publish) diff --git a/planner-timeclock.el b/planner-timeclock.el index 8d4157c..cff8603 100644 --- a/planner-timeclock.el +++ b/planner-timeclock.el @@ -1,6 +1,6 @@ ;;; planner-timeclock.el --- Timeclock integration for the Emacs Planner -;; Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. ;; Parts copyright (C) 2005 Peter K. Lee ;; Author: John Wiegley @@ -140,23 +140,36 @@ (kill-buffer (current-buffer))))) ;;;###autoload -(defun planner-timeclock-report-tag (beg end highlight-p) - "Replace the region BEG to END with a timeclock report. -If HIGHLIGHT-P is non-nil, the output is also displayed." +(defun planner-colors-timeclock-report-tag (beg end) + "Replace the region BEG to END with a timeclock report, colorizing +the result." (require 'timeclock) - (if highlight-p - (add-text-properties - beg end (list 'display - (with-temp-buffer - (timeclock-generate-report muse-publishing-p) - (buffer-string)))) - (delete-region beg end) - (timeclock-generate-report muse-publishing-p) - (add-text-properties beg (point) '(read-only t)))) - -(add-to-list 'planner-markup-tags - '("timeclock-report" nil nil t planner-timeclock-report-tag)) -(planner-option-customized 'planner-markup-tags planner-markup-tags) + (add-text-properties + beg end (list 'display + (with-temp-buffer + (timeclock-generate-report muse-publishing-p) + (buffer-string))))) + +(defun planner-publish-timeclock-report-tag (beg end) + "Replace the region BEG to END with a timeclock report." + (require 'timeclock) + (delete-region beg end) + (timeclock-generate-report muse-publishing-p) + (add-text-properties beg (point) '(read-only t))) + +(add-hook 'muse-colors-markup-tags + (if (featurep 'muse-nested-tags) + '("timeclock-report" nil nil nil + planner-colors-timeclock-report-tag) + '("timeclock-report" nil nil + planner-colors-timeclock-report-tag))) + +(add-hook 'muse-publish-markup-tags + (if (featurep 'muse-nested-tags) + '("timeclock-report" nil nil nil + planner-publish-timeclock-report-tag) + '("timeclock-report" nil nil + planner-publish-timeclock-report-tag))) (defun planner-timeclock-task-plan (info) "Return the first plan page associated with INFO." -- 2.11.4.GIT