all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* buffer-narrowed-p
@ 2009-10-11 20:41 Lennart Borgman
  2009-10-11 20:48 ` buffer-narrowed-p Deniz Dogan
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2009-10-11 20:41 UTC (permalink / raw)
  To: Emacs-Devel devel

Could this perhaps be included in Emacs?

';;;###autoload
(defun buffer-narrowed-p ()
  "Return non-nil if the current buffer is narrowed."
  (/= (buffer-size)
      (- (point-max)
         (point-min))))




^ permalink raw reply	[flat|nested] 6+ messages in thread
* buffer-narrowed-p
@ 2010-08-14 12:33 Andreas Röhler
  2010-08-14 12:39 ` buffer-narrowed-p Lennart Borgman
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Röhler @ 2010-08-14 12:33 UTC (permalink / raw)
  To: help-gnu-emacs



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 :-)

Andreas

--
https://code.launchpad.net/~a-roehler/python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-14 13:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2010-08-14 12:33 buffer-narrowed-p Andreas Röhler
2010-08-14 12:39 ` buffer-narrowed-p Lennart Borgman
2010-08-14 13:09   ` buffer-narrowed-p Andreas Röhler

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.