1 2#------------------------------------------------------------------------------ 3# $File: lisp,v 1.28 2024/05/30 15:32:20 christos Exp $ 4# lisp: file(1) magic for lisp programs 5# 6# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com) 7 8# updated by Joerg Jenderek 9# GRR: This lot is too weak 10#0 string ;; 11# windows INF files often begin with semicolon and use CRLF as line end 12# lisp files are mainly created on unix system with LF as line end 13#>2 search/4096 !\r Lisp/Scheme program text 14#>2 search/4096 \r Windows INF file 15 160 search/4096 (setq\ Lisp/Scheme program text 17!:mime text/x-lisp 180 search/4096 (defvar\ Lisp/Scheme program text 19!:mime text/x-lisp 200 search/4096 (defparam\ Lisp/Scheme program text 21!:mime text/x-lisp 220 search/4096 (defun\ Lisp/Scheme program text 23!:mime text/x-lisp 240 search/4096 (autoload\ Lisp/Scheme program text 25!:mime text/x-lisp 260 search/4096 (custom-set-variables\ Lisp/Scheme program text 27!:mime text/x-lisp 28 29# URL: https://en.wikipedia.org/wiki/Emacs_Lisp 30# Reference: https://ftp.gnu.org/old-gnu/emacs/elisp-manual-18-1.03.tar.gz 31# Update: Joerg Jenderek 32# Emacs 18 - this is always correct, but not very magical. 330 string \012( 34# look for emacs lisp keywords 35# GRR: split regex because it is too long or get error like 36# lisp, 36: Warning: cannot get string from `^(defun|defvar|defconst|defmacro|setq|fset|put|provide|require|' 37>&0 regex \^(defun|defvar|defconst|defmacro|setq|fset) Emacs v18 byte-compiled Lisp data 38!:mime application/x-elc 39# https://searchcode.com/codesearch/view/2173420/ 40# not really pure text 41!:apple EMAxTEXT 42!:ext elc 43# remaining regex 44>&0 regex \^(put|provide|require|random) Emacs v18 byte-compiled Lisp data 45!:mime application/x-elc 46!:apple EMAxTEXT 47!:ext elc 48# missed cl.elc dbx.elc simple.elc look like normal lisp starting with ;;; 49 50# Emacs 19+ - ver. recognition added by Ian Springer 51# Also applies to XEmacs 19+ .elc files; could tell them apart with regexs 52# - Chris Chittleborough <cchittleborough@yahoo.com.au> 53# Update: Joerg Jenderek 540 string ;ELC 55# version\0\0\0 56>4 byte >18 Emacs/XEmacs v%d byte-compiled Lisp data 57# why less than 32 ? does not make sense to me. GNU Emacs version is 24.5 at April 2015 58#>4 byte <32 Emacs/XEmacs v%d byte-compiled Lisp data 59!:mime application/x-elc 60!:apple EMAxTEXT 61!:ext elc 62 63# Files produced by GNU/Emacs pdumper 640 string DUMPEDGNUEMACS GNU/Emacs pdumper image 65 66# Files produced by CLISP Common Lisp From: Bruno Haible <haible@ilog.fr> 670 string (SYSTEM::VERSION\040' CLISP byte-compiled Lisp program (pre 2004-03-27) 680 string (|SYSTEM|::|VERSION|\040' CLISP byte-compiled Lisp program text 69 700 long 0x70768BD2 CLISP memory image data 710 long 0xD28B7670 CLISP memory image data, other endian 72 73#.com and .bin for MIT scheme 740 string \372\372\372\372 MIT scheme (library?) 75 76# From: David Allouche <david@allouche.net> 770 search/1 \<TeXmacs| TeXmacs document text 78!:mime text/texmacs 79 80# Chibi-Scheme 810 string \a\achibi\n Chibi-Scheme memory image data 82>8 ubyte =0 \b, big-endian 83>>9 ubyte x \b, format version %d 84>>11 ubyte x \b.%d 85>8 ubyte >0 \b, little-endian 86>>8 ubyte x \b, format version %d 87>>10 ubyte x \b.%d 88>12 string x \b, ABI %s 89