Function: org-capture-upgrade-templates

org-capture-upgrade-templates is a byte-compiled function defined in org-capture.el.gz.

Signature

(org-capture-upgrade-templates TEMPLATES)

Documentation

Update the template list to the new format.

TEMPLATES is a template list, as in org-capture-templates. The new format unifies all the date/week tree targets into one that also allows for an optional outline path to specify a target.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-capture.el.gz
(defun org-capture-upgrade-templates (templates)
  "Update the template list to the new format.
TEMPLATES is a template list, as in `org-capture-templates'.  The
new format unifies all the date/week tree targets into one that
also allows for an optional outline path to specify a target."
  (let ((modified-templates
	 (mapcar
	  (lambda (entry)
	    (pcase entry
	      ;; Match templates with an obsolete "tree" target type. Replace
	      ;; it with common `file+olp-datetree'.  Add new properties
	      ;; (i.e., `:time-prompt' and `:tree-type') if needed.
	      (`(,key ,desc ,type (file+datetree . ,path) ,tpl . ,props)
	       `(,key ,desc ,type (file+olp+datetree ,@path) ,tpl ,@props))
	      (`(,key ,desc ,type (file+datetree+prompt . ,path) ,tpl . ,props)
	       `(,key ,desc ,type (file+olp+datetree ,@path) ,tpl
		      :time-prompt t ,@props))
	      (`(,key ,desc ,type (file+weektree . ,path) ,tpl . ,props)
	       `(,key ,desc ,type (file+olp+datetree ,@path) ,tpl
		      :tree-type week ,@props))
	      (`(,key ,desc ,type (file+weektree+prompt . ,path) ,tpl . ,props)
	       `(,key ,desc ,type (file+olp+datetree ,@path) ,tpl
		      :tree-type week :time-prompt t ,@props))
	      ;; Other templates are left unchanged.
	      (_ entry)))
	  templates)))
    (unless (equal modified-templates templates)
      (message "Deprecated date/weektree capture templates changed to `file+olp+datetree'."))
    modified-templates))