bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

po-mode.el: M-x po-mode inserts header if buffer is narrowed


From: Sven Joachim
Subject: po-mode.el: M-x po-mode inserts header if buffer is narrowed
Date: Tue, 29 Aug 2006 07:20:39 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060812)

In po-mode.el, there is a small bug in the function
po-check-file-header.  If the buffer is narrowed, M-x po-mode can
insert a header even if the buffer already has one in its not
currently visible part.  Attached is a patch which fixes this (tested
only with Emacs 21 and 22, but I'm certain it will work in XEmacs
too).  I'm using po-mode 2.02 shipped with gettext 0.15.


diff -uw po-mode.el{~,}
--- po-mode.el~ 2006-08-28 12:40:34.000000000 +0200
+++ po-mode.el  2006-08-28 12:41:12.000000000 +0200
@@ -1226,6 +1226,8 @@
 (defun po-check-file-header ()
   "Create a missing PO mode file header, or replace an oldish one."
   (save-excursion
+    (save-restriction    
+      (widen)
     (let ((buffer-read-only po-read-only)
          insert-flag end-of-header)
       (goto-char (point-min))
@@ -1257,7 +1259,7 @@
          (progn
            (insert po-default-file-header)
            (if (not (eobp))
-               (insert "\n")))))))
+                 (insert "\n"))))))))
 
 (defun po-replace-revision-date ()
   "Replace the revision date by current time in the PO file header."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]