bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] po-mode.el: fontification improvements and more


From: Eliza Velasquez
Subject: [PATCH] po-mode.el: fontification improvements and more
Date: Fri, 14 Jul 2023 13:48:37 -0700

Hello bug-gettext,

I have written a series of patches to po-mode.el which I think are
useful.

1.  Add support for `:local t' in `defcustom'.

Simple and necessary for the other patches.

2.  Make the trailing "<" terminator a configurable, optional feature.

It's certainly useful in some cases, but most of the time in the kinds
of translations I work on, it's not necessary and interferes with some
normal text editing workflows.  It's also a soft requirement for the
following patch.

3.  Add support for editing the msgstr in a configurable major mode
    other than `text-mode'.

This is really useful for translating something with heavy markup usage,
for example, HTML or Markdown.  Even C format strings could probably
benefit from this, assuming there's a major mode for it...

One potential issue with this change is that I replaced the usage of
`use-local-map' with the minor mode keybinding mechanism.  I don't know
if this is compatible with non-GNU Emacs.  I was really shocked at how
this package was so meticulously kept compatible non-GNU Emacs and
really old versions of GNU Emacs for all these years.  But it does make
it difficult to add new features like this (and especially the following
feature).  IMHO I think that the package is probably due for a refactor
targeting a minimum version of maybe GNU Emacs 24 at the earliest.  (Or
at the very least, whatever version of Emacs introduced
`define-minor-mode'...)  It's work I'm willing to take on if the
maintainers here agree :)

4.  Add support for fontification of msgids and msgstrs based on the
    configurable major mode introduced above.

This is the most significant patch out of the four and by far the most
likely to break compatibility with very old/non-GNU Emacs.  It uses a
similar technique to `org-mode' to fontify strings according to the
major mode introduced above.  (I referenced `org-mode' source code
heavily when implementing it.)  The end result, when dealing with
markup-heavy code, makes it a lot easier to catch mistakes/discrepancies
between formatting of the msgid and the msgstr.  For example, I often
forget to apply the correct style or color to a specific word or phrase,
and this kind of fontification lets me know at a glance whenever I make
a mistake.  This patch is still "work in progress" in as far as it's
fully implemented and working, but I would like feedback about the
implementation and compatibility concerns.

Regarding the copyright assignment, I sent in my paperwork a while ago
and am still waiting for the response from the FSF.  I can follow up
with them.

Attachment: 0001-po-mode.el-Add-support-for-local-in-defcustom.patch
Description: Text Data

Attachment: 0002-po-mode.el-Make-subedit-terminator-optional.patch
Description: Text Data

Attachment: 0003-po-mode.el-Allow-custom-major-mode-for-subedit.patch
Description: Text Data

Attachment: 0004-po-mode.el-Add-major-mode-based-fontification.patch
Description: Text Data

-- 
Eliza

reply via email to

[Prev in Thread] Current Thread [Next in Thread]