GNU bug report logs - #13713
24.3.50; C indent produces error when narrowing is active

Previous Next

Packages: cc-mode, emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Thu, 14 Feb 2013 08:59:02 UTC

Severity: normal

Tags: fixed

Found in versions 25.3, 24.3.50

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


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

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; C indent produces error when narrowing is active
Date: Thu, 14 Feb 2013 00:57:11 -0800
Hi.

I'm observing an issue with emacs indentation in C mode when narrowing
is enabled. To reproduce, create a tst.c buffer with the following 3
lines:

// 123
// 456
// 789

I select the last 2 lines (456, 789), and narrow-to-region. Then I place
the point at the start of the 789 line, and press 'tab'. I get this:

Debugger entered--Lisp error: (args-out-of-range 1 8)
  parse-partial-sexp(1 8)
  c-determine-limit-get-base(15 1000)
  (let* ((start (or start (point))) (try-size (or try-size (* 2 how-far-back))) (base (c-determine-limit-get-base start try-size)) (pos base) (s (parse-partial-sexp pos pos)) stack elt size (count 0)) (while (< pos start) (setq s (parse-partial-sexp pos start nil nil s (quote syntax-table))) (setq size (- (if (or (nth 4 s) (nth 3 s)) (nth 8 s) (point)) pos)) (if (> size 0) (setq stack (cons (cons pos size) stack))) (if (or (nth 4 s) (nth 3 s)) (setq s (parse-partial-sexp (point) start nil nil s (quote syntax-table)))) (setq pos (point))) (while (and (< count how-far-back) stack) (setq elt (car stack) stack (cdr stack)) (setq count (+ count (cdr elt)))) (cond ((>= count how-far-back) (+ (car elt) (- count how-far-back))) ((eq base (point-min)) (point-min)) (t (c-determine-limit (- how-far-back count) base try-size))))
  (save-excursion (let* ((start (or start (point))) (try-size (or try-size (* 2 how-far-back))) (base (c-determine-limit-get-base start try-size)) (pos base) (s (parse-partial-sexp pos pos)) stack elt size (count 0)) (while (< pos start) (setq s (parse-partial-sexp pos start nil nil s (quote syntax-table))) (setq size (- (if (or (nth 4 s) (nth 3 s)) (nth 8 s) (point)) pos)) (if (> size 0) (setq stack (cons (cons pos size) stack))) (if (or (nth 4 s) (nth 3 s)) (setq s (parse-partial-sexp (point) start nil nil s (quote syntax-table)))) (setq pos (point))) (while (and (< count how-far-back) stack) (setq elt (car stack) stack (cdr stack)) (setq count (+ count (cdr elt)))) (cond ((>= count how-far-back) (+ (car elt) (- count how-far-back))) ((eq base (point-min)) (point-min)) (t (c-determine-limit (- how-far-back count) base try-size)))))
  c-determine-limit(500)
  c-guess-basic-syntax()
  c-indent-line()
  c-indent-command(nil)
  c-indent-line-or-region(nil nil)
  call-interactively(c-indent-line-or-region nil nil)


As shown above, the failure is in (parse-partial-sexp 1 8). Evaluating
this same for succeeds if the buffer is re-widened.

Thanks




This bug report was last modified 7 years and 231 days ago.

Previous Next


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