[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: |
Sun, 04 Dec 2005 09:54:10 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>> Yes, there is a very good one: you unnecessarily assume that the buffer
>> starts at position 1.
> Both `what-cursor-position' and `what-line' (in simple.el) do this
> assumption. After looking in buffer.h and seeing:
> /* Position of beginning of buffer. */
> #define BEG (1)
> I don't see any reason NOT to assume this.
I didn't say it was a bad assumption. Just an unneeded one.
Code with fewer assumptions is generally better than a code with
more assumptions. Especially when it's shorter and more efficient,
of course.
Stefan "whose Emacs uses #define BEG (12345678)"