From: Bruno Haible Date: Mon, 25 Jun 2001 16:06:22 +0000 (+0000) Subject: Fix for coding in subedit mode, and check for msgfmt version. X-Git-Tag: v0.11~645 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a917df7f77e9122a978ecdbc6d2d9165ace64ff9;p=thirdparty%2Fgettext.git Fix for coding in subedit mode, and check for msgfmt version. --- diff --git a/misc/ChangeLog b/misc/ChangeLog index 5ab3df57a..eb98ac334 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,16 @@ +2001-06-04 Karl Eichwalder + + * po-mode.el (po-edit-string): Set 'buffer-file-coding-system' + (for hints thanks to Eli Zaretskii). + +2001-06-04 Karl Eichwalder + + * 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 * gettext-0.10.38 released. diff --git a/misc/po-mode.el b/misc/po-mode.el index 9061b0704..47fc49389 100644 --- a/misc/po-mode.el +++ b/misc/po-mode.el @@ -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."