0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-22 12:18:40 +00:00

Bugfixes, documentation and custom options for org-checklist.

* contrib/lisp/org-checklist.el
  - Fix some problems with the print/export feature in org-checklist.
  - Add custom options for this module
  - Fix some interaction with a2ps
  - Only reset checkboxes if TODO state is done.

* lisp/org.el
  - Add org-checklist to org-modules
This commit is contained in:
James TD Smith 2009-02-05 00:08:25 +00:00 committed by Carsten Dominik
parent 5dbc23baed
commit c65fb88796
3 changed files with 69 additions and 15 deletions

View file

@ -7,6 +7,22 @@
* lisp/org-export-generic.el (org-export-generic-format): Fix * lisp/org-export-generic.el (org-export-generic-format): Fix
compatibility issue with Emacs 23. compatibility issue with Emacs 23.
2009-07-12 James TD Smith <ahktenzero@mohorovi.cc>
* lisp/org-checklist.el (org-checklist): Add a custom group for
org-checklist. The options are all for the unchecked items export
function.
(org-checklist-export-time-format): Allow customising the
timestamp appended to the saved unchecked items list
(org-checklist-export-function): Allow customising the output
format for the unchecked items list.
(org-checklist-export-params): Options for the exporter.
(org-checklist-a2ps-params): Printing options.
(org-make-checklist-export): Use values from custom vars. Printing
is now controlled by the PRINT_EXPORT property in the entry, and
the user is only asked if it is missing. Pass the switches to
a2ps-buffer properly.
2009-06-20 Carsten Dominik <carsten.dominik@gmail.com> 2009-06-20 Carsten Dominik <carsten.dominik@gmail.com>
* README: List new file org-export-generic.el * README: List new file org-export-generic.el

View file

@ -42,11 +42,37 @@
;; ;;
;;; Code: ;;; Code:
(require 'org) (require 'org)
(load "a2ps-print" 'no-error)
(defvar export-time-format "%Y%m%d%H%M" (defgroup org-checklist nil
"format of timestamp appended to export file") "Extended checklist handling for org"
(defvar export-function 'org-export-as-ascii :tag "Org-checklist"
"function used to prepare the export file for printing") :group 'org)
(defcustom org-checklist-export-time-format "%Y%m%d%H%M"
"The format of timestamp appended to LIST_EXPORT_BASENAME to
make the name of the export file."
:link '(function-link format-time-string)
:group 'org-checklist
:type 'string)
(defcustom org-checklist-export-function 'org-export-as-ascii
"function used to prepare the export file for printing"
:group 'org-checklist
:type '(radio (function-item :tag "ascii text" org-export-as-ascii)
(function-item :tag "HTML" org-export-as-html)
(function-item :tag "LaTeX" :value org-export-as-latex)
(function-item :tag "XOXO" :value org-export-as-xoxo)))
(defcustom org-checklist-export-params nil
"options for the export function file for printing"
:group 'org-checklist
:type '(repeat string))
(defcustom org-checklist-a2ps-params nil
"options for a2ps for printing"
:group 'org-checklist
:type '(repeat string))
(defun org-reset-checkbox-state-maybe () (defun org-reset-checkbox-state-maybe ()
"Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set" "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set"
@ -54,22 +80,29 @@
(if (org-entry-get (point) "RESET_CHECK_BOXES") (if (org-entry-get (point) "RESET_CHECK_BOXES")
(org-reset-checkbox-state-subtree))) (org-reset-checkbox-state-subtree)))
(defun org-make-checklist-export () (defun org-make-checklist-export ()
"Produce a checklist containing all unchecked items from a list "Produce a checklist containing all unchecked items from a list
of checkbox items" of checkbox items"
(interactive "*") (interactive "*")
(if (org-entry-get (point) "LIST_EXPORT_BASENAME") (if (org-entry-get (point) "LIST_EXPORT_BASENAME")
(let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME") (let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME" nil)
"-" (format-time-string export-time-format) "-" (format-time-string
org-checklist-export-time-format)
".org")) ".org"))
(print (case (org-entry-get (point) "PRINT_EXPORT" nil)
(("" "nil" nil) nil)
(t t)
(nil (y-or-n-p "Print list? "))))
exported-lines exported-lines
title) title "Checklist export")
(save-restriction (save-restriction
(save-excursion (save-excursion
(org-narrow-to-subtree) (org-narrow-to-subtree)
(org-update-checkbox-count-maybe)
(org-show-subtree) (org-show-subtree)
(goto-char (point-min)) (goto-char (point-min))
(if (looking-at org-complex-heading-regexp) (when (looking-at org-complex-heading-regexp)
(setq title (match-string 4))) (setq title (match-string 4)))
(goto-char (point-min)) (goto-char (point-min))
(let ((end (point-max))) (let ((end (point-max)))
@ -85,14 +118,18 @@ of checkbox items"
(dolist (entry exported-lines) (insert entry)) (dolist (entry exported-lines) (insert entry))
(org-update-checkbox-count-maybe) (org-update-checkbox-count-maybe)
(write-file export-file) (write-file export-file)
(if (y-or-n-p "Print list? ") (if (print)
((funcall export-function) (progn (funcall org-checklist-export-function
(a2ps-buffer)))))))) org-checklist-export-params)
(let* ((current-a2ps-switches a2ps-switches)
(a2ps-switches (append current-a2ps-switches
org-checklist-a2ps-params)))
(a2ps-buffer)))))))))
(defun org-checklist () (defun org-checklist ()
(if (member state org-done-keywords) (when (member state org-done-keywords)
(org-make-checklist-export)) (org-make-checklist-export)
(org-reset-checkbox-state-maybe)) (org-reset-checkbox-state-maybe)))
(add-hook 'org-after-todo-state-change-hook 'org-checklist) (add-hook 'org-after-todo-state-change-hook 'org-checklist)

View file

@ -184,6 +184,7 @@ to add the symbol `xyz', and the package must have a call to
(const :tag "C annotation-helper: Call Remember directly from Browser (OBSOLETE, use org-protocol)" org-annotation-helper) (const :tag "C annotation-helper: Call Remember directly from Browser (OBSOLETE, use org-protocol)" org-annotation-helper)
(const :tag "C bookmark: Org links to bookmarks" org-bookmark) (const :tag "C bookmark: Org links to bookmarks" org-bookmark)
(const :tag "C browser-url: Store link, directly from Browser (OBSOLETE, use org-protocol)" org-browser-url) (const :tag "C browser-url: Store link, directly from Browser (OBSOLETE, use org-protocol)" org-browser-url)
(const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist)
(const :tag "C choose: Use TODO keywords to mark decisions states" org-choose) (const :tag "C choose: Use TODO keywords to mark decisions states" org-choose)
(const :tag "C collector: Collect properties into tables" org-collector) (const :tag "C collector: Collect properties into tables" org-collector)
(const :tag "C depend: TODO dependencies for Org-mode (PARTIALLY OBSOLETE, see built-in dependency support))" org-depend) (const :tag "C depend: TODO dependencies for Org-mode (PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)