update packages
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
;;; org-checklist.el --- org functions for checklist handling
|
||||
;;; org-checklist.el --- org functions for checklist handling -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2008-2014, 2021 James TD Smith
|
||||
|
||||
@@ -43,7 +43,13 @@
|
||||
;;
|
||||
;;; Code:
|
||||
(require 'org)
|
||||
(defvar org-state)
|
||||
;; FIXME: This library requires
|
||||
;; https://git.savannah.gnu.org/cgit/a2ps.git/tree/contrib/emacs/a2ps-print.el file
|
||||
;; It is a part of a2ps distribution.
|
||||
(load "a2ps-print" 'no-error)
|
||||
(defvar a2ps-switches)
|
||||
(declare-function a2ps-buffer "a2ps-print" (argp))
|
||||
|
||||
(setq org-default-properties (cons "RESET_CHECK_BOXES" (cons "LIST_EXPORT_BASENAME" org-default-properties)))
|
||||
|
||||
@@ -88,46 +94,49 @@
|
||||
"Produce a checklist containing all unchecked items from a list
|
||||
of checkbox items"
|
||||
(interactive "*")
|
||||
(if (org-entry-get (point) "LIST_EXPORT_BASENAME")
|
||||
(let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME" nil)
|
||||
"-" (format-time-string
|
||||
org-checklist-export-time-format)
|
||||
".org"))
|
||||
(print (cl-case (org-entry-get (point) "PRINT_EXPORT" nil)
|
||||
(("" "nil" nil) nil)
|
||||
(nil (y-or-n-p "Print list? "))
|
||||
(t t)))
|
||||
exported-lines
|
||||
(title "Checklist export"))
|
||||
(save-restriction
|
||||
(save-excursion
|
||||
(org-narrow-to-subtree)
|
||||
(org-update-checkbox-count-maybe)
|
||||
(org-show-subtree)
|
||||
(goto-char (point-min))
|
||||
(when (looking-at org-complex-heading-regexp)
|
||||
(setq title (match-string 4)))
|
||||
(goto-char (point-min))
|
||||
(let ((end (point-max)))
|
||||
(while (< (point) end)
|
||||
(when (and (org-at-item-checkbox-p)
|
||||
(or (string= (match-string 0) "[ ]")
|
||||
(string= (match-string 0) "[-]")))
|
||||
(add-to-list 'exported-lines (thing-at-point 'line) t))
|
||||
(beginning-of-line 2)))
|
||||
(set-buffer (get-buffer-create export-file))
|
||||
(org-insert-heading)
|
||||
(insert (or title export-file) "\n")
|
||||
(dolist (entry exported-lines) (insert entry))
|
||||
(org-update-checkbox-count-maybe)
|
||||
(write-file export-file)
|
||||
(if (print)
|
||||
(progn (funcall org-checklist-export-function
|
||||
org-checklist-export-params)
|
||||
(let* ((current-a2ps-switches a2ps-switches)
|
||||
(a2ps-switches (append current-a2ps-switches
|
||||
org-checklist-a2ps-params)))
|
||||
(a2ps-buffer)))))))))
|
||||
(when (org-entry-get (point) "LIST_EXPORT_BASENAME")
|
||||
(let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME" nil)
|
||||
"-" (format-time-string
|
||||
org-checklist-export-time-format)
|
||||
".org"))
|
||||
(print (pcase (org-entry-get (point) "PRINT_EXPORT" nil)
|
||||
(`(or "" "nil" nil) nil)
|
||||
(`nil (y-or-n-p "Print list? "))
|
||||
(_ t)))
|
||||
exported-lines
|
||||
(title "Checklist export"))
|
||||
(save-restriction
|
||||
(save-excursion
|
||||
(org-narrow-to-subtree)
|
||||
(org-update-checkbox-count-maybe)
|
||||
(if (fboundp 'org-fold-show-subtree)
|
||||
(org-fold-show-subtree)
|
||||
(with-no-warnings (org-show-subtree)))
|
||||
(goto-char (point-min))
|
||||
(when (looking-at org-complex-heading-regexp)
|
||||
(setq title (match-string 4)))
|
||||
(goto-char (point-min))
|
||||
(let ((end (point-max)))
|
||||
(while (< (point) end)
|
||||
(when (and (org-at-item-checkbox-p)
|
||||
(or (string= (match-string 0) "[ ]")
|
||||
(string= (match-string 0) "[-]")))
|
||||
(setq exported-lines
|
||||
(nconc exported-lines (list (thing-at-point 'line)))))
|
||||
(beginning-of-line 2)))
|
||||
(set-buffer (get-buffer-create export-file))
|
||||
(org-insert-heading)
|
||||
(insert (or title export-file) "\n")
|
||||
(dolist (entry exported-lines) (insert entry))
|
||||
(org-update-checkbox-count-maybe)
|
||||
(write-file export-file)
|
||||
(when print
|
||||
(funcall org-checklist-export-function
|
||||
org-checklist-export-params)
|
||||
(let* ((current-a2ps-switches a2ps-switches)
|
||||
(a2ps-switches (append current-a2ps-switches
|
||||
org-checklist-a2ps-params)))
|
||||
(a2ps-buffer nil))))))))
|
||||
|
||||
(defun org-checklist ()
|
||||
(when (member org-state org-done-keywords) ;; org-state dynamically bound in org.el/org-todo
|
||||
|
||||
Reference in New Issue
Block a user