From: Sven Joachim <svenjoac@gmx.de>
To: help-gnu-emacs@gnu.org
Subject: Re: What variable says that the buffer is in narrowed state?
Date: Mon, 15 Oct 2007 19:51:46 +0200 [thread overview]
Message-ID: <87ve98w9jh.fsf@gmx.de> (raw)
In-Reply-To: jwvhckth3p3.fsf-monnier+gnu.emacs.help@gnu.org
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> (defun buffer-narrowed-p ()
>> "Return t if buffer is narrowed, nil otherwise."
>> (or (> (point-min) 1)
>> (< (point-max) (buffer-size))))
>
> Sometimes you can't avoid assuming that buffer positions start at 1, but
> that's rare.
What's worse is that I incorrectly assumed that buffer positions end
at (buffer-size), while they actually end at (1+ (buffer-size)). :-/
> Even in the above case, for example, you can simply check:
>
> (defun buffer-narrowed-p ()
> (> (buffer-size) (- (point-max) (point-min))))
Thanks. I'm still learning, maybe in a few years I'll be able to post
a snippet here that actually works. :-(
Slightly embarrassed,
Sven
next prev parent reply other threads:[~2007-10-15 17:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.2016.1192278715.18990.help-gnu-emacs@gnu.org>
2007-10-13 13:45 ` What variable says that the buffer is in narrowed state? Sven Joachim
2007-10-13 15:57 ` Bastien
2007-10-14 19:57 ` Stefan Monnier
2007-10-15 17:51 ` Sven Joachim [this message]
2007-10-13 13:30 Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ve98w9jh.fsf@gmx.de \
--to=svenjoac@gmx.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.