From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Coding system to encode arguments to groff?
Date: Wed, 29 Sep 2021 15:02:59 +0300 [thread overview]
Message-ID: <83o88bio7g.fsf@gnu.org> (raw)
In-Reply-To: <87v92jyfnb.fsf@vagabond.tim-landscheidt.de> (message from Tim Landscheidt on Wed, 29 Sep 2021 08:01:12 +0000)
> From: Tim Landscheidt <tim@tim-landscheidt.de>
> Date: Wed, 29 Sep 2021 08:01:12 +0000
>
> I pass text arguments from Emacs Lisp to a groff command
> with the "-d" option. For ASCII strings, this is trivial;
> for strings with umlauts, I need to use:
>
> | (encode-coding-string variable-to-pass 'iso-latin-1)
What is your default locale's codeset on that system? In general, if
the default locale matches the encoding you need to use, the above
should happen automagically.
> For strings with other Unicode characters like "–" (#x2013),
> I need to call groff's preconv like:
>
> | (shell-command-to-string (concat "preconv -r <(echo " (shell-quote-argument variable-to-pass) ")"))
>
> which for "ä–ö" returns something like:
>
> | \[u00E4]\[u2013]\[u00F6]
This is just the original "ä–ö" string, so I'm not quite sure what did
the above accomplish.
> Now in Emacs, this looks very much like what a coding system
> would do. The info documentation for elisp just laconically
> says:
>
> | How to define a coding system is an arcane matter, and is not
> | documented here.
>
> Has someone implemented such a coding system for groff so
> that something like:
>
> | (encode-coding-string variable-to-pass 'x-groff)
I don't think you should need a new coding-system. But you didn't
explain why you need to explicitly encode the command-line arguments,
so it's hard to give an accurate advice. What kind of Groff command
needs this jumping through hoops from you? E.g., why isn't it enough
to bind coding-system-for-write to whatever you need, around the call
to call-process or whatever?
IOW, please describe in more detail the Groff-related context in which
this problem happens, so that we could have an intelligent discussion
of the issues you might have.
next prev parent reply other threads:[~2021-09-29 12:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 8:01 Coding system to encode arguments to groff? Tim Landscheidt
2021-09-29 12:02 ` Eli Zaretskii [this message]
2021-10-03 13:14 ` Tim Landscheidt
2021-10-03 15:14 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83o88bio7g.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.