bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13713: 24.3.50; C indent produces error when narrowing is active


From: Dima Kogan
Subject: bug#13713: 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]