From: Lennart Borgman <lennart.borgman@gmail.com>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: buffer-narrowed-p
Date: Sat, 14 Aug 2010 14:39:55 +0200 [thread overview]
Message-ID: <AANLkTikR78NgEZ8=U7mZvDxVx++zTW2KwMDk5p5UmpPJ@mail.gmail.com> (raw)
In-Reply-To: <4C668D14.508@easy-emacs.de>
On Sat, Aug 14, 2010 at 2:33 PM, Andreas Röhler
<andreas.roehler@easy-emacs.de> wrote:
>
>
> Hi,
>
> a couple of functions should behave different if buffer
> is narrowed, i.e. taking narrowing already as
> users decision to work on it, dismissing check for region
> then.
>
> As its used repeatedly, here an essay to solve it one
> for all:
>
> (defun buffer-narrowed-p ()
> (interactive)
> "Returns t, if buffer is narrowed. "
> (save-restriction
> (lexical-let ((beg (point-min))
> (end (point-max))
> erg)
> (widen)
> (setq erg (not (and (eq beg (point-min)) (eq end (point-max)))))
> (when (interactive-p)
> (if erg (message "Buffer is narrowed to: %d %d" beg end)
> (message "Buffer not narrowed: %s" "nil")))
> erg)))
>
> Comments welcome :-)
I have this (which I think I stole from a comment by Stefan) in
ourcomments-util.el in nXhtml:
;;;###autoload
(defun buffer-narrowed-p ()
"Return non-nil if the current buffer is narrowed."
(/= (buffer-size)
(- (point-max)
(point-min))))
next prev parent reply other threads:[~2010-08-14 12:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-14 12:33 buffer-narrowed-p Andreas Röhler
2010-08-14 12:39 ` Lennart Borgman [this message]
2010-08-14 13:09 ` buffer-narrowed-p Andreas Röhler
-- strict thread matches above, loose matches on Subject: below --
2009-10-11 20:41 buffer-narrowed-p Lennart Borgman
2009-10-11 20:48 ` buffer-narrowed-p Deniz Dogan
2009-10-11 21:25 ` buffer-narrowed-p Lennart Borgman
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='AANLkTikR78NgEZ8=U7mZvDxVx++zTW2KwMDk5p5UmpPJ@mail.gmail.com' \
--to=lennart.borgman@gmail.com \
--cc=andreas.roehler@easy-emacs.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.