Stefan Monnier writes: >>> I think it's a good idea. It may require some non-trivial changes on >>> the Lisp side, since libmagic's information is not quite the same as >>> what Emacs currently uses: we'll probably want to use libmagic to get >>> a MIME-type and then have a table mapping mime-types to major modes or >>> some such. > >> I attach an early draft filemagic patch. > >> Some notes: > >> - The mime type info usualy is less granular than the free >> text info: > > We can provide both. I think we'd want 2 functions: one to get the free > text info, which just returns a string (or nil), and another to get the > MIME info, which returns a cons, whose car is a symbol such as > application/octet-stream, and whose cdr is an alist representing > the additional optional info. > >> file --mime /tmp/tst.xcf >> /tmp/tst.xcf: application/octet-stream; charset=binary > > This would look like (application/octet-stream (charset . "binary")) > > A few more comments: > - please follow the GNU coding convention. I.e. put spaces where > they need to be (e.g. around parens and operators). > - don't bother with a new file. Just put it into fileio.c. > - as someone else mentioned, CPP macros in the Makefile.in are things > we'd like to get rid of, so please don't put more of them there. > Use autoconf's m4 macros instead, thank you. > > > Stefan Find attached a new slightly improved patch according to the suggestions of the list. However, I see now I didnt properly read your text above, the function I wrote now returns a list with 3 elements, (MIME_TYPE MIME_ENCODING DESCRIPTION). Do we still need 2 functions as you write above?