[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#137353: gettext: po mode error (fwd)
From: |
Karl Eichwalder |
Subject: |
Re: Bug#137353: gettext: po mode error (fwd) |
Date: |
Sat, 09 Mar 2002 06:28:56 +0100 |
User-agent: |
Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i686-pc-linux-gnu) |
Karl Eichwalder <address@hidden> writes:
> address@hidden (Santiago Vila) writes:
>
>> I can reproduce it by doing
>>
>> emacs21
Honestly, I don't understand why Emacs thinks 'filename' evals to 1 when
you try to edit a non-existing file. Somebody else must take a look,
please; I don't understand all this Emacs coding detection magic.
Applying the following patch (against po-mode.el in gettext CVS), you
can work wround the problem creating an empty PO file outside of Emacs:
touch empty_file.po
emacs empty_file.po
or
echo > empty_file.po
emacs empty_file
Please test how XEmacs behaves.
2002-03-09 Karl Eichwalder <address@hidden>
* po-mode.el (po-find-file-coding-system-guts): Don't try to
detect the coding system when filename does not exists.
(po-compute-counters): Search for "^msgid" not 'po-next-entry' if
you don't know for sure any entry will follow at all.
*** po-mode.el.~1.64.~ Wed Feb 20 07:13:17 2002
--- po-mode.el Sat Mar 9 06:15:32 2002
***************
*** 964,970 ****
"\
Return a Mule (DECODING . ENCODING) pair, according to PO file charset.
Called through file-coding-system-alist, before the file is visited for real."
! (and (eq operation 'insert-file-contents)
(po-with-temp-buffer
(let ((coding-system-for-read 'no-conversion))
(let* ((charset (or (po-find-charset filename)
--- 964,971 ----
"\
Return a Mule (DECODING . ENCODING) pair, according to PO file charset.
Called through file-coding-system-alist, before the file is visited for real."
! (and (file-exists-p filename)
! (eq operation 'insert-file-contents)
(po-with-temp-buffer
(let ((coding-system-for-read 'no-conversion))
(let* ((charset (or (po-find-charset filename)
***************
*** 1197,1229 ****
;; While counting, skip the header entry, for consistency with msgfmt.
(po-find-span-of-entry)
(if (string-equal (po-get-msgid nil) "")
! (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) current) (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
--- 1198,1231 ----
;; While counting, skip the header entry, for consistency with msgfmt.
(po-find-span-of-entry)
(if (string-equal (po-get-msgid nil) "")
! (goto-char po-end-of-entry))
! (if (re-search-forward "^msgid" (point-max) t)
! (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) current) (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
--
address@hidden (work) / address@hidden (home): |
http://www.suse.de/~ke/ | ,__o
Free Translation Project: | _-\_<,
http://www.iro.umontreal.ca/contrib/po/HTML/ | (*)/'(*)