Subject: bug#30139: 25.3; Passing callback to align-region raises an error when using `justify` rule

From: Michał Kondraciuk <[email-masked]>
Date: Fri, 19 Jan 2018 18:04:08 +0100

I looked at source of `align-areas` in lisp/align.el and it looks like 
the changes made to `areas` on line 1196 are ignored in funcall on line 
1218.
Attached patch contains my proposed change.
diff --git a/lisp/align.el b/lisp/align.el
index 941fa3a..10f3fcb 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -1215,10 +1215,16 @@ align-areas
 	      (gocol col) cur)
 	  (when area
 	    (if func
-		(funcall func
-			 (marker-position (car area))
-			 (marker-position (cdr area))
-			 change)
+                (if (and justify
+                         (consp (cdr area)))
+                    (funcall func
+                             (marker-position (car area))
+                             (marker-position (cadr area))
+                             change)
+                  (funcall func
+                             (marker-position (car area))
+                             (marker-position (cdr area))
+                             change))
 	      (if (not (and justify
 			    (consp (cdr area))))
 		  (goto-char (cdr area))