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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17207 in the body.
You can then email your comments to 17207 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17207; Package emacs. (Sun, 06 Apr 2014 17:51:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jon Dufresne <jon.dufresne <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 06 Apr 2014 17:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jon Dufresne <jon.dufresne <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; html-mode incorrect indentation inside template syntax
Date: Sun, 06 Apr 2014 08:53:04 -0700
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


In GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.9.10)
 of 2013-08-14 on buildvm-17.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11404000
System Description:	Fedora release 20 (Heisenbug)

Configured using:
 `configure '--build=x86_64-redhat-linux-gnu'
 '--host=x86_64-redhat-linux-gnu' '--program-prefix='
 '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr'
 '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
 '--datadir=/usr/share' '--includedir=/usr/include'
 '--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
 '--localstatedir=/var' '--sharedstatedir=/var/lib'
 '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus'
 '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff'
 '--with-xft' '--with-xpm' '--with-x-toolkit=gtk3' '--with-gpm=no'
 'build_alias=x86_64-redhat-linux-gnu'
 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
 -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ''

Important settings:
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: HTML

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<down> <down> <down> <down> <down> <tab> M-x b u <tab> 
<backspace> <backspace> r e p o <tab> r <tab> <ret
urn>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
`flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `cl-letf'.
Loading /home/jon/pony-mode/src/pony-tpl.el (source)...done
Loading vc-git...done
Making completion list... [2 times]

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-mode vc-git pony-mode easy-mmode edmacro
kmacro help-fns cl-macs gv which-func imenu sql thingatpt sgml-mode
python rx easymenu comint ring ansi-color files-x dired-aux dired cl
cl-lib time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)




Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 03 Nov 2019 13:19:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17207; Package emacs. (Sun, 03 Nov 2019 13:21:02 GMT) Full text and rfc822 format available.

Message #10 received at 17207 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Jon Dufresne <jon.dufresne <at> gmail.com>
Cc: 17207 <at> debbugs.gnu.org
Subject: Re: 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17207; Package emacs. (Sun, 03 Nov 2019 17:24:01 GMT) Full text and rfc822 format available.

Message #13 received at 17207 <at> debbugs.gnu.org (full text, mbox):

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

> 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?

FWIW, searching online suggests one could use
django-nxhtml-mumamo-mode for Django templates.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17207; Package emacs. (Mon, 04 Nov 2019 14:28:01 GMT) Full text and rfc822 format available.

Message #16 received at 17207 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Kangas <stefan <at> marxist.se>, Jon Dufresne <jon.dufresne <at> gmail.com>
Cc: 17207 <at> debbugs.gnu.org
Subject: Re: bug#17207: 24.3; html-mode incorrect indentation inside template
 syntax
Date: Mon, 4 Nov 2019 16:27:27 +0200
On 03.11.2019 19:23, Stefan Kangas wrote:
> FWIW, searching online suggests one could use
> django-nxhtml-mumamo-mode for Django templates.

MuMaMo has been dead for a while.

http://web-mode.org/ might be the best choice here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17207; Package emacs. (Tue, 05 Nov 2019 03:10:01 GMT) Full text and rfc822 format available.

Message #19 received at 17207 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: jon.dufresne <at> gmail.com, stefan <at> marxist.se, 17207 <at> debbugs.gnu.org
Subject: Re: bug#17207: 24.3;
 html-mode incorrect indentation inside template syntax
Date: Mon, 04 Nov 2019 22:09:32 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > MuMaMo has been dead for a while.

If it is the right technical approach
someone could fix it up again.

-- 
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17207; Package emacs. (Tue, 05 Nov 2019 07:41:01 GMT) Full text and rfc822 format available.

Message #22 received at 17207 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: rms <at> gnu.org
Cc: jon.dufresne <at> gmail.com, stefan <at> marxist.se, 17207 <at> debbugs.gnu.org
Subject: Re: bug#17207: 24.3; html-mode incorrect indentation inside template
 syntax
Date: Tue, 5 Nov 2019 09:39:51 +0200
On 05.11.2019 5:09, Richard Stallman wrote:
> If it is the right technical approach
> someone could fix it up again

mmm-mode is a similar package in GNU ELPA. Not sure if we have support 
for Django templates out of the box (it can be configured, though).

But web-mode is better for newbies.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17207; Package emacs. (Mon, 02 Dec 2019 11:10:02 GMT) Full text and rfc822 format available.

Message #25 received at 17207 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Jon Dufresne <jon.dufresne <at> gmail.com>
Cc: 17207 <at> debbugs.gnu.org
Subject: Re: bug#17207: 24.3; html-mode incorrect indentation inside
 template syntax
Date: Mon, 02 Dec 2019 12:09:45 +0100
tags 17207 + wontfix notabug
close 17207
thanks

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

> I wonder if it makes sense to make html-mode support Django template
> syntax.

No other comments within 4 weeks, so I think the decision is that we
don't want to support Django templates in html-mode.

Dmitry Gutov <dgutov <at> yandex.ru> writes:

> http://web-mode.org/ might be the best choice here.

The suggestion is as above, to use web-mode for this instead.

I'm consequently closing this bug report.  If anyone disagrees with
that, feel free to reopen the bug or simply reply to this email.

Best regards,
Stefan Kangas




Added tag(s) wontfix and notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 02 Dec 2019 11:10:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 17207 <at> debbugs.gnu.org and Jon Dufresne <jon.dufresne <at> gmail.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 02 Dec 2019 11:10:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 Dec 2019 12:24:04 GMT) Full text and rfc822 format available.

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.