lisp revision 298920
1189251Ssam
2189251Ssam#------------------------------------------------------------------------------
3189251Ssam# $File: lisp,v 1.24 2015/11/30 20:54:26 christos Exp $
4189251Ssam# lisp:  file(1) magic for lisp programs
5189251Ssam#
6189251Ssam# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com)
7189251Ssam
8189251Ssam# updated by Joerg Jenderek
9189251Ssam# GRR: This lot is too weak
10189251Ssam#0	string	;;			
11189251Ssam# windows INF files often begin with semicolon and use CRLF as line end
12189251Ssam# lisp files are mainly created on unix system with LF as line end
13189251Ssam#>2	search/4096	!\r		Lisp/Scheme program text
14189251Ssam#>2	search/4096	\r		Windows INF file
15189251Ssam
16189251Ssam0	search/4096	(setq\ 			Lisp/Scheme program text
17189251Ssam!:mime	text/x-lisp
18189251Ssam0	search/4096	(defvar\ 		Lisp/Scheme program text
19189251Ssam!:mime	text/x-lisp
20189251Ssam0	search/4096	(defparam\ 		Lisp/Scheme program text
21189251Ssam!:mime	text/x-lisp
22189251Ssam0	search/4096	(defun\  		Lisp/Scheme program text
23189251Ssam!:mime	text/x-lisp
24189251Ssam0	search/4096	(autoload\ 		Lisp/Scheme program text
25189251Ssam!:mime	text/x-lisp
26189251Ssam0	search/4096	(custom-set-variables\ 	Lisp/Scheme program text
27189251Ssam!:mime	text/x-lisp
28189251Ssam
29189251Ssam# URL: https://en.wikipedia.org/wiki/Emacs_Lisp
30189251Ssam# Reference: http://ftp.gnu.org/old-gnu/emacs/elisp-manual-18-1.03.tar.gz
31189251Ssam# Update: Joerg Jenderek 
32189251Ssam# Emacs 18 - this is always correct, but not very magical.
33189251Ssam0	string	\012(			
34189251Ssam# look for emacs lisp keywords
35189251Ssam# GRR: split regex because it is too long or get error like
36189251Ssam# lisp, 36: Warning: cannot get string from `^(defun|defvar|defconst|defmacro|setq|fset|put|provide|require|'
37189251Ssam>&0	regex	\^(defun|defvar|defconst|defmacro|setq|fset)	Emacs v18 byte-compiled Lisp data
38189251Ssam!:mime	application/x-elc
39189251Ssam# https://searchcode.com/codesearch/view/2173420/
40189251Ssam# not really pure text
41189251Ssam!:apple	EMAxTEXT
42189251Ssam!:ext elc
43189251Ssam# remaining regex
44189251Ssam>&0	regex	\^(put|provide|require|random)	Emacs v18 byte-compiled Lisp data
45189251Ssam!:mime	application/x-elc
46189251Ssam!:apple	EMAxTEXT
47189251Ssam!:ext elc
48189251Ssam# missed cl.elc dbx.elc simple.elc look like normal lisp starting with ;;;
49189251Ssam
50189251Ssam# Emacs 19+ - ver. recognition added by Ian Springer
51189251Ssam# Also applies to XEmacs 19+ .elc files; could tell them apart with regexs
52189251Ssam# - Chris Chittleborough <cchittleborough@yahoo.com.au>
53189251Ssam# Update: Joerg Jenderek 
54189251Ssam0	string	;ELC	
55189251Ssam# version\0\0\0
56189251Ssam>4	byte	>18			Emacs/XEmacs v%d byte-compiled Lisp data
57189251Ssam# why less than 32 ? does not make sense to me. GNU Emacs version is 24.5 at April 2015
58189251Ssam#>4	byte    <32			Emacs/XEmacs v%d byte-compiled Lisp data
59189251Ssam!:mime	application/x-elc		
60189251Ssam!:apple	EMAxTEXT
61189251Ssam!:ext elc
62189251Ssam
63189251Ssam# Files produced by CLISP Common Lisp From: Bruno Haible <haible@ilog.fr>
64189251Ssam0	string	(SYSTEM::VERSION\040'	CLISP byte-compiled Lisp program (pre 2004-03-27)
65189251Ssam0	string	(|SYSTEM|::|VERSION|\040'	CLISP byte-compiled Lisp program text
66214734Srpaulo
67189251Ssam0	long	0x70768BD2		CLISP memory image data
68189251Ssam0	long	0xD28B7670		CLISP memory image data, other endian
69189251Ssam
70189251Ssam#.com and .bin for MIT scheme 
71189251Ssam0	string	\372\372\372\372	MIT scheme (library?)
72189251Ssam
73# From: David Allouche <david@allouche.net>
740	search/1	\<TeXmacs|	TeXmacs document text
75!:mime	text/texmacs
76