summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-08-13 14:01:18 +0000
committerBruno Haible <bruno@clisp.org>2001-08-13 14:01:18 +0000
commit0584a629a07f1155d2350031218139bf6d871de7 (patch)
tree7ce4951a7f256c18b11ac040f6fcda94c8608d84 /misc
parent539824ee3b29c16790e0747a98ea6f5c33157abb (diff)
downloadexternal_gettext-0584a629a07f1155d2350031218139bf6d871de7.zip
external_gettext-0584a629a07f1155d2350031218139bf6d871de7.tar.gz
external_gettext-0584a629a07f1155d2350031218139bf6d871de7.tar.bz2
Fix error when invoking po-mode on an empty file.
Diffstat (limited to 'misc')
-rw-r--r--misc/ChangeLog7
-rw-r--r--misc/po-mode.el54
2 files changed, 35 insertions, 26 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog
index 6128a4a..5dfdb0d 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,3 +1,10 @@
+2001-08-02 Karl Eichwalder <ke@suse.de>
+
+ * po-mode.el (po-find-file-coding-system-guts): Use ascii instead of
+ none.
+ (po-compute-counters): Don't start counting if there is not even a
+ header entry.
+
2001-07-26 Bruno Haible <haible@clisp.cons.org>
* automake.diff: Update for automake-1.4-p5.
diff --git a/misc/po-mode.el b/misc/po-mode.el
index 2f987b2..25fb429 100644
--- a/misc/po-mode.el
+++ b/misc/po-mode.el
@@ -769,7 +769,7 @@ Called through file-coding-system-alist, before the file is visited for real."
(with-temp-buffer
(let ((coding-system-for-read 'no-conversion))
(let* ((charset (or (po-find-charset filename)
- "none"))
+ "ascii"))
(charset-upper (intern (upcase charset)))
(charset-lower (intern (downcase charset))))
(list (or (cdr (assq charset-upper
@@ -982,31 +982,33 @@ Then, update the mode line counters."
;; While counting, skip the header entry, for consistency with msgfmt.
(po-find-span-of-entry)
(if (string-equal (po-get-msgid nil) "")
- (po-next-entry))
- ;; Start counting
- (while (re-search-forward po-any-msgstr-regexp nil t)
- (and (= (% total 20) 0)
- (if flag
- (message (_"Position %d/%d") position total)
- (message (_"Position %d") total)))
- (setq here (point))
- (goto-char (match-beginning 0))
- (setq total (1+ total))
- (and flag (eq (point) po-start-of-msgstr) (setq position total))
- (cond ((eq (following-char) ?#)
- (setq po-obsolete-counter (1+ po-obsolete-counter)))
- ((looking-at po-untranslated-regexp)
- (setq po-untranslated-counter (1+ po-untranslated-counter)))
- (t (setq po-translated-counter (1+ po-translated-counter))))
- (goto-char here))
-
- ;; Make another pass just for the fuzzy entries, kind of kludgey.
- ;; FIXME: Counts will be wrong if untranslated entries are fuzzy, yet
- ;; this should not normally happen.
- (goto-char (point-min))
- (while (re-search-forward po-fuzzy-regexp nil t)
- (setq po-fuzzy-counter (1+ po-fuzzy-counter)))
- (setq po-translated-counter (- po-translated-counter po-fuzzy-counter)))
+ (if (po-next-entry)
+ (progn
+ ;; Start counting
+ (while (re-search-forward po-any-msgstr-regexp nil t)
+ (and (= (% total 20) 0)
+ (if flag
+ (message (_"Position %d/%d") position total)
+ (message (_"Position %d") total)))
+ (setq here (point))
+ (goto-char (match-beginning 0))
+ (setq total (1+ total))
+ (and flag (eq (point) po-start-of-msgstr) (setq position total))
+ (cond ((eq (following-char) ?#)
+ (setq po-obsolete-counter (1+ po-obsolete-counter)))
+ ((looking-at po-untranslated-regexp)
+ (setq po-untranslated-counter (1+ po-untranslated-counter)))
+ (t (setq po-translated-counter (1+ po-translated-counter))))
+ (goto-char here))
+
+ ;; Make another pass just for the fuzzy entries, kind of kludgey.
+ ;; FIXME: Counts will be wrong if untranslated entries are fuzzy, yet
+ ;; this should not normally happen.
+ (goto-char (point-min))
+ (while (re-search-forward po-fuzzy-regexp nil t)
+ (setq po-fuzzy-counter (1+ po-fuzzy-counter)))
+ (setq po-translated-counter (- po-translated-counter po-fuzzy-counter)))
+ '())))
;; Push the results out.
(if flag