From: Bruno Haible Date: Sat, 8 May 2010 17:51:45 +0000 (+0200) Subject: po-mode: Improve po-get-msgstr-flavor. X-Git-Tag: v0.18~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=213bb7008f1e0be9f608310361f554761744b3cd;p=thirdparty%2Fgettext.git po-mode: Improve po-get-msgstr-flavor. --- diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index e0d6cdfcc..a1c9c3e06 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,3 +1,7 @@ +2010-05-08 Bruno Haible + + * po-mode.el (po-get-msgstr-flavor): Preserve the point's position. + 2010-05-08 Noritada Kobayashi Fix failure of po-msgid-to-msgstr just after opening a buffer. diff --git a/gettext-tools/misc/po-mode.el b/gettext-tools/misc/po-mode.el index 9111d681b..749a23bb8 100644 --- a/gettext-tools/misc/po-mode.el +++ b/gettext-tools/misc/po-mode.el @@ -1892,10 +1892,12 @@ If FORM is itself a string, then this string is used for insertion." string)) (defun po-get-msgstr-flavor () - "Helper function to detect msgstr and msgstr[] variants." - (goto-char po-start-of-msgstr-form) - (re-search-forward "^\\(#~[ \t]*\\)?\\(msgstr\\(\\[[0-9]\\]\\)?\\)") - (match-string 2)) + "Helper function to detect msgstr and msgstr[] variants. +Returns one of \"msgstr\" or \"msgstr[i]\" for some i." + (save-excursion + (goto-char po-start-of-msgstr-form) + (re-search-forward "^\\(#~[ \t]*\\)?\\(msgstr\\(\\[[0-9]\\]\\)?\\)") + (match-string 2))) (defun po-get-msgstr-form () "Extract and return the unquoted msgstr string."