+2001-08-12 François Pinard <pinard@iro.umontreal.ca>
+
+ * po-mode.el (po-find-charset, po-compute-counters,
+ po-check-file-header, po-set-msgstr): Emacs 19 portability matters.
+
+2000-01-03 François Pinard <pinard@iro.umontreal.ca>
+
+ * po-mode.el (po-check-file-header): Add a new line after default
+ header only for non-empty PO files.
+
1999-12-10 François Pinard <pinard@iro.umontreal.ca>
* po-mode.el (po-send-mail): Clarify some prompts.
\f
;;; Emacs portability matters - part II.
-;;; Many portability matters are addressed in this page. All other cases
-;;; involve one of `eval-and-compile' or `fboundp', just search for these.
+;;; Many portability matters are addressed in this page. The few remaining
+;;; cases, elsewhere, all involve `eval-and-compile', `boundp' or `fboundp'.
;; Protect string comparisons from text properties if possible.
(eval-and-compile
;; value was loaded. Load the next 1024 bytes; if charset still
;; isn't available, give up.
(insert-file-contents filename nil (point) (+ (point) 1024)))
- (when (re-search-forward po-charset nil t)
- (match-string 1))))))
+ (if (re-search-forward po-charset nil t)
+ (match-string 1))))))
(eval-and-compile
(if (or po-EMACS20 po-XEMACS)
(goto-char (point-min))
;; While counting, skip the header entry, for consistency with msgfmt.
(po-find-span-of-entry)
- (when (string= (po-get-msgid nil) "")
+ (if (string= (po-get-msgid nil) "")
(po-next-entry))
;; Start counting
(while (re-search-forward po-any-msgstr-regexp nil t)
;; Not a single entry found.
(setq insert-flag t))
(goto-char (point-min))
- (and insert-flag (insert po-default-file-header "\n")))))
+ (if insert-flag
+ (progn
+ (insert po-default-file-header)
+ (if (not (eobp))
+ (insert "\n")))))))
(defun po-replace-revision-date ()
"Replace the revision date by current time in the PO file header."
(save-excursion
(goto-char po-start-of-entry)
(save-excursion ; check for an indexed msgstr
- (when (re-search-forward po-msgstr-idx-keyword-regexp
- po-end-of-entry t)
- (setq msgstr-idx (buffer-substring-no-properties
- (match-beginning 0) (match-end 0)))))
+ (if (re-search-forward po-msgstr-idx-keyword-regexp
+ po-end-of-entry t)
+ (setq msgstr-idx (buffer-substring-no-properties
+ (match-beginning 0) (match-end 0)))))
(re-search-forward po-any-msgstr-regexp po-end-of-entry)
(and (not (string-equal (po-match-string 0) string))
(let ((buffer-read-only po-read-only))
(po-decrease-type-counter)
(replace-match string t t)
(goto-char (match-beginning 0))
- (unless (eq msgstr-idx nil) ; hack: replace msgstr with msgstr[d]
- (progn
- (insert msgstr-idx)
- (looking-at "\\(#~[ \t]*\\)?msgstr")
- (replace-match "")))
+ (if (eq msgstr-idx nil) ; hack: replace msgstr with msgstr[d]
+ nil
+ (insert msgstr-idx)
+ (looking-at "\\(#~[ \t]*\\)?msgstr")
+ (replace-match ""))
(goto-char po-start-of-msgid)
(po-find-span-of-entry)
(po-increase-type-counter)