>From 6bb3d7c1a81349fc5fdd7e09f012ef7303408cf4 Mon Sep 17 00:00:00 2001 From: Eliza Velasquez <4576666+elizagamedev@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:53:47 -0700 Subject: [PATCH 2/4] po-mode.el: Make subedit terminator "<" optional --- gettext-tools/emacs/po-mode.el | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gettext-tools/emacs/po-mode.el b/gettext-tools/emacs/po-mode.el index c81e4d260..171dc0bf3 100644 --- a/gettext-tools/emacs/po-mode.el +++ b/gettext-tools/emacs/po-mode.el @@ -480,6 +480,16 @@ or remove the -m if you are not using the GNU version of 'uuencode'." (defvar po-subedit-mode-syntax-table (copy-syntax-table text-mode-syntax-table) "Syntax table used while in PO mode.") + +(defcustom po-subedit-mode-use-terminator t + "Whether to use the terminator in subedit mode. +The terminator is a \"<\" character which is inserted in +`po-subedit-mode' to allow the translator to carefully control +trailing whitespace in a string. See the gettext manual for +details." + :type 'boolean + :group 'po + :local t) ;;; Emacs portability matters - part II. @@ -2213,7 +2223,8 @@ When done with the `ediff' session press \\[exit-recursive-edit] exit to (interactive) (goto-char (point-max)) (skip-chars-backward " \t\n") - (if (eq (preceding-char) ?<) + (if (and po-subedit-mode-use-terminator + (eq (preceding-char) ?<)) (delete-region (1- (point)) (point-max))) (run-hooks 'po-subedit-exit-hook) (let ((string (buffer-string))) @@ -2239,7 +2250,8 @@ When done with the `ediff' session press \\[exit-recursive-edit] exit to "Prepare a pop up buffer for editing STRING, which is of a given TYPE. TYPE may be 'comment or 'msgstr. If EXPAND-TABS, expand tabs to spaces. Run functions on po-subedit-mode-hook." - (let ((marker (make-marker))) + (let ((marker (make-marker)) + (subedit-use-terminator po-subedit-mode-use-terminator)) (set-marker marker (cond ((eq type 'comment) po-start-of-msgid) ((eq type 'msgstr) po-start-of-msgstr-form))) (if (po-check-for-pending-edit marker) @@ -2270,7 +2282,9 @@ Run functions on po-subedit-mode-hook." (setq buffer-file-coding-system edit-coding) (setq local-abbrev-table po-mode-abbrev-table) (erase-buffer) - (insert string "<") + (insert string) + (when subedit-use-terminator + (insert "<")) (goto-char (point-min)) (and expand-tabs (setq indent-tabs-mode nil)) (use-local-map po-subedit-mode-map) -- 2.40.1