]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix for coding in subedit mode, and check for msgfmt version.
authorBruno Haible <bruno@clisp.org>
Mon, 25 Jun 2001 16:06:22 +0000 (16:06 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 25 Jun 2001 16:06:22 +0000 (16:06 +0000)
misc/ChangeLog
misc/po-mode.el

index 5ab3df57a27c2656600b6ea347ae6cbad00d46ba..eb98ac334f20823c49edf15573869fad52965329 100644 (file)
@@ -1,3 +1,16 @@
+2001-06-04  Karl Eichwalder  <ke@suse.de>
+
+       * po-mode.el (po-edit-string): Set 'buffer-file-coding-system'
+       (for hints thanks to Eli Zaretskii).
+
+2001-06-04  Karl Eichwalder  <ke@suse.de>
+
+       * po-mode.el (po-msgfmt-version-check): New. Check for GNU gettext
+       0.10.36 or newer. Re-written by Stefan Monnier.
+       (po-validate): Use 'po-msgfmt-version-check'.
+       (po-validate): Use 'null-device' instead of literal "/dev/null".
+       Reported by Eli Zaretskii.
+
 2001-05-23  Bruno Haible  <haible@clisp.cons.org>
 
        * gettext-0.10.38 released.
index 9061b0704de8c9bd8b991d94314cd0929bc1cb77..47fc49389c546a21b0e83b8b2788a536d0740e1d 100644 (file)
@@ -1860,6 +1860,7 @@ Run functions on po-subedit-mode-hook."
     (if (po-check-for-pending-edit marker)
        (let ((edit-buffer (generate-new-buffer
                            (concat "*" (buffer-name) "*")))
+             (edit-coding buffer-file-coding-system)
              (buffer (current-buffer))
              overlay slot)
          (if (and (eq type 'msgstr) po-highlighting)
@@ -1879,6 +1880,7 @@ Run functions on po-subedit-mode-hook."
          (pop-to-buffer edit-buffer)
          (make-local-variable 'po-subedit-back-pointer)
          (setq po-subedit-back-pointer slot)
+         (setq buffer-file-coding-system edit-coding)
          (erase-buffer)
          (insert string "<")
          (goto-char (point-min))
@@ -2522,16 +2524,49 @@ keyword for subsequent commands, also added to possible completions."
 (defun po-validate ()
   "Use `msgfmt' for validating the current PO file contents."
   (interactive)
-
-  ;; If modifications were done already, change the last revision date.
-  (if (buffer-modified-p)
-      (po-replace-revision-date))
-
-  ;; This `let' is for protecting the previous value of compile-command.
-  (let ((compile-command (concat po-msgfmt-program
-                                " --statistics -c -v -o /dev/null "
-                                buffer-file-name)))
-    (compile compile-command)))
+  (let ((command (concat po-msgfmt-program
+                         " --statistics -c -v -o " null-device " "
+                         buffer-file-name)))
+
+    (po-msgfmt-version-check)
+
+    ;; If modifications were done already, change the last revision date.
+    (if (buffer-modified-p)
+        (po-replace-revision-date))
+
+    (compile command)))
+
+(defvar po-msgfmt-version-checked nil)
+(defun po-msgfmt-version-check ()
+  "`msgfmt' from GNU gettext 0.10.36 or greater is required."
+  (with-temp-buffer
+    (or
+     ;; Don't bother checking again.
+     po-msgfmt-version-checked
+
+     (and
+      ;; Make sure `msgfmt' is available.
+      (condition-case nil
+          (call-process po-msgfmt-program
+                       nil t nil "--verbose" "--version")
+       (file-error nil))
+
+      ;; Make sure there's a version number in the output.
+      (progn (goto-char (point-min))
+            (looking-at ".* \\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)$"))
+
+      ;; Make sure the version is recent enough.
+      (>= (string-to-int
+          (format "%d%03d%03d"
+                  (string-to-int (match-string 1))
+                  (string-to-int (match-string 2))
+                  (string-to-int (match-string 3))))
+         010036)
+
+      ;; Remember the outcome.
+      (setq po-msgfmt-version-checked t))
+
+     (error (_"`msgfmt' from GNU gettext 0.10.36 or greater is required")))))
 
 (defun po-guess-archive-name ()
   "Return the ideal file name for this PO file in the central archives."