[Top][All Lists]

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

Re: using libmagic in Emacs?

From: Stefan Monnier
Subject: Re: using libmagic in Emacs?
Date: Fri, 21 Aug 2009 15:18:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

>> +  magic_setflags (cookie, MAGIC_MIME_ENCODING | MAGIC_ERROR);
>> +  rvs=magic_file (cookie, f);
>> +  if (rvs == NULL) goto libmagic_error;
>> +  Lisp_Object file_encoding = intern(rvs);  

> Is file_encoding supposed to be a valid encoding, one of those for
> which Emacs has a coding-system?  If so, perhaps you should make sure
> you indeed return a valid coding-system or its alias, or otherwise
> tell in the doc string that it's not guaranteed to be valid (so that
> the caller should validate it before using).

The simplest route is to return a string rather than a symbol.
That should clearly convey the idea that this may or may not be a valid


reply via email to

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