Oleksandr Gavenko | 13 Jan 16:17 2013

I reached limit of 'html-tag-alist' in html-mode. Need advice for template engine.

To quickly insert HTML template I use standard html-mode command sgml-tag (C-c
C-t). I modify standard template by own code:

  (setq my-html-template
           "\n<head>" \n
           "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" (read-input "Charset: ") "\">" \n
           "<title>" (setq str (read-input "Title: ")) "</title>\n"
           "<body>\n<h1>" str "</h1>"
           "\n<address>" \n
           "<a href=\"mailto:" user-mail-address "\">" (user-full-name) "</a>" \n
           "</address>" \n

  (setq sgml-set-face t)                  ; for highlighting in sgml
  (eval-after-load 'sgml-mode
       (unless (featurep 'psgml)
         (setq html-tag-alist
                 (lambda (item) (not (equal (car item) "html")))
         (add-to-list 'html-tag-alist '("script" (\n) ("type" "text/javascript") ))
         (add-to-list 'html-tag-alist '("style" (\n) ("type" "text/css") ))

But seems that I can't insert such code:

  <!DOCTYPE html>

So I start look to Emacs general templating engine.

Simple search shown that most feature rich is yasnippet:


I try this package before but it was hard to extend by own snippet. And I
dislike file naming convention (tag == file name) - it was very US/ASCII

Next thing that was interesting is SRecode which already in Emacs and use sane
syntax and can use Semantic info for completion.

But SRecode have no HTML templates implementation...


Best regards!