+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.
(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)
(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))
(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."