diff --git a/lisp/org.el b/lisp/org.el index f873f1021..7c451d525 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11857,42 +11857,40 @@ keywords relative to each registered export back-end." "TITLE:" "TODO:" "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:")) (defcustom org-structure-template-alist - '((?a . "export ascii") - (?c . "center") - (?C . "comment") - (?e . "example") - (?E . "export") - (?h . "export html") - (?l . "export latex") - (?q . "quote") - (?s . "src") - (?v . "verse")) + '(("a" . "export ascii") + ("c" . "center") + ("C" . "comment") + ("e" . "example") + ("E" . "export") + ("h" . "export html") + ("l" . "export latex") + ("q" . "quote") + ("s" . "src") + ("v" . "verse")) "Structure completion elements. This is an alist of characters and values. When -`org-insert-structure-template' is called, an additional key is -read. The key is first looked up in this alist, and the -corresponding structure is inserted, with \"#+BEGIN_\" and -\"#+END_\" added automatically." +`org-insert-structure-template' is called, a string key is read. +The key is first looked up in this alist, and the corresponding +structure is inserted, with \"#+BEGIN_\" and \"#+END_\" added +automatically." :group 'org-completion :type '(repeat - (cons (character :tag "Key") + (cons (string :tag "Key") (string :tag "Template"))) :package-version '(Org . "9.2")) (defun org-insert-structure-template (type) "Insert a block structure of the type #+begin_foo/#+end_foo. -First read a character, which can be one of the keys in -`org-structure-template-alist'. When it is , prompt the -user for a string to use. With an active region, wrap the region -in the block. Otherwise, insert an empty block." +First read a string, which is used as a lookup key in +`org-structure-template-alist' or, failing that, used literally. +With an active region, wrap the region in the block. Otherwise, +insert an empty block." (interactive (list - (let* ((key (read-key "Key: ")) + (let* ((key (read-string "Key: ")) (struct-string - (or (cdr (assq key org-structure-template-alist)) - (and (= key ?\t) - (read-string "Structure type: ")) - (user-error "`%c' has no structure definition" key)))) + (or (cdr (assoc-string key org-structure-template-alist)) + key))) struct-string))) (let* ((region? (use-region-p)) (s (if region? (region-beginning) (point)))