Mercurial > emacs
comparison lisp/progmodes/executable.el @ 14722:4f6baee20482
Comment change.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Fri, 01 Mar 1996 05:26:29 +0000 |
| parents | 83f275dcd93a |
| children | 0ce70615b9e9 |
comparison
equal
deleted
inserted
replaced
| 14721:2630ac774647 | 14722:4f6baee20482 |
|---|---|
| 26 | 26 |
| 27 ;; executable.el is used by certain major modes to insert a suitable | 27 ;; executable.el is used by certain major modes to insert a suitable |
| 28 ;; #! line at the beginning of the file, if the file does not already | 28 ;; #! line at the beginning of the file, if the file does not already |
| 29 ;; have one. | 29 ;; have one. |
| 30 | 30 |
| 31 ;; This is support code for the likes of sh-, awk-, perl-, tcl- or | 31 ;; Unless it has a magic number, a Unix file with executable mode is passed to |
| 32 ;; makefile-mode. Those mode-setting commands can call the like of | 32 ;; a new instance of the running shell (or to a Bourne shell if a csh is |
| 33 ;; `(executable-set-magic "sh")' or `(executable-set-magic "perl" "-f")'. | 33 ;; running and the file starts with `:'). Only a shell can start such a file, |
| 34 ;; Unless the file name matches `executable-magicless-file-regexp' this will | 34 ;; exec() cannot, which is why it is important to have a magic number in every |
| 35 ;; search $PATH if the given interpreter isn't absolute, and then insert a | 35 ;; executable script. Such a magic number is made up by the characters `#!' |
| 36 ;; first line like `#! /bin/sh' or `#! /usr/local/bin/perl -f'. | 36 ;; the filename of an interpreter (in COFF, ELF or somesuch format) and one |
| 37 ;; Also it makes the file executable as soon as it's saved, if it wasn't. | 37 ;; optional argument. |
| 38 | |
| 39 ;; This library is for certain major modes like sh-, awk-, perl-, tcl- or | |
| 40 ;; makefile-mode to insert or update a suitable #! line at the beginning of | |
| 41 ;; the file, if the file does not already have one and the file is not a | |
| 42 ;; default file of that interpreter (like .profile or makefile). It also | |
| 43 ;; makes the file executable if it wasn't, as soon as it's saved. | |
| 44 | |
| 45 ;; It also allows debugging scripts, with an adaptation of compile, as far | |
| 46 ;; as interpreters give out meaningful error messages. | |
| 47 | |
| 48 ;; Modes that use this should nconc `executable-map' to the end of their own | |
| 49 ;; keymap and `executable-font-lock-keywords' to the end of their own font | |
| 50 ;; lock keywords. Their mode-setting commands should call | |
| 51 ;; `executable-set-magic'. | |
| 38 | 52 |
| 39 ;;; Code: | 53 ;;; Code: |
| 40 | 54 |
| 41 (defvar executable-insert 'not-modified | 55 (defvar executable-insert 'not-modified |
| 42 "*What to do when newly found file has no or wrong magic number: | 56 "*What to do when newly found file has no or wrong magic number: |
