bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#30139: 25.3; Passing callback to align-region raises an error when u


From: Lars Ingebrigtsen
Subject: bug#30139: 25.3; Passing callback to align-region raises an error when using `justify` rule
Date: Mon, 24 Jun 2019 22:10:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

"John Wiegley" <johnw@gnu.org> writes:

>>>>>> "MK" == MichaB Kondraciuk <k.michal@zoho.com> writes:
>
> MK> is there any news on the status of this bug? Should I just send the patch 
> to
> MK> emacs-devel?
>
> Hi MichaB,
>
> I would suggest the following code:
>
>     (funcall func
>              (marker-position (car area))
>              (marker-position (if (and justify
>                                        (consp (cdr area)))
>                                   (cadr area)
>                                 (cdr area)))
>              change)
>
> I can't really tell you at this point if this is the correct change, but if it
> solves the bug, it surely is an improvement.

I am guessing that you meant the following change:

diff --git a/lisp/align.el b/lisp/align.el
index 443237b451..cd72d52df4 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -1216,9 +1216,12 @@ align-areas
          (when area
            (if func
                (funcall func
-                        (marker-position (car area))
-                        (marker-position (cdr area))
-                        change)
+                         (marker-position (car area))
+                         (marker-position (if (and justify
+                                                   (consp (cdr area)))
+                                              (cadr area)
+                                            (cdr area)))
+                         change)
              (if (not (and justify
                            (consp (cdr area))))
                  (goto-char (cdr area))

And with it in place, I don't get any errors.

But nothing happens in the *test* buffer at all, so that's a bit
underwhelming...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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