emacs-devel
[Top][All Lists]
Advanced

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

Re: PO files and Emacs


From: Andreas Schwab
Subject: Re: PO files and Emacs
Date: Mon, 11 Mar 2002 20:29:35 +0100
User-agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2.50 (ia64-suse-linux)

Karl Eichwalder <address@hidden> writes:

|> Eli Zaretskii <address@hidden> writes:
|> 
|> > Sure.  Karl, where do I get the version you suggest to include?
|> 
|> It was attached to my first mail.  I'll attach it here again as po.el,
|> plus this check:
|> 
|>     (file-exists-p (car (cdr arg-list)))
|> 
|> I also attach file-4.1.5.hu.po; loading this Hungarian file will set
|> the coding system to iso-8859-2/latin-2:
|> 
|>     emacs --no-site-file -q -l po.el file-4.1.5.hu.po
|> 
|> Now you can edit and save the file.  Starting with a non-existing file
|> emacs will produce an error message when you will try to save it:
|> 
|>     emacs --no-site-file -q -l po.el not-there.hu.po
|> 
|> Enter:
|> 
|>     # a comment line
|>     C-x C-s
|>     error--> and: Wrong type argument: stringp, 1

That's because your function is called with the same arguments as
find-operation-coding-system, which itself gets the same arguments as the
I/O primitives.  Those are, for file I/O, insert-file-contents and
write-region.  The latter has the signature

(write-region START END FILENAME &optional APPEND VISIT LOCKNAME MUSTBENEW)

which means that (car (cdr arg-list)) == START.  You should just move the
second test before the first one.

|> ;;;###autoload
|> (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."
|>   (and (file-exists-p (car (cdr arg-list)))
|>        (eq (car arg-list) 'insert-file-contents)

  (and (eq (car arg-list) 'insert-file-contents)
       (file-exists-p (car (cdr arg-list)))

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

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