[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how do I know that the buffer is narrowed
From: |
Giorgos Keramidas |
Subject: |
Re: how do I know that the buffer is narrowed |
Date: |
Thu, 01 Dec 2005 20:41:58 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (berkeley-unix) |
On Thu, 01 Dec 2005 11:52:19 -0500, Stefan Monnier wrote:
>>> (<(-(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".
Ah! Very nice explanation, thanks :)