unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6205: 23.1; align.el error deleting a lot of whitespace
@ 2010-05-17 23:29 Kevin Ryde
  2010-05-19  3:33 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2010-05-17 23:29 UTC (permalink / raw)
  To: 6205

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

If M-x align deletes a lot of whitespace doing its alignment it can get
an "Invalid search bound" error.  Eg. with foo.el below

    emacs -Q foo.el
    M-x end-of-buffer
    M-x align
    => Invalid search bound (wrong side of point)

In `align-region' it seems `last-point' is established from `b' which is
an integer buffer position but that position is invalidated by
whitespace deletes before that point (done by `align-regions').

I get some joy from making the marker before changing the buffer, per
below.  Alternately (untested!) perhaps `b' could be a marker to start
with, ready to be the new value of `last-point'.

2010-05-17  Kevin Ryde  <user42@zip.com.au>

	* align.el (align-region): For `last-point' take marker of b
	position before align-regions because that function inserts or
	deletes text before there.  In particular fixes "Invalid search
	bound" when there's two sections in the region and alignment in
	the first deletes a lot of whitespace.


[-- Attachment #2: foo.el --]
[-- Type: application/emacs-lisp, Size: 147 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: align.el.last-point.diff --]
[-- Type: text/x-diff, Size: 474 bytes --]

--- align.el.~1.35.~	2009-03-28 09:41:43.000000000 +1100
+++ align.el	2010-05-16 19:03:40.000000000 +1000
@@ -1502,10 +1502,10 @@
 				   (align-new-section-p last-point b
 							thissep))
 			      (progn
+				(setq last-point (copy-marker b t))
 				(align-regions regions align-props
 					       rule func)
-				(setq last-point (copy-marker b t)
-				      regions nil
+				(setq regions nil
 				      align-props nil))
 			    (setq last-point (copy-marker b t)))
 

[-- Attachment #4: Type: text/plain, Size: 1077 bytes --]




In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-09-14 on raven, modified by Debian
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#6205: 23.1; align.el error deleting a lot of whitespace
  2010-05-17 23:29 bug#6205: 23.1; align.el error deleting a lot of whitespace Kevin Ryde
@ 2010-05-19  3:33 ` Stefan Monnier
  2010-05-19  9:55   ` John Wiegley
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2010-05-19  3:33 UTC (permalink / raw)
  To: John Wiegley; +Cc: 6205, Kevin Ryde

John, what's your opinion?
The patch looks OK to me, but at the same time, the code is pretty
impenetrable from here,


        Stefan


>>>>> "Kevin" == Kevin Ryde <user42@zip.com.au> writes:

> If M-x align deletes a lot of whitespace doing its alignment it can get
> an "Invalid search bound" error.  Eg. with foo.el below

>     emacs -Q foo.el
>     M-x end-of-buffer
>     M-x align
>     => Invalid search bound (wrong side of point)

> In `align-region' it seems `last-point' is established from `b' which is
> an integer buffer position but that position is invalidated by
> whitespace deletes before that point (done by `align-regions').

> I get some joy from making the marker before changing the buffer, per
> below.  Alternately (untested!) perhaps `b' could be a marker to start
> with, ready to be the new value of `last-point'.

> 2010-05-17  Kevin Ryde  <user42@zip.com.au>

> 	* align.el (align-region): For `last-point' take marker of b
> 	position before align-regions because that function inserts or
> 	deletes text before there.  In particular fixes "Invalid search
> 	bound" when there's two sections in the region and alignment in
> 	the first deletes a lot of whitespace.

> (ab        .    c)
> (def  .                                                                ghi)

> (ab        .    c)

> (foo . bar)
> (foo . bar)

> --- align.el.~1.35.~	2009-03-28 09:41:43.000000000 +1100
> +++ align.el	2010-05-16 19:03:40.000000000 +1000
> @@ -1502,10 +1502,10 @@
>  				   (align-new-section-p last-point b
>  							thissep))
>  			      (progn
> +				(setq last-point (copy-marker b t))
>  				(align-regions regions align-props
>  					       rule func)
> -				(setq last-point (copy-marker b t)
> -				      regions nil
> +				(setq regions nil
>  				      align-props nil))
>  			    (setq last-point (copy-marker b t)))
 





> In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
>  of 2009-09-14 on raven, modified by Debian
> configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

> Important settings:
>   value of $LC_ALL: nil
>   value of $LC_COLLATE: nil
>   value of $LC_CTYPE: nil
>   value of $LC_MESSAGES: nil
>   value of $LC_MONETARY: nil
>   value of $LC_NUMERIC: nil
>   value of $LC_TIME: nil
>   value of $LANG: en_AU
>   value of $XMODIFIERS: nil
>   locale-coding-system: iso-latin-1-unix
>   default-enable-multibyte-characters: t





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#6205: 23.1; align.el error deleting a lot of whitespace
  2010-05-19  3:33 ` Stefan Monnier
@ 2010-05-19  9:55   ` John Wiegley
  2010-06-08  2:01     ` Kevin Ryde
  0 siblings, 1 reply; 6+ messages in thread
From: John Wiegley @ 2010-05-19  9:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6205, Kevin Ryde, John Wiegley

On May 18, 2010, at 11:33 PM, Stefan Monnier wrote:

> John, what's your opinion?
> The patch looks OK to me, but at the same time, the code is pretty
> impenetrable from here,

Just be really careful with this change.  align.el is extremely sensitive to cursor positions.  If it gets enough testing, I'm fine with it.

One thing I used to do to test it back in the day was to run align-code on a very large C file.  If the result looked upon visual examination, I was happy.

John




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#6205: 23.1; align.el error deleting a lot of whitespace
  2010-05-19  9:55   ` John Wiegley
@ 2010-06-08  2:01     ` Kevin Ryde
  2019-11-23 13:20       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2010-06-08  2:01 UTC (permalink / raw)
  To: John Wiegley, Stefan Monnier, 6205

John Wiegley <jwiegley@gmail.com> writes:
>
> Just be really careful with this change.  align.el is extremely
> sensitive to cursor positions.  If it gets enough testing, I'm fine
> with it.

I see vhdl-align-region-groups holds a point-marker for the end of the
previous group of lines becoming the beginning of the next group.  But
I'm hopelessly confused about which bit of which of align and vhdl came
first or got updated.  :-)





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#6205: 23.1; align.el error deleting a lot of whitespace
  2010-06-08  2:01     ` Kevin Ryde
@ 2019-11-23 13:20       ` Lars Ingebrigtsen
  2020-08-10 13:06         ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-23 13:20 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: John Wiegley, 6205, Stefan Monnier

Kevin Ryde <user42@zip.com.au> writes:

> John Wiegley <jwiegley@gmail.com> writes:
>>
>> Just be really careful with this change.  align.el is extremely
>> sensitive to cursor positions.  If it gets enough testing, I'm fine
>> with it.
>
> I see vhdl-align-region-groups holds a point-marker for the end of the
> previous group of lines becoming the beginning of the next group.  But
> I'm hopelessly confused about which bit of which of align and vhdl came
> first or got updated.  :-)

This was nine years ago, and the patch no longer applies (the code
changed quite a bit in 2013).

Is the error the patch tried to address still present in Emacs 27?

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#6205: 23.1; align.el error deleting a lot of whitespace
  2019-11-23 13:20       ` Lars Ingebrigtsen
@ 2020-08-10 13:06         ` Stefan Kangas
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Kangas @ 2020-08-10 13:06 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: John Wiegley, Kevin Ryde, Stefan Monnier, 6205-done

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This was nine years ago, and the patch no longer applies (the code
> changed quite a bit in 2013).
>
> Is the error the patch tried to address still present in Emacs 27?

More information was requested, but none was given within 37 weeks, so
I'm closing this bug.  If this is still an issue, please reply to this
email (use "Reply to all" in your email client) and we can reopen the
bug report.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-10 13:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-17 23:29 bug#6205: 23.1; align.el error deleting a lot of whitespace Kevin Ryde
2010-05-19  3:33 ` Stefan Monnier
2010-05-19  9:55   ` John Wiegley
2010-06-08  2:01     ` Kevin Ryde
2019-11-23 13:20       ` Lars Ingebrigtsen
2020-08-10 13:06         ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).