[Top][All Lists]

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

Re: using libmagic in Emacs?

From: Eli Zaretskii
Subject: Re: using libmagic in Emacs?
Date: Fri, 21 Aug 2009 21:42:35 +0300

> From: address@hidden
> Cc: address@hidden, address@hidden, address@hidden
> Date: Fri, 21 Aug 2009 19:38:15 +0200
> Renamed entry point to libmagic-file-internal since its meant to be
> of internal usage for a lisp wrapper, yet to be written. Should that be
> a new file BTW?

files.el sounds good enough to me.

> I'm habing trouble remembering not to use c99. Is there some convenient
> compiler flag to force lower versions?

I think -std=c89 should do what you want (assuming you use GCC).

> I described a bit more in the doc string. Ok?

I suggest the following variation of it:

         doc: /* Return a list describing the argument FILE-OR-BUFFER.

  If FILE-OR-BUFFER is a file name, return information about that file.
  If FILE-OR-BUFFER is a buffer, return information about the buffer's file.

  The return value is a list of the form 


  MIME-TYPE and MIME-ENCODING are the MIME type and encoding suitable
  for the file's contents, as determined by libmagic.
  DESCRIPTION is the human readable descripton of the file type offered by

  The function throws a file-error if libmagic cannot determine one of
  the elements of the above list.

  The default libmagic database is used, and the quality of information
  given depends on your version of that database.  Often the MIME type is
  less exact than the description.  */)

Two more comments:

 . I am not sure you need to push the file-or-buffer dichotomy to the
   C level.  It is easy enough to do that in Lisp, or even in the
   application, for that matter.  Why complicate a primitive to do
   such a simple job?

 . You didn't say in the doc string whether MIME-ENCODING is
   guaranteed to be a valid Emacs coding-system.  I think a user will
   be desperate to know that.

Thanks for working on this.

reply via email to

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