Package: gettext-el
Version: 0.17-4
Severity: important

Hello,

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).

Bye,

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-openvz-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=UTF-8 (charmap=UTF-8) (ignored: LC_ALL set 
to fr_FR.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gettext-el depends on:
ii  emacs-snapshot [emacsen]    1:20081018-1 The GNU Emacs editor (development 
ii  emacs22 [emacsen]           22.2+2-4     The GNU Emacs editor
ii  gettext                     0.17-4       GNU Internationalization utilities

gettext-el recommends no packages.

gettext-el suggests no packages.

-- no debconf information

--
  intrigeri <[EMAIL PROTECTED]>
  | gnupg key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
  | Then we'll come from the shadows.

--- /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.

Reply via email to