Xah Talk Show 2025-03-21 Ep631 emacs lisp coding html insert doctype
(defun xah-html-insert-doctype ()
"Insert a html doctype.
if `universal-argument' is called first, prompt select a doctype from choices.
Created: 2025-03-21
Version: 2025-03-21"
(interactive)
(if current-prefix-arg
(let (xdoctype
(xmenu
'("<!DOCTYPE html>"
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">"
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
)))
(setq xdoctype (completing-read "pick one:" xmenu nil t))
(insert xdoctype))
(insert "<!DOCTYPE html>")))