[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#504356: gettext-el: duplicates gettext header with Emacs 23 (fwd
From: |
Bruno Haible |
Subject: |
Re: Bug#504356: gettext-el: duplicates gettext header with Emacs 23 (fwd) |
Date: |
Wed, 5 Nov 2008 01:00:05 +0100 |
User-agent: |
KMail/1.5.4 |
Hello Intrigeri,
> at least in Emacs 23, opening a PO file with po-mode unconditionally
> adds a new header on top of the file, even if one (or more... the
> problem is recursive) header is already present.
>
> This problem does not happen in Emacs 22, that's why I do not set this
> as grave, but I believe it deserves "important", because po-mode does
> not provide any easy way to remove this duplicate header: once the PO
> has been saved, I have to edit it with another editor to fix the mess.
>
> I've tracked down the issue to line 1346 (in po-check-file-header):
> (previous-line 1) moves to the end of the previous line, don't ask me
> why.
>
> The docstring for previous-line clearly says it should not be used
> blindly in a Lisp program:
>
> If you are thinking of using this in a Lisp program, consider using
> `forward-line' with a negative argument instead. It is usually easier
> to use and more reliable (no dependence on goal column, etc.).
>
> Replacing this with (forward-line -1) fixes the issue (one-liner patch
> attached).
>
> [ ... ]
>
> --- /usr/share/emacs/site-lisp/gettext/po-mode.el 2008-08-27
> 19:03:06.000000000 +0200
> +++ po-mode.el 2008-11-02 22:15:21.000000000 +0100
> @@ -1343,7 +1343,7 @@
> (progn
> ;; There is at least one entry.
> (goto-char (match-beginning 0))
> - (previous-line 1)
> + (forward-line -1)
> (setq end-of-header (match-end 0))
> (if (looking-at "msgid \"\"\n")
> ;; There is indeed a PO file header.
Thank you for the report and patch. It will be contained in the next
gettext release.
Santiago, feel free to patch the gettext-0.17 package in Debian with this
patch, as long as gettext 0.18 is not released.
Bruno