aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lread.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lread.c b/src/lread.c
index 458992cfaa8..a2c90e7f2b1 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -941,16 +941,19 @@ readevalloop (readcharfun, stream, sourcename, evalfun, printflag)
941 941
942#ifndef standalone 942#ifndef standalone
943 943
944DEFUN ("eval-buffer", Feval_buffer, Seval_buffer, 0, 2, "", 944DEFUN ("eval-buffer", Feval_buffer, Seval_buffer, 0, 3, "",
945 "Execute the current buffer as Lisp code.\n\ 945 "Execute the current buffer as Lisp code.\n\
946Programs can pass two arguments, BUFFER and PRINTFLAG.\n\ 946Programs can pass two arguments, BUFFER and PRINTFLAG.\n\
947BUFFER is the buffer to evaluate (nil means use current buffer).\n\ 947BUFFER is the buffer to evaluate (nil means use current buffer).\n\
948PRINTFLAG controls printing of output:\n\ 948PRINTFLAG controls printing of output:\n\
949nil means discard it; anything else is stream for print.\n\ 949nil means discard it; anything else is stream for print.\n\
950\n\ 950\n\
951If the optional third argument FILENAME is non-nil,\n\
952it specifies the file name to use for `load-history'.\n\
953\n\
951This function preserves the position of point.") 954This function preserves the position of point.")
952 (buffer, printflag) 955 (buffer, printflag, filename)
953 Lisp_Object buffer, printflag; 956 Lisp_Object buffer, printflag, filename;
954{ 957{
955 int count = specpdl_ptr - specpdl; 958 int count = specpdl_ptr - specpdl;
956 Lisp_Object tem, buf; 959 Lisp_Object tem, buf;
@@ -960,16 +963,20 @@ This function preserves the position of point.")
960 else 963 else
961 buf = Fget_buffer (buffer); 964 buf = Fget_buffer (buffer);
962 if (NILP (buf)) 965 if (NILP (buf))
963 error ("No such buffer."); 966 error ("No such buffer");
964 967
965 if (NILP (printflag)) 968 if (NILP (printflag))
966 tem = Qsymbolp; 969 tem = Qsymbolp;
967 else 970 else
968 tem = printflag; 971 tem = printflag;
972
973 if (NILP (filename))
974 filename = XBUFFER (buf)->filename;
975
969 specbind (Qstandard_output, tem); 976 specbind (Qstandard_output, tem);
970 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 977 record_unwind_protect (save_excursion_restore, save_excursion_save ());
971 BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); 978 BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
972 readevalloop (buf, 0, XBUFFER (buf)->filename, Feval, !NILP (printflag)); 979 readevalloop (buf, 0, filename, Feval, !NILP (printflag));
973 unbind_to (count, Qnil); 980 unbind_to (count, Qnil);
974 981
975 return Qnil; 982 return Qnil;