emacs-devel
[Top][All Lists]
Advanced

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

Re: moving some indentation tests


From: Phillip Lord
Subject: Re: moving some indentation tests
Date: Mon, 03 Apr 2017 17:39:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Noam Postavsky <address@hidden> writes:

> On Mon, Apr 3, 2017 at 7:11 AM, Phillip Lord <address@hidden> wrote:
>>>
>>> I found that adding indentation and then reindenting turned up some
>>> different bugs than removing indentation and reindenting. It looks
>>> like assess only does the latter right now.
>>
>> Indeed it does. Do you have an example of the former?
>
> In (ert-deftest indent-sexp ()...) in
> test/lisp/emacs-lisp/lisp-mode-tests.el where it says ";; Correctly
> remove indentation". It's fairly simplistic, I just add an increasing
> number of leading spaces to every line except for blank ones and lines
> containing "noindent" (that's to avoid string literals). Oh, current
> master is missing the check for blanks lines though, that's still
> pending on my local branch:
>
>               (unless (looking-at "noindent\\|^[[:blank:]]*$")
>                 (insert (make-string n ?\s)))

Ah, so you put in some relatively random indentation (well, not random),
and then reindent it, rather than starting from totally unindented.

I will add that, if it gives different results!

>>
>> (assess-roundtrip-indentation=
>>   'emacs-lisp-mode
>> "
>> (assess-with-find-file
>>     \"~/.emacs\"
>>   (buffer-string))")
>>
>> returns "t" for me.
>
> I meant multi-line string literals in the code being indented. I might
> be misreading, but I think
>
> (assess-roundtrip-indentation=
>  'emacs-lisp-mode "\
> \"a
> \s\s\s\s\smulti
> \s\sline
> string-literal
> \s\s\swith random leading space\"")
>
> would return nil.

Just so. The diff is:

Differ at:*** /tmp/a6466fOB     2017-04-03 17:32:04.268554341 +0100
--- /tmp/b6466sYH       2017-04-03 17:32:04.316554609 +0100
***************
*** 1,5 ****
  \"a
! multi
! line
  string-literal
! with random leading space\"
\\ No newline at end of file
--- 1,5 ----
  \"a
!      multi
!   line
  string-literal
!    with random leading space\"
\\ No newline at end of file

"

So the string gets indented.

Although I think emacs-lisp-mode is not working correctly here. In my hands:

"
(hello
(world))
"

indents to

"
(hello
 (world))
"

in emacs-lisp mode. So I'm not 100% sure this is assess not working.



reply via email to

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