Subject: Re: bug#27899: 26.0.50; dired-align-file forget about text properties

From: Tino Calancha <[email-masked]>
Date: Tue, 01 Aug 2017 16:33:18 +0900

Tino Calancha <[email-masked]> writes:

> +(ert-deftest dired-test-bug27899 ()
> +  "Test for http://debbugs.gnu.org/27899 ."
> +  :expected-result :failed
> +  (let* ((dir (expand-file-name "src" source-directory))
> +	 (buf (dired (list dir "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")))
> +         (orig dired-hide-details-mode))
> +    (dired-goto-file (expand-file-name "cygw32.c"))
> +    (forward-line 0)
> +    (let ((inhibit-read-only t))
> +      (dired-align-file (point) (point-max)))
> +    (dired-hide-details-mode t)
> +    (dired-move-to-filename)
> +    (should (eq 2 (current-column)))))
>  
>  (provide 'dired-tests)
>  ;; dired-tests.el ends here
The test must pass and set dired-hide-details-mode to orig at the end:

diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index d6fe839708..937386de78 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -319,6 +319,21 @@
       (delete-directory dir 'recursive)
       (when (buffer-live-p buf) (kill-buffer buf)))))
 
+(ert-deftest dired-test-bug27899 ()
+  "Test for http://debbugs.gnu.org/27899 ."
+  (let* ((dir (expand-file-name "src" source-directory))
+	 (buf (dired (list dir "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")))
+         (orig dired-hide-details-mode))
+    (dired-goto-file (expand-file-name "cygw32.c"))
+    (forward-line 0)
+    (unwind-protect
+        (progn
+          (let ((inhibit-read-only t))
+            (dired-align-file (point) (point-max)))
+          (dired-hide-details-mode t)
+          (dired-move-to-filename)
+          (should (eq 2 (current-column))))
+      (dired-hide-details-mode orig))))
 
 (provide 'dired-tests)
 ;; dired-tests.el ends here