[bug #66392] [me] loses track of hyphenation mode in environment 1

2024-11-03 Thread G. Branden Robinson
Update of bug #66392 (group groff):

  Status: In Progress => Invalid
 Open/Closed:Open => Closed 

___

Follow-up Comment #4:

Fair point, Dave.

I managed to muddle this issue by reporting it while I had changes pending
that I have now pushed.

Here's the problem.


$ cat EXPERIMENTS/buggy-hla.groff 
.tm .hla=\n[.hla], .hy=\n[.hy]
.ev italian
.mso it.tmac
.tm .hla=\n[.hla], .hy=\n[.hy]
.ev
.tm .hla=\n[.hla], .hy=\n[.hy]
$ ~/groff-stable/bin/groff EXPERIMENTS/buggy-hla.groff
.hla=en, .hy=4
.hla=it, .hy=1
.hla=it, .hy=4
$ ./build/test-groff EXPERIMENTS/buggy-hla.groff
.hla=en, .hy=4
.hla=it, .hy=1
.hla=en, .hy=4


In other words, bug #66387.

*However*, our _me_ and _ms_ implementations both assume the erstwhile
behavior of the formatter.  So lines hyphenate and break differently with the
fix to bug #66387 applied--not globally across the document, but in certain
environments.

Does this break backward compatibility?

With AT&T _troff_, no, or the question isn't even well-posed.  That formatter
had no concept of a hyphenation language since the only hyphenation rules it
ever applies were those for English (and as you've noticed, some subtle
differences exist even between AT&T and GNU handling of hyphenation
exceptions, such that GNU _troff_ does not assume English's most common
pluralization rule).

With GNU _troff_, the answer is yes.  I got pretty far along with a change to
_me_(7), but then decided a better approach would be to simply do stuff behind
the scenes inside the package and the localization files to essentially copy
environment 0's hyphenation language to environments 1 and 2.  A bit of a
dance will have to be done since since a default hyphenation language can come
from 3 places: (a) the formatter; (b) a localization macro file that is loaded
*after* the full-service package itself (necessitating a degree of
re-initialization); and (c) from the document.

I aim to do something similar for _ms_.

Anywhere, here's the approach I abandoned with _me_.


mit bdfbc2f61fd758fcd68e1ae2c5aa435dcc4ea0d1
Author: G. Branden Robinson 
Date:   Thu Oct 31 04:46:31 2024 -0500

[me]: Fix Savannah #66392.

* tmac/e.tmac: Improve handling of hyphenation in environments 1
  (blocks, lists, keeps) and 2 (headers, footers, footnotes).
  Historically, these used hyphenation mode 1, which is incorrect with
  groff's hyphenation patterns for English and French (for example).
  Wrap the `hy` request with a macro.  New internal register `_h` stores
  the hyphenation mode set by the new `hy` macro.

  (xh): Renames `hy` formatter request.

  (hy): If the formatter claims groff compatibility, store the
  hyphenation language code in new string `_H` and copy it to the
  traditional three environments.  If given no argument, restore the
  previous hyphenation mode given to this macro (or 0 if there was no
  previous call).  This is not how AT&T troff worked (it supported only
  English anyway), but it's what most users expected (see Savannah
  #63635).

  (ld): Set the hyphenation mode to 6 only if the formatter does not
  claim groff compatibility.

* doc/meref.me.in (Miscellaneous) 
  (Summary):
* tmac/groff_me.7.man (Description, Macros): Document it.

* NEWS: Add item.

Fixes .  Between this change and
the fix for Savannah #66387, the "meintro_fr.me" document now hyphenates
words in its blocks, lists, and keeps as a French speaker would expect.
(...assuming a French *roff user who knows what automatic hyphenation
mode "14", set by the document, means--among other things, "don't
hyphenate a word prior to the third letter".)

diff --git a/ChangeLog b/ChangeLog
index e500abecd..3ffd5b815 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2024-11-01  G. Branden Robinson 
+
+   * tmac/e.tmac: Improve handling of hyphenation in environments 1
+   {blocks, lists, keeps} and 2 {headers, footers, footnotes}.
+   Historically, these used hyphenation mode 1, which is incorrect
+   with groff's hyphenation patterns for English and French (for
+   example).  Wrap the `hy` request with a macro.  New internal
+   register `_h` stores the hyphenation mode set by the new `hy`
+   macro.
+   (xh): Renames `hy` formatter request.
+   (hy): If the formatter claims groff compatibility, store the
+   hyphenation language code in new string `_H` and copy it to the
+   traditional three environments.  If given no argument, restore
+   the previous hyphenation mode given to this macro (or 0 if there
+   was no previous call).  This is not how AT&T troff worked (it
+   supported only English anyway), but it's what most users
+   expected (see Savannah #63635).
+  

[bug #66392] [me] loses track of hyphenation mode in environment 1

2024-11-01 Thread Dave
Follow-up Comment #3, bug #66392 (group groff):

Groff documentation says that the .hy setting is scoped to the environment. 
The .tm lines added show that .hy changes when entering a different
environment and changes back when returning to the original one.  So this
strikes me as working as designed.

I put this at the top of -me documents to set hyphenation mode in all three
environments that -me uses.  I don't consider the need for this a bug, as .hy
is documented to work this way.

.hy \n[base-hy]
.ev 1
.hy \n[base-hy]
.ev 2
.hy \n[base-hy]
.ev
.ev




___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/


signature.asc
Description: PGP signature


[bug #66392] [me] loses track of hyphenation mode in environment 1

2024-10-31 Thread G. Branden Robinson
Update of bug #66392 (group groff):

 Summary: [troff] loses track of hyphenation mode in
environment 1 => [me] loses track of hyphenation mode in environment 1


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/


signature.asc
Description: PGP signature


[bug #66392] [me] loses track of hyphenation mode in environment 1

2024-10-31 Thread G. Branden Robinson
Follow-up Comment #1, bug #66392 (group groff):

In BSD _me_, you were just up a creek since AT&T troff offered no means of
introspecting the hyphenation mode.  The best that could have been done, I
think, would have been to expose a package-specific register (maybe `hy`) for
the automatic hyphenation mode, and manually set it upon entry to environments
1 and 2.


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/


signature.asc
Description: PGP signature


[bug #66392] [me] loses track of hyphenation mode in environment 1

2024-10-31 Thread G. Branden Robinson
Follow-up Comment #2, bug #66392 (group groff):

Excuse me.  _me_ used/uses environment 2 for footnotes, too, and hyphenation
definitely matters for those.


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/


signature.asc
Description: PGP signature