unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35286: 26.2; indent-sexp broken
@ 2019-04-15 12:14 Leo Liu
  2019-04-15 23:57 ` Noam Postavsky
  0 siblings, 1 reply; 10+ messages in thread
From: Leo Liu @ 2019-04-15 12:14 UTC (permalink / raw)
  To: 35286


I am only using the following ruby code to demonstrate the issue. I
noticed this issue while editing other programming text.

  def sum_eq_n?(arr, n)
    return true if arr.empty? && n == 0
    arr.product(arr).reject { |a,b| a == b }.any? !{ |a,b| a + b == n } #
  
  def sum_eq_n?(arr, n)
    return true if arr.empty? && n == 0
    arr.product(arr).reject { |a,b| a == b }.any? { |a,b| a + b == n }
  end

Put the above ruby code in a ruby-mode buffer. ! is used to indicate
where point is and is not part of the code.

M-x indent-sexp and see indentation of every line after the point
changed.


The bug is caused by the following unsafe part of indent-sexp introduced
in 26.2:

  (save-excursion
    (let ((eol (line-end-position)))
      (forward-sexp 1)
      (condition-case ()
          (while (and (< (point) eol) (not (eobp)))
            (forward-sexp 1))
        (scan-error nil)))
    (point))

which can easily include two or more sexps after point. This looks like
a major breakage.





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

end of thread, other threads:[~2019-04-22 16:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-15 12:14 bug#35286: 26.2; indent-sexp broken Leo Liu
2019-04-15 23:57 ` Noam Postavsky
2019-04-16  0:35   ` Leo Liu
2019-04-16  0:54     ` Noam Postavsky
2019-04-16  3:19       ` Leo Liu
2019-04-16 12:16         ` Noam Postavsky
2019-04-16 12:57           ` Leo Liu
2019-04-16 13:13             ` Leo Liu
2019-04-21  8:41           ` Leo Liu
2019-04-22 16:51             ` Noam Postavsky

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).