[Top][All Lists]

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

Re: gud-format-command concats integers

From: David Kastrup
Subject: Re: gud-format-command concats integers
Date: 05 Dec 2001 11:29:32 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

>>>>> "RMS" == Richard Stallman <address@hidden> writes:

 RMS> Does this replacement code fix it?
 RMS>    ((eq key ?l)
 RMS>     (setq subst (int-to-string
 RMS>                  (if insource
 RMS>                      (save-excursion
 RMS>                        (beginning-of-line)
 RMS>                        (save-restriction
 RMS>                          (widen)
 RMS>                          (1+ (count-lines 1 (point)))))
 RMS>                    (cdr frame)))))

I would place the (beginning-of-line) after the (widen) so that the
line count does not get wring in case that (beginning-of-line) moves
to the start of the narrowed region in the midst of a line.

Anyhow, since beginning-of-line is not guaranteed to move to the
beginning of the line (see its documentation), it would be better to

        (if insource
        (save-restriction (widen) (+ (count-lines 1 (point))
                                 (if (bolp) 1 0)))))

David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: address@hidden

reply via email to

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