Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!nrl-cmf!ukma!gatech!bloom-beacon!mgm.mit.edu!wolfgang From: wolfgang@mgm.mit.edu (Wolfgang Rupprecht) Newsgroups: comp.emacs Subject: Re: Is there a cleaner way to check for a narrowed buffer? Message-ID: <2340@bloom-beacon.MIT.EDU> Date: 18 Jan 88 06:07:25 GMT References: <138@axcess.UUCP> <2336@bloom-beacon.MIT.EDU> <5959@sol.ARPA> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: wolfgang@mgm.mit.edu (Wolfgang Rupprecht) Organization: Freelance Software Consultant, Cambridge, Ma. Lines: 30 %$#* news software wouldn't let me cancel my article. No checking for point-min + point-max isn't enough to tell if a buffer is narrowed. The only real way is probably to add some C code. This might just do the trick. To editfns.c add: DEFUN ("narrowp", Fnarrowp, Snarrowp, 0, 0, "", "Returns t if buffer is narrowed, else returns nil.") () { return (bf_head_clip > 1 || bf_tail_clip > 0) ? Qt: Qnil; } Towards the end of the file, add this extra line to syms_of_editfns: void syms_of_editfns () { [...] defsubr (&SNarrowp); /* add this line only ! */ } Now recompile + dump. (Now to see why nntp-rn screws up and refuses to let me cancel my previous article.) --- Wolfgang Rupprecht ARPA: wolfgang@mgm.mit.edu (IP 18.82.0.114) Independent Consultant UUCP: {mit-eddie!mgm.mit.edu,mirror!mit-mgm}!wolfgang VOICE: Hey_Wolfgang!_(617)_267-4365