GNU bug report logs - #30139
25.3; Passing callback to align-region raises an error when using `justify` rule

Previous Next

Package: emacs;

Reported by: Michał Kondraciuk <k.michal <at> zoho.com>

Date: Tue, 16 Jan 2018 20:33:02 UTC

Severity: normal

Tags: confirmed, fixed, patch

Found in version 25.3

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #42 received at 30139 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "John Wiegley" <johnw <at> gnu.org>
Cc: 30139 <at> debbugs.gnu.org,
 Michał Kondraciuk <k.michal <at> zoho.com>
Subject: Re: 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
"John Wiegley" <johnw <at> gnu.org> writes:

>>>>>> "MK" == MichaB Kondraciuk <k.michal <at> 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




This bug report was last modified 5 years and 289 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.