From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.rz.uni-karlsruhe.de (Debian-exim@smtp1.rz.uni-karlsruhe.de [129.13.185.217]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o65M9hPq015544 for ; Mon, 5 Jul 2010 18:09:45 -0400 (EDT) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by smtp1.rz.uni-karlsruhe.de with esmtp (Exim 4.63 #1) id 1OVtrB-0007Y9-OQ; Tue, 06 Jul 2010 00:09:41 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.71) (envelope-from ) id 1OVtrB-00055B-NQ for tech@mdocml.bsd.lv; Tue, 06 Jul 2010 00:09:41 +0200 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.69) (envelope-from ) id 1OVtrB-0007mw-M3 for tech@mdocml.bsd.lv; Tue, 06 Jul 2010 00:09:41 +0200 Received: from schwarze by usta.de with local (Exim 4.71) (envelope-from ) id 1OVtrB-0003eR-Gd for tech@mdocml.bsd.lv; Tue, 06 Jul 2010 00:09:41 +0200 Date: Tue, 6 Jul 2010 00:09:41 +0200 From: Ingo Schwarze To: tech@mdocml.bsd.lv Subject: Re: Bk -words badness Message-ID: <20100705220941.GA5497@iris.usta.de> References: <4C31A369.6010005@bsd.lv> <4C31B55E.3030202@bsd.lv> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C31B55E.3030202@bsd.lv> User-Agent: Mutt/1.5.20 (2009-06-14) Hi Kristaps, > The enclosed patch is a first stab at this. It only works for explicit > `Bk -words' for now; it's trivial to extend this to SYNPRETTY. As you > can see, it simply checks whether it's in a KEEP mode and resets to > PREKEEP if it's a line subsequent the prior node. Excellent, this is much more elegant than what i would have done, which is closing out a pending keep at the end of the line and re-opening it, in a way similar to .Fl closing out and reopening itself when encountering punctuation. Please commit to both repositories! > Thoughts? If we now enable automatic implicit word keeping in the SYNOPSIS, i guess we are mostly done with .Bk. We only need to pay attention because .Bk doesn't nest well. An explicit .Bk/.Ek in the SYNOPSIS would have the .Ek close out the implicit automatic keep, so i guess we need to skip the code in termp_bk_post in SYNOPSIS mode. Yours, Ingo > Index: mdoc_term.c > =================================================================== > RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v > retrieving revision 1.171 > diff -u -r1.171 mdoc_term.c > --- mdoc_term.c 4 Jul 2010 22:04:04 -0000 1.171 > +++ mdoc_term.c 5 Jul 2010 10:36:57 -0000 > @@ -330,6 +330,23 @@ > else if (termacts[n->tok].pre && ENDBODY_NOT == n->end) > chld = (*termacts[n->tok].pre)(p, &npair, m, n); > > + /* > + * Keeps only work until the end of a line. If a keep was > + * invoked in a prior line, revert it to PREKEEP. > + */ > + > + if (TERMP_KEEP & p->flags) { > + if (n->prev && n->prev->line != n->line) { > + p->flags &= ~TERMP_KEEP; > + p->flags |= TERMP_PREKEEP; > + } else if (NULL == n->prev) { > + if (n->parent && n->parent->line != n->line) { > + p->flags &= ~TERMP_KEEP; > + p->flags |= TERMP_PREKEEP; > + } > + } > + } > + > if (chld && n->child) > print_mdoc_nodelist(p, &npair, m, n->child); -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv