GNU bug report logs - #6556
html-mode does not align to prev non-empty line when indenting

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Sat, 3 Jul 2010 00:15:02 UTC

Severity: minor

Tags: unreproducible

Done: Tom Tromey <tom <at> tromey.com>

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 6556 in the body.
You can then email your comments to 6556 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6556; Package emacs. (Sat, 03 Jul 2010 00:15:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 03 Jul 2010 00:15:03 GMT) Full text and rfc822 format available.

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

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Emacs Bugs <bug-gnu-emacs <at> gnu.org>
Subject: html-mode does not align to prev non-empty line when indenting
Date: Sat, 3 Jul 2010 02:14:23 +0200
In a buffer like this

   <p>
      row 1
         row 2
     row 3

the "row 3" gets indented like above. I think it instead should be
aligned with row2. (I need this for mumamo.)

The comment in sgml-calculate-indent seems to say that this is the
intention, but the code is maybe unfinished, line 1483:

	    (context
	     ;; If possible, align on the previous non-empty text line.
	     ;; Otherwise, do a more serious parsing to find the
	     ;; tag(s) relative to which we should be indenting.
	     (if (and (not unclosed) (skip-chars-backward " \t")
		      (< (skip-chars-backward " \t\n") 0)
		      (back-to-indentation)
		      (> (point) (cdr lcon)))
		 nil
	       (goto-char here)
	       (nreverse (sgml-get-context (if unclosed nil 'empty)))))

I do not know how it is supposed to work, but I notice that
(back-to-indentation) is not supposed to return anything special so
the argument to if may fail (and this seems to happen). Writing that
part as


                    (progn
		      (back-to-indentation)
		      (> (point) (cdr lcon))))


seems to work as expected.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6556; Package emacs. (Sat, 03 Jul 2010 10:45:02 GMT) Full text and rfc822 format available.

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

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: 6556 <at> debbugs.gnu.org
Subject: Re: bug#6556: html-mode does not align to prev non-empty line when 
	indenting
Date: Sat, 3 Jul 2010 12:44:19 +0200
On Sat, Jul 3, 2010 at 2:14 AM, Lennart Borgman
<lennart.borgman <at> gmail.com> wrote:
> In a buffer like this
>
>   <p>
>      row 1
>         row 2
>     row 3
>
> the "row 3" gets indented like above. I think it instead should be
> aligned with row2. (I need this for mumamo.)
>
> The comment in sgml-calculate-indent seems to say that this is the
> intention, but the code is maybe unfinished, line 1483:
>
>            (context
>             ;; If possible, align on the previous non-empty text line.
>             ;; Otherwise, do a more serious parsing to find the
>             ;; tag(s) relative to which we should be indenting.
>             (if (and (not unclosed) (skip-chars-backward " \t")
>                      (< (skip-chars-backward " \t\n") 0)
>                      (back-to-indentation)
>                      (> (point) (cdr lcon)))
>                 nil
>               (goto-char here)
>               (nreverse (sgml-get-context (if unclosed nil 'empty)))))
>
> I do not know how it is supposed to work, but I notice that
> (back-to-indentation) is not supposed to return anything special so
> the argument to if may fail (and this seems to happen). Writing that
> part as
>
>

A test for beginning of buffer is needed too since we are looking for
non-blank lines (not non-empty as the comment says):

                      (not (bobp))

>                    (progn
>                      (back-to-indentation)
>                      (> (point) (cdr lcon))))
>
>
> seems to work as expected.
>
>
>
>




Added tag(s) unreproducible. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 01 Mar 2016 14:15:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6556; Package emacs. (Tue, 01 Mar 2016 14:16:03 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 6556 <at> debbugs.gnu.org
Subject: Re: bug#6556: html-mode does not align to prev non-empty line when
 indenting
Date: Tue, 01 Mar 2016 17:03:20 +1100
Lennart Borgman <lennart.borgman <at> gmail.com> writes:

> In a buffer like this
>
>    <p>
>       row 1
>          row 2
>      row 3
>
> the "row 3" gets indented like above. I think it instead should be
> aligned with row2. (I need this for mumamo.)

I'm unable to reproduce this.  I get the following alignment:

<p>
  row 1
  row 2
  row 3

Which is the correct one, I think?  Are you still seeing this problem?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Reply sent to Tom Tromey <tom <at> tromey.com>:
You have taken responsibility. (Tue, 07 Feb 2017 03:44:01 GMT) Full text and rfc822 format available.

Notification sent to Lennart Borgman <lennart.borgman <at> gmail.com>:
bug acknowledged by developer. (Tue, 07 Feb 2017 03:44:01 GMT) Full text and rfc822 format available.

Message #18 received at 6556-done <at> debbugs.gnu.org (full text, mbox):

From: Tom Tromey <tom <at> tromey.com>
To: 6556-done <at> debbugs.gnu.org
Subject: works for me
Date: Mon, 06 Feb 2017 20:43:00 -0700
I tried this and it works for me, so I'm closing this bug.

Tom




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

This bug report was last modified 8 years and 102 days ago.

Previous Next


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