

Emacs Zen Coding - Write markup quickly - kirubakaran
http://www.emacswiki.org/emacs/ZenCoding#toc2

======
andrewljohnson
This is pretty neat, but I'm not sure it's really practical. I don't want to
learn a new syntax just to save a few keystrokes. When I use JQuery, it's nice
that it cuts down on some typing, but the reason I use it is because it
abstracts away things like animations.

Is how fast I can write mark-up really bound by how many characters I have to
type? For me at least, it's more bound by thinking, so I don't want to do
anymore of that. And I don't even type that fast.

~~~
noahlt
This isn't really a new syntax, though -- it mostly just uses standard CSS
selectors (.class, sibling+sibling, parent>child, etc).

~~~
10ren
Wow, you're right: <http://www.w3.org/TR/css3-selectors/#child-combinators>

It also reminds me of HAML (discussed recently):
<http://news.ycombinator.com/item?id=925573>

Looking at one aspect: The idea of abstracting the verbosity of HTML/XML by
just stating the element name once (instead of both open and close tags) is
not new. Many people have implemented this idea, but it doesn't seem to catch
on. It could be that that very verbosity is a significant factor in the
success of HTML and XML (both have widespread adoption).

SGML (the common ancestor of both HTML and XML) allowed a "</>" close tag,
which goes part-way towards reducing verbosity, but it was deliberately
omitted from HTML and XML. Both have been much more successful than SGML.
Though it's hard to know what impact that particular omission had, greater
abstraction is harder to read for newcomers, and therefore probably decreases
adoptability...

Perhaps it's the Abstraction vs. Verbosity being played out in another forum
e.g. Lisp abstraction being more powerful but Java verbosity being more
popular.

~~~
fhars
Yeah, but the SGML declaration for HTML contains SHORTTAG, so

    
    
      <a href=../bar/index.html>Bar</a>
    

is actually shorthand for the invalid

    
    
      <a href="..">bar</a>index.html>Bar</a>
    

Good luck reading real world HTML with a browser that implements that
correctly. (And that is why the W3C validator so often complains about a
closing A tag that is not open (or at least used to do). )

------
misuba
How about a command for closing whatever tag is open where the cursor is? For
repeating the last closed tag? For wrapping a tag in another tag?

I'm an emacs noob but it seems like the tools for actually working with
existing markup are impoverished. You only write markup once; you have to
maintain it forever.

~~~
mccutchen
> How about a command for closing whatever tag is open where the cursor is?

Try `C-h m` to find out what commands your HTML editing mode provides. In HTML
Mode, `C-c /` closes the current element, and in nxml mode, `C-c C-f` does the
same thing. Even better, in nxml mode, when `nxml-slash-auto-complete-flag` is
non-nil the current element is automatically closed when you type a "/".

The nice thing about Emacs is that it's pretty trivial to write a little elisp
code to add the other functionality you're looking for.

------
swannodette
Ahh the power and fun of Emacs :) Good stuff.

------
SlyShy
What's the advantage of this over Haml?

~~~
buugs
That it isn't compiled but is immediately transformed. (In regards to Emacs)

