a groff convenience for quoting man pages (was: if source command.sh & set -e issue)

2024-07-26 Thread G. Branden Robinson
Hi Chet,

At 2024-07-26T11:18:57-0400, Chet Ramey wrote:
> The man page says, about this scenario:
> 
> "The  shell  does  not  exit if the command that fails is
>  part of the command list immediately following  a  while
>  or  until  keyword, part of the test following the if or
>  elif reserved words, part of any command executed  in  a
>  &&  or || list except the command following the final &&
>  or ||, any command in a pipeline but the last, or if the
>  command's  return  value is being inverted with !.  If a
>  compound command other than a subshell  returns  a  non-
>  zero  status because a command failed while -e was being
>  ignored, the shell does not exit."

Like you, I frequently have reason to quote man pages to people.  The
adjustment of lines ends up looking a bit weird for people who read
email using a proportional font.[1]  If you're running groff 1.23.0
(released July 2023) on the machine you send email from, you can tell it
to suppress adjustment to both margins on the fly, without changing any
configuration files or defaults.

I have a shell function called "mailman"--merrily colliding with the
name of other software I don't personally use.

# As gman, but format for email.
mailman () {
local cmd=
case "$1" in
(-*)
opts="$opts $1"
shift
;;
esac

set -- $(man -w "$@")
cmd=$(zcat --force "$@" | \
  grog -Tutf8 -b -ww -P -cbou -rU0 -rLL=72n -rHY=0 -dAD=l \
   $opts)
zcat --force "$@" | $cmd | less
}

There are many conveniences packed into that function.  I'm happy to
elaborate further; follow-ups might be better sited on the groff list
than bug-bash.

Regards,
Branden

[1] ...such as those accursed with GMail, which has proudly refused to
support an option for rendering emails in monospace for 20+ years,
because everyone at Google is smarter than you


signature.asc
Description: PGP signature


hyphenating non-english characters

2024-07-26 Thread Gáspár Gergő
Hi,

I'm trying to make justified text look nicer, so I turned to hyphenation. 
Hungarian is not supported out of the box by groff, but I found a tex patterns
file which seems quite good, that is what I tried to use, to not much success.
Hyphenation happens, but not as often as I'd hope. After some more reading, 
I think the problem might be with the accented Hungarian characters not having 
hyphenation codes assigned to them, since hyphenation seemingly only happens 
near non-accented vowels.

These are the requests that I used for hyphenation originally:
.hla hu
.hpf /home/gergo/projekt/jella/huhyphn.tex
.hy 1

The manual told me that
> A hyphenation code must be an ordinary character (not a special character 
> escape sequence) other than a digit or a space.
So I tried following the example, with these requests:
.hcode á á Á á
.hcode é é É é
.hcode í í Í í
.hcode ó ó Ó ó
.hcode ö ö Ö ö
.hcode ő ő Ő ő
.hcode ú ú Ú ú
.hcode ü ü Ü ü
.hcode ű ű Ű ű

However, groff throws errors saying "error: hyphenation code must be ordinary 
character". I tried with and without preconv to no avail. The example supplied
in the manual, with German characters, didn't work either.

What could be the problem here?

Best regards,
Gergő Gáspár