forked from mirrors/org-mode
org-insert-structure-template: Err on empty TYPE
* lisp/org.el (org-insert-structure-template): Throw a user error on empty TYPE input. Throw an error when TYPE is not a string or an empty string. Reported-by: pva-outdoor@yandex.ru Link: https://orgmode.org/list/87a5wij05o.fsf@yandex.ru
This commit is contained in:
parent
85aa3c1850
commit
64a0a624d2
|
@ -9063,8 +9063,13 @@ block.
|
|||
When foo is written as FOO, upcase the #+BEGIN/END as well."
|
||||
(interactive
|
||||
(list (pcase (org--insert-structure-template-mks)
|
||||
(`("\t" . ,_) (read-string "Structure type: "))
|
||||
(`("\t" . ,_)
|
||||
(let ((type (read-string "Structure type: ")))
|
||||
(when (string-empty-p type) (user-error "Empty structure type"))
|
||||
type))
|
||||
(`(,_ ,choice . ,_) choice))))
|
||||
(when (or (not (stringp type)) (string-empty-p type))
|
||||
(error "Invalid structure type: %S" type))
|
||||
(let* ((case-fold-search t) ; Make sure that matches are case-insensitive.
|
||||
(region? (use-region-p))
|
||||
(region-start (and region? (region-beginning)))
|
||||
|
|
Loading…
Reference in New Issue