GNU bug report logs -
#37045
lisp-indent-region hangs in lisp-indent-calc-next when indenting the three characters "|#\n"
Previous Next
Reported by: eschulte <at> grammatech.com
Date: Fri, 16 Aug 2019 04:50:03 UTC
Severity: normal
Tags: fixed, patch
Found in version 26.1
Fixed in version 26.3
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #10 received at control <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
found 37045 26.1
tags 37045 + patch
quit
eschulte <at> grammatech.com writes:
> Indent-region sometimes hangs when indenting a lisp file. A minimal
> example is the file just containing the characters "|#" followed by a
> newline.
It's actually any unfinished string literal (in Common Lisp, |...| is
treated by Emacs as a string literal, though technically it's an escaped
symbol).
> This hang is due to an infinite loop in the while loop in the
> `lisp-indent-calc-next' function. The following version of this
> function fixes this problem, but is certainly not the appropriate
> long-term fix.
I think the right fix is just to check for end of buffer:
@@ -810,7 +810,7 @@ lisp-indent-calc-next
(setq last-sexp (nth 2 ppss)))
(setq depth (car ppss))
;; Skip over newlines within strings.
- (nth 3 ppss))
+ (and (not (eobp)) (nth 3 ppss)))
(let ((string-start (nth 8 ppss)))
(setq ppss (parse-partial-sexp (point) (point-max)
nil nil ppss 'syntax-table))
Full patch with test (and some other comment updates) attached below.
Is this okay for emacs-26? The bug is a regression from Emacs 25.
[0001-Fix-lisp-indent-infloop-on-unfinished-strings-Bug-37.patch (text/plain, attachment)]
This bug report was last modified 5 years and 274 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.