Mercurial > emacs
comparison src/lread.c @ 19803:7573e51f9c41
(Feval_buffer): New arg FILENAME.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 07 Sep 1997 18:32:49 +0000 |
parents | a9f87afd5ac6 |
children | b0626d6a3f13 |
comparison
equal
deleted
inserted
replaced
19802:2e277f643555 | 19803:7573e51f9c41 |
---|---|
939 unbind_to (count, Qnil); | 939 unbind_to (count, Qnil); |
940 } | 940 } |
941 | 941 |
942 #ifndef standalone | 942 #ifndef standalone |
943 | 943 |
944 DEFUN ("eval-buffer", Feval_buffer, Seval_buffer, 0, 2, "", | 944 DEFUN ("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\ |
946 Programs can pass two arguments, BUFFER and PRINTFLAG.\n\ | 946 Programs can pass two arguments, BUFFER and PRINTFLAG.\n\ |
947 BUFFER is the buffer to evaluate (nil means use current buffer).\n\ | 947 BUFFER is the buffer to evaluate (nil means use current buffer).\n\ |
948 PRINTFLAG controls printing of output:\n\ | 948 PRINTFLAG controls printing of output:\n\ |
949 nil means discard it; anything else is stream for print.\n\ | 949 nil means discard it; anything else is stream for print.\n\ |
950 \n\ | 950 \n\ |
951 If the optional third argument FILENAME is non-nil,\n\ | |
952 it specifies the file name to use for `load-history'.\n\ | |
953 \n\ | |
951 This function preserves the position of point.") | 954 This 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; |
957 | 960 |
958 if (NILP (buffer)) | 961 if (NILP (buffer)) |
959 buf = Fcurrent_buffer (); | 962 buf = Fcurrent_buffer (); |
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; |
976 } | 983 } |
977 | 984 |