;ELC ;;; compiled by kwzh@nutrimat.gnu.ai.mit.edu on Sun Jul 21 15:50:41 1996 ;;; from file /gd/gnu/emacs/19.0/lisp/executable.el ;;; emacs version 19.31.94.1. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`executable.el' was compiled for Emacs 19.29 or later")) #@464 *What to do when newly found file has no or wrong magic number: nil do nothing t insert or update magic number other insert or update magic number, but mark as unmodified. When the insertion is marked as unmodified, you can save it with \[write-file] RET. This variable is used when `executable-set-magic' is called as a function, e.g. when Emacs sets some Un*x interpreter script mode. With \[executable-set-magic], this is always treated as if it were `t'. (defvar executable-insert (quote not-modified) (#$ . -485)) #@133 *If non-`nil', ask user before inserting or changing magic number. When this is `function', only ask when called non-interactively. (defvar executable-query (quote function) (#$ . -1015)) #@67 *On files with this kind of name no magic is inserted or changed. (defvar executable-magicless-file-regexp "/[Mm]akefile$\\|/\\.\\(z?profile\\|bash_profile\\|z?login\\|bash_login\\|z?logout\\|bash_logout\\|.+shrc\\|esrc\\|rcrc\\|[kz]shenv\\)$" (#$ . -1209)) #@75 *Interpreter magic number prefix inserted when there was no magic number. (defvar executable-prefix "#! " (#$ . -1473)) #@251 *After saving, if the file is not executable, set this mode. This mode passed to `set-file-modes' is taken absolutely when negative, or relative to the files existing modes. Do nothing if this is nil. Typical values are 73 (+x) or -493 (rwxr-xr-x). (defvar executable-chmod 73 (#$ . -1600)) (byte-code "ÀÁ!„ÂÁ B‡" [boundp executable-command nil current-load-list] 2) #@144 *Command you use with argument `+2' to make text files self-display. Note that the like of `more' doesn't work too well under Emacs \[shell]. (defvar executable-self-display "tail" (#$ . -1980)) #@137 *Rules for highlighting executable scripts' magic number. This can be included in `font-lock-keywords' by modes that call `executable'. (defvar executable-font-lock-keywords (quote (("\\`#!.*/\\([^ \n]+\\)" 1 font-lock-keyword-face t))) (#$ . -2183)) #@85 Alist of regexps used to match script errors. See `compilation-error-regexp-alist'. (defvar executable-error-regexp-alist (quote (("^\\(.*[^[/]\\)\\(\\[[0-9]+\\]\\)?: .* error .* line \\([0-9]+\\)" 1 3) ("^\\(.*[^/]\\)\\[\\([0-9]+\\)\\]: .*: " 1 2) ("^\\(.*[^/]\\): [^0-9\n]+\n\\1: \\1: line \\([0-9]+\\):" 1 2) (" error .* line \\([0-9]+\\) of file \\(.+\\)$" 2 1) ("^[^ ].+\n\\( .+\n\\)* line \\([0-9]+\\) of file \\(.+\\)$" 3 2) ("^\\(.+\\):\\([0-9]+\\): " 1 2))) (#$ . 2441)) #@128 Search for COMMAND in exec-path and return the absolute file name. Return nil if COMMAND is not found anywhere in `exec-path'. (defalias 'executable-find #[(command) "Á‰ƒ)Ä @\"‰…Æ\n!…Ç\n!??…$Á A‰„\n*‡" [exec-path nil file list expand-file-name command file-executable-p file-directory-p] 4 (#$ . 2928)]) #@170 This gets called after saving a file to assure that it be executable. You can set the absolute or relative mode in variable `executable-chmod' for non-executable files. (defalias 'executable-chmod #[nil "…\" …\" !†\"à ÄWƒ[‚!ÅÆ !\"\"‡" [executable-chmod buffer-file-name file-executable-p set-file-modes 0 logior file-modes] 6 (#$ . 3254)]) #@166 Run script with user-specified args, and collect output in a buffer. While script runs asynchronously, you can use the \[next-error] command to find the next error. (defalias 'executable-interpret #[(command) "ÀÁ!ˆÂ ?!ˆÄÅ!ˆÆ‰ÈÉÊ %‡" [require compile save-some-buffers compilation-ask-about-save make-local-variable executable-command compile-internal command "No more errors." "Interpretation" nil executable-error-regexp-alist] 6 (#$ . 3612) (list (read-string "Run script: " (or executable-command buffer-file-name)))]) #@293 Set this buffer's interpreter to INTERPRETER with optional ARGUMENT. The variables `executable-magicless-file-regexp', `executable-prefix', `executable-insert', `executable-query' and `executable-chmod' control when and how magic numbers are inserted or replaced and scripts made executable. (defalias 'executable-set-magic #[(interpreter &optional argument no-query-flag insert-flag) "À !ƒ\n ‚ !†ÃÄ \"‰ …!Æ ™…!Ç Q„® ƒ7Ê  \"„®\f„A ƒ®eÎV„®ŠÏ Ð ebˆÒÓ!ˆÔÓÕÖ×$ˆØÙ!ƒžÎ”bƒ­Î•SfÚU„­ `Ε{˜„­ƒ‹„‹Ý‹ƒ­Þ ׉ÖÎ%ˆßà! P\"ˆ‚­! ⱈßà! P\"ˆ+ ‡" [file-name-absolute-p interpreter executable-find error "Interpreter %s not recognized" argument "" " " buffer-read-only buffer-file-name string-match executable-magicless-file-regexp insert-flag executable-insert 1 point-marker buffer-modified-p point make-local-hook after-save-hook add-hook executable-chmod nil t looking-at "#![ ]*\\(.*\\)$" 32 executable-query no-query-flag ((byte-code "Àp!ˆÁ \fÅR!‡" [switch-to-buffer y-or-n-p "Replace magic number by `" executable-prefix argument "'? "] 5)) replace-match message "Magic number changed to `%s'" executable-prefix 10] 7 (#$ . 4145) (let* ((name (read-string "Name or file name of interpreter: ")) (arg (read-string (format "Argument for %s: " name)))) (list name arg (eq executable-query (quote function)) t))]) #@121 Turn a text file into a self-displaying Un*x command. The magic number of such a command displays all lines but itself. (defalias 'executable-self-display #[nil "Á=ƒÂ Ã\"‡" [this-command executable-self-display executable-set-magic "+2"] 3 (#$ . 5493) nil]) (provide (quote executable))