unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6556: html-mode does not align to prev non-empty line when indenting
@ 2010-07-03  0:14 Lennart Borgman
  2010-07-03 10:44 ` Lennart Borgman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lennart Borgman @ 2010-07-03  0:14 UTC (permalink / raw)
  To: 6556

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6556: html-mode does not align to prev non-empty line when indenting
  2010-07-03  0:14 bug#6556: html-mode does not align to prev non-empty line when indenting Lennart Borgman
@ 2010-07-03 10:44 ` Lennart Borgman
  2016-03-01  6:03 ` Lars Ingebrigtsen
  2017-02-07  3:43 ` bug#6556: works for me Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Lennart Borgman @ 2010-07-03 10:44 UTC (permalink / raw)
  To: 6556

On Sat, Jul 3, 2010 at 2:14 AM, Lennart Borgman
<lennart.borgman@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.
>
>
>
>





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6556: html-mode does not align to prev non-empty line when indenting
  2010-07-03  0:14 bug#6556: html-mode does not align to prev non-empty line when indenting Lennart Borgman
  2010-07-03 10:44 ` Lennart Borgman
@ 2016-03-01  6:03 ` Lars Ingebrigtsen
  2017-02-07  3:43 ` bug#6556: works for me Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2016-03-01  6:03 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 6556

Lennart Borgman <lennart.borgman@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6556: works for me
  2010-07-03  0:14 bug#6556: html-mode does not align to prev non-empty line when indenting Lennart Borgman
  2010-07-03 10:44 ` Lennart Borgman
  2016-03-01  6:03 ` Lars Ingebrigtsen
@ 2017-02-07  3:43 ` Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2017-02-07  3:43 UTC (permalink / raw)
  To: 6556-done

I tried this and it works for me, so I'm closing this bug.

Tom





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-07  3:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-03  0:14 bug#6556: html-mode does not align to prev non-empty line when indenting Lennart Borgman
2010-07-03 10:44 ` Lennart Borgman
2016-03-01  6:03 ` Lars Ingebrigtsen
2017-02-07  3:43 ` bug#6556: works for me Tom Tromey

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).