1b6cee71dSXin LI 2b6cee71dSXin LI#------------------------------------------------------------------------------ 3*ae316d1dSXin LI# $File: lisp,v 1.28 2024/05/30 15:32:20 christos Exp $ 4b6cee71dSXin LI# lisp: file(1) magic for lisp programs 5b6cee71dSXin LI# 6b6cee71dSXin LI# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com) 7b6cee71dSXin LI 8b6cee71dSXin LI# updated by Joerg Jenderek 9b6cee71dSXin LI# GRR: This lot is too weak 10b6cee71dSXin LI#0 string ;; 11b6cee71dSXin LI# windows INF files often begin with semicolon and use CRLF as line end 12b6cee71dSXin LI# lisp files are mainly created on unix system with LF as line end 13b6cee71dSXin LI#>2 search/4096 !\r Lisp/Scheme program text 14b6cee71dSXin LI#>2 search/4096 \r Windows INF file 15b6cee71dSXin LI 16b6cee71dSXin LI0 search/4096 (setq\ Lisp/Scheme program text 17b6cee71dSXin LI!:mime text/x-lisp 18b6cee71dSXin LI0 search/4096 (defvar\ Lisp/Scheme program text 19b6cee71dSXin LI!:mime text/x-lisp 20b6cee71dSXin LI0 search/4096 (defparam\ Lisp/Scheme program text 21b6cee71dSXin LI!:mime text/x-lisp 22b6cee71dSXin LI0 search/4096 (defun\ Lisp/Scheme program text 23b6cee71dSXin LI!:mime text/x-lisp 24b6cee71dSXin LI0 search/4096 (autoload\ Lisp/Scheme program text 25b6cee71dSXin LI!:mime text/x-lisp 26b6cee71dSXin LI0 search/4096 (custom-set-variables\ Lisp/Scheme program text 27b6cee71dSXin LI!:mime text/x-lisp 28b6cee71dSXin LI 293e41d09dSXin LI# URL: https://en.wikipedia.org/wiki/Emacs_Lisp 3048c779cdSXin LI# Reference: https://ftp.gnu.org/old-gnu/emacs/elisp-manual-18-1.03.tar.gz 313e41d09dSXin LI# Update: Joerg Jenderek 32b6cee71dSXin LI# Emacs 18 - this is always correct, but not very magical. 333e41d09dSXin LI0 string \012( 343e41d09dSXin LI# look for emacs lisp keywords 353e41d09dSXin LI# GRR: split regex because it is too long or get error like 363e41d09dSXin LI# lisp, 36: Warning: cannot get string from `^(defun|defvar|defconst|defmacro|setq|fset|put|provide|require|' 373e41d09dSXin LI>&0 regex \^(defun|defvar|defconst|defmacro|setq|fset) Emacs v18 byte-compiled Lisp data 38b6cee71dSXin LI!:mime application/x-elc 393e41d09dSXin LI# https://searchcode.com/codesearch/view/2173420/ 403e41d09dSXin LI# not really pure text 413e41d09dSXin LI!:apple EMAxTEXT 423e41d09dSXin LI!:ext elc 433e41d09dSXin LI# remaining regex 443e41d09dSXin LI>&0 regex \^(put|provide|require|random) Emacs v18 byte-compiled Lisp data 453e41d09dSXin LI!:mime application/x-elc 463e41d09dSXin LI!:apple EMAxTEXT 473e41d09dSXin LI!:ext elc 483e41d09dSXin LI# missed cl.elc dbx.elc simple.elc look like normal lisp starting with ;;; 493e41d09dSXin LI 50b6cee71dSXin LI# Emacs 19+ - ver. recognition added by Ian Springer 51b6cee71dSXin LI# Also applies to XEmacs 19+ .elc files; could tell them apart with regexs 52b6cee71dSXin LI# - Chris Chittleborough <cchittleborough@yahoo.com.au> 533e41d09dSXin LI# Update: Joerg Jenderek 54b6cee71dSXin LI0 string ;ELC 553e41d09dSXin LI# version\0\0\0 563e41d09dSXin LI>4 byte >18 Emacs/XEmacs v%d byte-compiled Lisp data 573e41d09dSXin LI# why less than 32 ? does not make sense to me. GNU Emacs version is 24.5 at April 2015 583e41d09dSXin LI#>4 byte <32 Emacs/XEmacs v%d byte-compiled Lisp data 59b6cee71dSXin LI!:mime application/x-elc 603e41d09dSXin LI!:apple EMAxTEXT 613e41d09dSXin LI!:ext elc 62b6cee71dSXin LI 6343a5ec4eSXin LI# Files produced by GNU/Emacs pdumper 6443a5ec4eSXin LI0 string DUMPEDGNUEMACS GNU/Emacs pdumper image 6543a5ec4eSXin LI 66b6cee71dSXin LI# Files produced by CLISP Common Lisp From: Bruno Haible <haible@ilog.fr> 67b6cee71dSXin LI0 string (SYSTEM::VERSION\040' CLISP byte-compiled Lisp program (pre 2004-03-27) 68b6cee71dSXin LI0 string (|SYSTEM|::|VERSION|\040' CLISP byte-compiled Lisp program text 69b6cee71dSXin LI 70b6cee71dSXin LI0 long 0x70768BD2 CLISP memory image data 71b6cee71dSXin LI0 long 0xD28B7670 CLISP memory image data, other endian 72b6cee71dSXin LI 73b6cee71dSXin LI#.com and .bin for MIT scheme 74b6cee71dSXin LI0 string \372\372\372\372 MIT scheme (library?) 75b6cee71dSXin LI 76b6cee71dSXin LI# From: David Allouche <david@allouche.net> 77b6cee71dSXin LI0 search/1 \<TeXmacs| TeXmacs document text 78b6cee71dSXin LI!:mime text/texmacs 79*ae316d1dSXin LI 80*ae316d1dSXin LI# Chibi-Scheme 81*ae316d1dSXin LI0 string \a\achibi\n Chibi-Scheme memory image data 82*ae316d1dSXin LI>8 ubyte =0 \b, big-endian 83*ae316d1dSXin LI>>9 ubyte x \b, format version %d 84*ae316d1dSXin LI>>11 ubyte x \b.%d 85*ae316d1dSXin LI>8 ubyte >0 \b, little-endian 86*ae316d1dSXin LI>>8 ubyte x \b, format version %d 87*ae316d1dSXin LI>>10 ubyte x \b.%d 88*ae316d1dSXin LI>12 string x \b, ABI %s 89