* Wrong indentation of defun with indent-region
@ 2017-04-30 16:31 Peter Vasil
2017-04-30 16:51 ` Peter Vasil
2017-04-30 17:58 ` Noam Postavsky
0 siblings, 2 replies; 4+ messages in thread
From: Peter Vasil @ 2017-04-30 16:31 UTC (permalink / raw)
To: emacs-devel
Hello,
Since commit 6fa9cc0593150a318f0e08e69ec10672d548a7c1 indent-region
doesn't indent correctly a defun when docstring is more than one line.
Reproduction:
(defun test ()
"Test.
Two lines docstring."
(message "Test"))
With cursor somewhere in the function and after M-x mark-defun RET and
M-x indent-region RET is this the result:
(defun test-func ()
"Test func.
Two lines docstring."
(message "Test"))
However if the docstring is only one line the indentation stays correct.
Regards,
Peter Vasil
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wrong indentation of defun with indent-region
2017-04-30 16:31 Wrong indentation of defun with indent-region Peter Vasil
@ 2017-04-30 16:51 ` Peter Vasil
2017-04-30 17:58 ` Noam Postavsky
1 sibling, 0 replies; 4+ messages in thread
From: Peter Vasil @ 2017-04-30 16:51 UTC (permalink / raw)
To: emacs-devel
On 04/30/2017 06:31 PM, Peter Vasil wrote:
> Hello,
>
> Since commit 6fa9cc0593150a318f0e08e69ec10672d548a7c1 indent-region
> doesn't indent correctly a defun when docstring is more than one line.
>
> Reproduction:
>
> (defun test ()
> "Test.
> Two lines docstring."
> (message "Test"))
>
> With cursor somewhere in the function and after M-x mark-defun RET and
> M-x indent-region RET is this the result:
>
>
> (defun test-func ()
> "Test func.
> Two lines docstring."
> (message "Test"))
>
> However if the docstring is only one line the indentation stays correct.
>
> Regards,
> Peter Vasil
>
>
>
I wrote this small ert test which fails:
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el
b/test/lisp/emacs-lisp/lisp-mode-tests.el
index 27f0bb5..4856318 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -97,5 +97,19 @@
(indent-sexp)
(should (equal (buffer-string) correct)))))
+(ert-deftest indent-region ()
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (insert "
+(defun test ()
+ \"Test func.
+Two lines docstring.\"
+ (message \"Test\"))")
+ (let ((correct (buffer-string)))
+ (search-backward "message")
+ (mark-defun)
+ (indent-region (region-beginning) (region-end))
+ (should (equal (buffer-string) correct)))))
+
(provide 'lisp-mode-tests)
Result:
Selector: t
Passed: 0
Failed: 1 (1 unexpected)
Skipped: 0
Total: 1/1
Started at: 2017-04-30 18:49:36+0200
Finished.
Finished at: 2017-04-30 18:49:36+0200
F
F indent-region
(ert-test-failed
((should
(equal
(buffer-string)
correct))
:form
(equal "
(defun test ()
\"Test func.
Two lines docstring.\"
(message \"Test\"))" "
(defun test ()
\"Test func.
Two lines docstring.\"
(message \"Test\"))")
:value nil :explanation
(arrays-of-different-length 76 71 "
(defun test ()
\"Test func.
Two lines docstring.\"
(message \"Test\"))" "
(defun test ()
\"Test func.
Two lines docstring.\"
(message \"Test\"))" first-mismatch-at 54)))
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Wrong indentation of defun with indent-region
2017-04-30 16:31 Wrong indentation of defun with indent-region Peter Vasil
2017-04-30 16:51 ` Peter Vasil
@ 2017-04-30 17:58 ` Noam Postavsky
2017-04-30 18:34 ` Peter Vasil
1 sibling, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2017-04-30 17:58 UTC (permalink / raw)
To: Peter Vasil; +Cc: Emacs developers
On Sun, Apr 30, 2017 at 12:31 PM, Peter Vasil
<mailing_lists@petervasil.net> wrote:
>
> Since commit 6fa9cc0593150a318f0e08e69ec10672d548a7c1 indent-region
> doesn't indent correctly a defun when docstring is more than one line.
Please try out the patch at
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26619#40
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-30 18:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-30 16:31 Wrong indentation of defun with indent-region Peter Vasil
2017-04-30 16:51 ` Peter Vasil
2017-04-30 17:58 ` Noam Postavsky
2017-04-30 18:34 ` Peter Vasil
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.