;ELC ;;; Compiled by cyd@localhost on Mon Apr 23 22:25:02 2007 ;;; from file /home/cyd/emacs/lisp/progmodes/executable.el ;;; in Emacs version 22.0.99 ;;; with all optimizations. ;;; Function definitions are lazy-loaded. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`executable.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (custom-declare-group 'executable nil "Base functionality for executable interpreter scripts." :group 'processes) #@245 *Non-nil means offer to add a magic number to a file. This takes effect when you switch to certain major modes, including Shell-script mode (`sh-mode'). When you type \[executable-set-magic], it always offers to add or update the magic number. (custom-declare-variable 'executable-insert 't '(#$ . -734) :type 'boolean :group 'executable) #@130 *If non-nil, ask user before changing an existing magic number. When this is `function', only ask when called non-interactively. (custom-declare-variable 'executable-query ''function '(#$ . -1080) :type '(choice (const :tag "Don't Ask" nil) (const :tag "Ask when non-interactive" function) (other :tag "Ask" t)) :group 'executable) #@67 *On files with this kind of name no magic is inserted or changed. (custom-declare-variable 'executable-magicless-file-regexp '"/[Mm]akefile$\\|/\\.\\(z?profile\\|bash_profile\\|z?login\\|bash_login\\|z?logout\\|bash_logout\\|.+shrc\\|esrc\\|rcrc\\|[kz]shenv\\)$" '(#$ . -1418) :type 'regexp :group 'executable) #@75 *Interpreter magic number prefix inserted when there was no magic number. (custom-declare-variable 'executable-prefix '"#! " '(#$ . -1735) :type 'string :group 'executable) #@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). (custom-declare-variable 'executable-chmod '73 '(#$ . -1915) :type '(choice integer (const nil)) :group 'executable) (byte-code "\301B\302\301!\204\303\301\304\"\210\304\207" [current-load-list executable-command default-boundp set-default nil] 3) #@143 *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]. (custom-declare-variable 'executable-self-display '"tail" '(#$ . -2424) :type 'string :group 'executable) #@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 '(("\\`#!.*/\\([^ \n]+\\)" 1 font-lock-keyword-face t)) (#$ . -2679)) #@85 Alist of regexps used to match script errors. See `compilation-error-regexp-alist'. (defvar executable-error-regexp-alist '(("^\\(.*[^[/]\\)\\(\\[[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)) (#$ . 2930)) (defvaralias 'executable-binary-suffixes 'exec-suffixes) #@100 Check if PROGRAM handles arguments Posix-style. If PROGRAM is non-nil, use that instead of "find". (defalias 'executable-command-find-posix-p #[(&optional program) #@405 ("\305!\306 \307\310#@\311\312!\313\216r q\210\314\f\2060\315\307p\307 \316\n\317\320& \210eb\210\321\n\307\322#\20520\322-\207" . [data-directory dir file #1=#:temp-buffer program file-truename directory-files nil "^[^.]" generate-new-buffer " *temp*" ((byte-code "\301!\203\n0\302!\210\301\207" [#1# buffer-name kill-buffer] 2)) call-process "find" "-name" "-maxdepth" "1" search-forward t])(#$ . 3638) nil 10 (#$ . 3467)]) #@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 #@175 ("\205\"0 \205\"0\302 !\206\"0\303 \304W\2030[\202!0\305\306 !\"\"\207" . [executable-chmod buffer-file-name file-executable-p set-file-modes 0 logior file-modes])(#$ . 4291) nil 6 (#$ . 4081)]) #@275 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. The buffer is also in `comint-mode' and `compilation-shell-minor-mode', so that you can answer any prompts. (defalias 'executable-interpret #[(command) #@307 ("\305\306!\210\307?!\210\310\302!\210  \311 \312\313#)\207" . [compilation-ask-about-save command executable-command executable-error-regexp-alist compilation-error-regexp-alist require compile save-some-buffers make-local-variable compilation-start t #[(x) "\300\207" [#1="*interpretation*"] 1 #1#]])(#$ . 4828) nil 4 (#$ . 4503) (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) #@1016 ("\306!\203\n0\2020\307!\2060\310\311\"\312\313\"\203%0\314\315\316\211$\202&0 \20510\315 \231\20510\317 Q\n\204\2550 \203C0\312\f \"\204\2550 \204L0\203\2550e\320V\204\2550\212eb\210\321\322\323\316\324$\210\325\326!\203\2350\320\224b\203\2540\320\225Sf\327U\204\2540 `\320\225{\230\204\2540\203\2120\204\2120\330\213\203\2540\314 \324\211\316\320%\210\331\332_ P\"\210\202\2540_ \333\261\210\331\332_ P\"\210)\207" . [interpreter argument buffer-read-only buffer-file-name executable-magicless-file-regexp insert-flag file-name-absolute-p executable-find error "Interpreter %s not recognized" string-match "\\`/:" replace-match "" nil " " 1 add-hook after-save-hook executable-chmod t looking-at "#![ ]*\\(.*\\)$" 32 ((byte-code "\302p!\210\303\304 \305R!\207" [executable-prefix argument switch-to-buffer y-or-n-p "Replace magic number by `" "'? "] 5)) message "Magic number changed to `%s'" 10 executable-insert executable-query no-query-flag executable-prefix])(#$ . 5642) nil 6 (#$ . 5249) (let* ((name (read-string "Name or file name of interpreter: ")) (arg (read-string (format "Argument for %s: " name)))) (list name arg (eq executable-query '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 #@106 ("\301=\2030\302\302 \303\"\207" . [this-command executable-self-display executable-set-magic "+2"])(#$ . 7034) nil 3 (#$ . 6866) nil]) #@152 Make file executable according to umask if not already executable. If file already has any execute bits set at all, do not change existing file modes. (defalias 'executable-make-buffer-file-executable-if-script-p #[nil #@277 ("\302 \303Y\20590\214~\210ee\303\\{\304\230)\20590\305\306 !\307\310 \311\"\307\311\"\312U?\20680\313 !\20680\314\306 \315 \"\"*\207" . [current-mode add-mode buffer-size 2 "#!" file-modes buffer-file-name logand default-file-modes 73 0 zerop set-file-modes logior])(#$ . 7407) nil 5 (#$ . 7181)]) (provide 'executable)