branch: elpa/org-contrib commit 3753de2172ae97e248896c12c0d92d41852e9d6a Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
* lisp/org-checklist.el (org-make-checklist-export): Fix compiler warnings Convert `if' with no "else" clause into `when'. Convert `cl-case' that does not match some conditions into `pcase'. Fix `print' called as a function while intended as variable (in the previous let-binding). --- lisp/org-checklist.el | 80 +++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/lisp/org-checklist.el b/lisp/org-checklist.el index 26b78cf825..bb68c3d475 100644 --- a/lisp/org-checklist.el +++ b/lisp/org-checklist.el @@ -88,46 +88,46 @@ "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) + (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) + (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)))))))) (defun org-checklist () (when (member org-state org-done-keywords) ;; org-state dynamically bound in org.el/org-todo