]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
po-mode: Improve po-get-msgstr-flavor.
authorBruno Haible <bruno@clisp.org>
Sat, 8 May 2010 17:51:45 +0000 (19:51 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 8 May 2010 17:55:43 +0000 (19:55 +0200)
gettext-tools/misc/ChangeLog
gettext-tools/misc/po-mode.el

index e0d6cdfcc73ffb44a08225aa813daf4481236abf..a1c9c3e0610684980d18680fc682f9a563af57ca 100644 (file)
@@ -1,3 +1,7 @@
+2010-05-08  Bruno Haible  <bruno@clisp.org>
+
+       * po-mode.el (po-get-msgstr-flavor): Preserve the point's position.
+
 2010-05-08  Noritada Kobayashi  <nori1@dolphin.c.u-tokyo.ac.jp>
 
        Fix failure of po-msgid-to-msgstr just after opening a buffer.
index 9111d681b3bdec1d8e5c48fbda41867853713a46..749a23bb818086e43eaffec34c97171c2063a3d4 100644 (file)
@@ -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."