emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: some proposed tweaks to HTML mode


From: Stefan Monnier
Subject: Re: some proposed tweaks to HTML mode
Date: Fri, 22 Mar 2019 16:04:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> Indeed, `class` and `id` should be automatically added to all elements
>> (i.e. not in the above list but directly in the sgml-attributes code).
>> But for many elements it makes sense to not query any attributes at all
>> since they almost never have any attributes (not even "class" nor "id").
>
> I was also thinking `sgml-attributes', but I'm less sure about excluding
> elements.

I didn't mean to exclude elements.  I meant that if attributes are
queried then we do want to include `class` and `id`, but if they're not
then we shouldn't change it just on the premise that `class` or `id`
could be added.

> Making sure I follow you, the definition of eg `html-ordered-list' would
> then look like:
>
> (define-skeleton html-ordered-list
>   "HTML ordered list tags."
>   nil
>   \n "<ol>" \n
>   "<li>" _ (if sgml-xml-mode "</li>") \n
>   "</ol>" > \n)

Right.

> Is that right? This does more or less the right thing, though it does in
> some cases still insert a newline. In the text below, with point at the
> vertical bar, the above definition still inserts another closing
> newline:
>
> <div>
>   <div>|
>     
>   </div>
> </div>

I don't think it adds a closing newline any more than the current
code does: you start with point in front of 2 newlines and you end with
2 newlines after </ol>.

> I found this bit of the Autotype manual confusing:
>
> ‘?\n’
>      Insert a newline and align under current line, but not if this is
>      the last element of a skeleton and the newline would be inserted at
>      end of line, or this is the first element and the newline would be
>      inserted at beginning of line.  Use newline character ‘?\n’ to
>      prevent alignment.  Use ‘"\n"’ as the first or last string element
>      of a skeleton to insert a newline unconditionally.
>
> Here, "align" has nothing to do with "indent", right?

Right.

> This appears to
> describe the behavior of ?\n as newline-and-align, but then goes on to
> say we should use ?\n to *prevent* alignment.

Indeed, \n is the magic one while ?\n just inserts the LF char
without any extra processing (just like "\n").


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]