GNU bug report logs - #17207
24.3; html-mode incorrect indentation inside template syntax

Previous Next

Package: emacs;

Reported by: Jon Dufresne <jon.dufresne <at> gmail.com>

Date: Sun, 6 Apr 2014 17:51:01 UTC

Severity: minor

Tags: notabug, wontfix

Found in version 24.3

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefan <at> marxist.se>
To: Jon Dufresne <jon.dufresne <at> gmail.com>
Cc: 17207 <at> debbugs.gnu.org
Subject: bug#17207: 24.3; html-mode incorrect indentation inside template syntax
Date: Sun, 03 Nov 2019 14:20:45 +0100
Jon Dufresne <jon.dufresne <at> gmail.com> writes:

> Create a test.html file. Use html-mode. Fill with the following
> contents:
>
> ```
> <table>
>   <thead>
>     <tr>
>       {% for header in headers %}
> 	<th>{{ header.attr1 }}</th>
>       <th>{{ header.attr2 }}</th>
>       {% endfor %}
>     </tr>
>   </thead>
> </table>
> ```
>
> This is a mix of HTML and Django template syntax [0]. If you indent line
> 6 (<th>{{ header.attr2 }}</th>) I would expect the line to align itself
> with the previous line (<th>{{ header.attr1 }}</th>). Instead it appears
> to aligns itself with the "for" template tag or perhaps the <tr> plus an
> offset. The final result after indenting line 6 is as it appears above.
>
> The mode pony-tpl-mode [1] uses html-mode to calculate indentation when
> then previous line looks like HTML and not special syntax. See my bug
> report there: https://github.com/davidmiller/pony-mode/issues/81
>
> [0] https://docs.djangoproject.com/en/dev/topics/templates/
> [1] https://github.com/davidmiller/pony-mode

This was reported 5 years ago, but unfortunately never got a reply at
the time.

I can reproduce this on current master, but I wonder if it makes sense
to make html-mode support Django template syntax.  Shouldn't there be
a separate (perhaps derived) mode for that?

Best regards,
Stefan Kangas




This bug report was last modified 5 years and 178 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.