From: Bruno Haible Date: Mon, 25 Jun 2001 18:25:34 +0000 (+0000) Subject: Make po-find-file-coding-system work in XEmacs as well. X-Git-Tag: v0.11~640 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=606264aa1c003db24aac3e5055a41d5cfc06091d;p=thirdparty%2Fgettext.git Make po-find-file-coding-system work in XEmacs as well. --- diff --git a/misc/ChangeLog b/misc/ChangeLog index eb98ac334..9486588c0 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,9 @@ +2001-06-25 Bruno Haible + + * po-mode.el (po-find-file-coding-system): Make it work in XEmacs 20 + as well. Based on a patch by Enrico Scholz + . + 2001-06-04 Karl Eichwalder * po-mode.el (po-edit-string): Set 'buffer-file-coding-system' diff --git a/misc/po-mode.el b/misc/po-mode.el index 47fc49389..dec24aeb2 100644 --- a/misc/po-mode.el +++ b/misc/po-mode.el @@ -697,16 +697,15 @@ Content-Type into a Mule coding system.") ;;; Mode activation. (eval-and-compile - (if po-EMACS20 - - (defun po-find-file-coding-system (arg-list) + (if (or po-EMACS20 po-XEMACS) + (defun po-find-file-coding-system-guts (operation filename) "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 (car arg-list) 'insert-file-contents) + (and (eq operation 'insert-file-contents) (with-temp-buffer (let ((coding-system-for-read 'no-conversion)) ;; Is 4096 enough? FIXME: Retry as needed! - (insert-file-contents (nth 1 arg-list) nil 0 4096) + (insert-file-contents filename nil 0 4096) (if (re-search-forward "^\"Content-Type: text/plain;[ \t]*charset=\\([^\\]+\\)" nil t) @@ -719,9 +718,21 @@ Called through file-coding-system-alist, before the file is visited for real." (if (memq charset-lower (coding-system-list)) charset-lower 'no-conversion)))) - '(no-conversion)))))) + '(no-conversion))))))) + + (if po-EMACS20 + (defun po-find-file-coding-system (arg-list) + "Return a Mule (DECODING . ENCODING) pair, according to PO file charset. +Called through file-coding-system-alist, before the file is visited for real." + (po-find-file-coding-system-guts (car arg-list) (car (cdr arg-list))))) + + (if po-XEMACS + (defun po-find-file-coding-system (operation filename) + "Return a Mule (DECODING . ENCODING) pair, according to PO file charset. +Called through file-coding-system-alist, before the file is visited for real." + (po-find-file-coding-system-guts operation filename))) - )) + ) (defvar po-mode-map nil "Keymap for PO mode.")