[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fiddling with SGML/HTML mode
From: |
Tyler Smith |
Subject: |
Re: fiddling with SGML/HTML mode |
Date: |
Wed, 03 Feb 2010 16:04:09 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) |
Eric Abrahamsen <girzel@gmail.com> writes:
> Very briefly: is there a way to convince html-mode that when I use
> sgml-tag to insert a <div> tag, it should give me the option of adding
> a class or id attribute? Can I do this without editing the source
> code?
>
You can customize Sgml Tag Alist. The syntax is kind of awkward until
you're familiar with skeletons. I've got the following set in my
customize page:
Sgml Tag Alist: Hide Value
<snipped>
INS DEL Cons-cell:
Tag Name: div
Tag Rule:
INS DEL Lisp expression: ("class"
("clear")
("default"))
INS DEL Lisp expression:
("id"
("wrapper")
("article")
("content")
("nav")
("primary")
("secondary")
("sidebar")
("header")
("footer-content")
("footer-web"))
This change results in my being prompted for attributes when I insert a
div. If I choose class or id, I have tab completion for the values in
the lists.
There are some tags that don't work as expected via the customize
framework. p, h*, ol, and some others are effectively hard-coded. They
appear in html-tag-alist before the sgml-tag-alist gets inserted, so any
customizations are ignored. To get around this I've hard-coded a few
hacks of my own into my .emacs. I've been meaning to look into whether
or not this is worth writing up into a proper patch, but just haven't
had time.
Cheers,
Tyler