unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* narrow question
@ 2006-09-26 13:03 ray
  0 siblings, 0 replies; 4+ messages in thread
From: ray @ 2006-09-26 13:03 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 132 bytes --]

I have learned to use narrow-to-region to narrow a buffer. But how can I
determine whether a buffer is narrowed with elisp? Thanks.

[-- Attachment #1.2: Type: text/html, Size: 136 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: narrow question
       [not found] <mailman.7430.1159275829.9609.help-gnu-emacs@gnu.org>
@ 2006-09-26 17:51 ` Barry Margolin
  2006-09-27 11:45   ` ray
  2006-09-27 11:53   ` David Kastrup
  0 siblings, 2 replies; 4+ messages in thread
From: Barry Margolin @ 2006-09-26 17:51 UTC (permalink / raw)


In article <mailman.7430.1159275829.9609.help-gnu-emacs@gnu.org>,
 ray <hantechs@gmail.com> wrote:

> I have learned to use narrow-to-region to narrow a buffer. But how can I
> determine whether a buffer is narrowed with elisp? Thanks.

(defun buffer-narrowed-p ()
  (/= (- (point-max-marker) (point-min-marker))
      (buffer-size)))

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

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

* Re: narrow question
  2006-09-26 17:51 ` narrow question Barry Margolin
@ 2006-09-27 11:45   ` ray
  2006-09-27 11:53   ` David Kastrup
  1 sibling, 0 replies; 4+ messages in thread
From: ray @ 2006-09-27 11:45 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 791 bytes --]

It works,  Thank you.

On 9/27/06, Barry Margolin <barmar@alum.mit.edu> wrote:
>
> In article <mailman.7430.1159275829.9609.help-gnu-emacs@gnu.org>,
> ray <hantechs@gmail.com> wrote:
>
> > I have learned to use narrow-to-region to narrow a buffer. But how can I
> > determine whether a buffer is narrowed with elisp? Thanks.
>
> (defun buffer-narrowed-p ()
>   (/= (- (point-max-marker) (point-min-marker))
>       (buffer-size)))
>
> --
> Barry Margolin, barmar@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>

[-- Attachment #1.2: Type: text/html, Size: 1418 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: narrow question
  2006-09-26 17:51 ` narrow question Barry Margolin
  2006-09-27 11:45   ` ray
@ 2006-09-27 11:53   ` David Kastrup
  1 sibling, 0 replies; 4+ messages in thread
From: David Kastrup @ 2006-09-27 11:53 UTC (permalink / raw)


Barry Margolin <barmar@alum.mit.edu> writes:

> In article <mailman.7430.1159275829.9609.help-gnu-emacs@gnu.org>,
>  ray <hantechs@gmail.com> wrote:
>
>> I have learned to use narrow-to-region to narrow a buffer. But how can I
>> determine whether a buffer is narrowed with elisp? Thanks.
>
> (defun buffer-narrowed-p ()
>   (/= (- (point-max-marker) (point-min-marker))
>       (buffer-size)))

That is a bad idea since it creates unnecessary markers which slow
down editing until they are garbage-collected.  Just use (point-max)
and (point-min) instead.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

end of thread, other threads:[~2006-09-27 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.7430.1159275829.9609.help-gnu-emacs@gnu.org>
2006-09-26 17:51 ` narrow question Barry Margolin
2006-09-27 11:45   ` ray
2006-09-27 11:53   ` David Kastrup
2006-09-26 13:03 ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).