summaryrefslogtreecommitdiff
path: root/src/lread.c
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2012-09-28 00:40:42 -0700
committerGlenn Morris <rgm@gnu.org>2012-09-28 00:40:42 -0700
commit757140ff9aca7cce0096604c7e7b9cd5ffca914e (patch)
tree4dc3fc8f19d0410dccb3886a034f37887804bdcf /src/lread.c
parent5bc93c6718562a9819b4919b595281bf85689306 (diff)
downloademacs-757140ff9aca7cce0096604c7e7b9cd5ffca914e.tar.gz
* src/lread.c (lisp_file_lexically_bound_p): Handle #! lines.
Fixes: debbugs:12528
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c19
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,
/* Return true if the lisp code read using READCHARFUN defines a non-nil
`lexical-binding' file variable. After returning, the stream is
- positioned following the first line, if it is a comment, otherwise
- nothing is read. */
+ positioned following the first line, if it is a comment or #! line,
+ otherwise nothing is read. */
static int
lisp_file_lexically_bound_p (Lisp_Object readcharfun)
{
int ch = READCHAR;
+
+ if (ch == '#')
+ {
+ ch = READCHAR;
+ if (ch != '!')
+ {
+ UNREAD (ch);
+ UNREAD ('#');
+ return 0;
+ }
+ while (ch != '\n' && ch != EOF)
+ ch = READCHAR;
+ if (ch == '\n') ch = READCHAR;
+ }
+
if (ch != ';')
/* The first line isn't a comment, just give up. */
{