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

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

Re: how do I know that the buffer is narrowed


From: Stefan Monnier
Subject: Re: how do I know that the buffer is narrowed
Date: Thu, 01 Dec 2005 11:52:19 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> (<(-(point-max)(point-min))(buffer-size))
> Pfeh!  Is there any good reason to obfuscate the beautiful:
>     (not (and (= (point-min) 1)
>               (= (point-max) (1+ (buffer-size)))))

Yes, there is a very good one: you unnecessarily assume that the buffer
starts at position 1.

Comparing (- (point-max) (point-min)) and (buffer-size) doesn't suffer from
this problem.  And conceptually, it also makes a lot of sense:
(- (point-max) (point-min)) is the amount of text shown and (buffer-size) is
the total mount of text, and the definition of non-narrowed is basically
"shows everything" i.e. "doesn't show less than the total".


        Stefan


reply via email to

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