diff options
| author | Glenn Morris | 2012-09-28 00:40:42 -0700 |
|---|---|---|
| committer | Glenn Morris | 2012-09-28 00:40:42 -0700 |
| commit | 757140ff9aca7cce0096604c7e7b9cd5ffca914e (patch) | |
| tree | 4dc3fc8f19d0410dccb3886a034f37887804bdcf /src/lread.c | |
| parent | 5bc93c6718562a9819b4919b595281bf85689306 (diff) | |
| download | emacs-757140ff9aca7cce0096604c7e7b9cd5ffca914e.tar.gz emacs-757140ff9aca7cce0096604c7e7b9cd5ffca914e.zip | |
* src/lread.c (lisp_file_lexically_bound_p): Handle #! lines.
Fixes: debbugs:12528
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lread.c b/src/lread.c index cb808b37677..0b7fd9067dc 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -764,13 +764,28 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, | |||
| 764 | 764 | ||
| 765 | /* Return true if the lisp code read using READCHARFUN defines a non-nil | 765 | /* Return true if the lisp code read using READCHARFUN defines a non-nil |
| 766 | `lexical-binding' file variable. After returning, the stream is | 766 | `lexical-binding' file variable. After returning, the stream is |
| 767 | positioned following the first line, if it is a comment, otherwise | 767 | positioned following the first line, if it is a comment or #! line, |
| 768 | nothing is read. */ | 768 | otherwise nothing is read. */ |
| 769 | 769 | ||
| 770 | static int | 770 | static int |
| 771 | lisp_file_lexically_bound_p (Lisp_Object readcharfun) | 771 | lisp_file_lexically_bound_p (Lisp_Object readcharfun) |
| 772 | { | 772 | { |
| 773 | int ch = READCHAR; | 773 | int ch = READCHAR; |
| 774 | |||
| 775 | if (ch == '#') | ||
| 776 | { | ||
| 777 | ch = READCHAR; | ||
| 778 | if (ch != '!') | ||
| 779 | { | ||
| 780 | UNREAD (ch); | ||
| 781 | UNREAD ('#'); | ||
| 782 | return 0; | ||
| 783 | } | ||
| 784 | while (ch != '\n' && ch != EOF) | ||
| 785 | ch = READCHAR; | ||
| 786 | if (ch == '\n') ch = READCHAR; | ||
| 787 | } | ||
| 788 | |||
| 774 | if (ch != ';') | 789 | if (ch != ';') |
| 775 | /* The first line isn't a comment, just give up. */ | 790 | /* The first line isn't a comment, just give up. */ |
| 776 | { | 791 | { |