aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/lread.c b/src/lread.c
index aa3e0cfc5b8..08d5f97292b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -25,7 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25#include <sys/file.h> 25#include <sys/file.h>
26#include <errno.h> 26#include <errno.h>
27#include <limits.h> /* For CHAR_BIT. */ 27#include <limits.h> /* For CHAR_BIT. */
28#include <setjmp.h>
29#include <stat-time.h> 28#include <stat-time.h>
30#include "lisp.h" 29#include "lisp.h"
31#include "intervals.h" 30#include "intervals.h"
@@ -50,7 +49,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50#endif 49#endif
51 50
52#include <unistd.h> 51#include <unistd.h>
53#include <math.h>
54 52
55#ifdef HAVE_SETLOCALE 53#ifdef HAVE_SETLOCALE
56#include <locale.h> 54#include <locale.h>
@@ -89,8 +87,6 @@ static Lisp_Object Qget_emacs_mule_file_char;
89 87
90static Lisp_Object Qload_force_doc_strings; 88static Lisp_Object Qload_force_doc_strings;
91 89
92extern Lisp_Object Qinternal_interpreter_environment;
93
94static Lisp_Object Qload_in_progress; 90static Lisp_Object Qload_in_progress;
95 91
96/* The association list of objects read with the #n=object form. 92/* The association list of objects read with the #n=object form.
@@ -1682,6 +1678,17 @@ readevalloop (Lisp_Object readcharfun,
1682 int whole_buffer = 0; 1678 int whole_buffer = 0;
1683 /* 1 on the first time around. */ 1679 /* 1 on the first time around. */
1684 int first_sexp = 1; 1680 int first_sexp = 1;
1681 Lisp_Object macroexpand = intern ("internal-macroexpand-for-load");
1682
1683 if (NILP (Ffboundp (macroexpand))
1684 /* Don't macroexpand in .elc files, since it should have been done
1685 already. We actually don't know whether we're in a .elc file or not,
1686 so we use circumstancial evidence: .el files normally go through
1687 Vload_source_file_function -> load-with-code-conversion
1688 -> eval-buffer. */
1689 || EQ (readcharfun, Qget_file_char)
1690 || EQ (readcharfun, Qget_emacs_mule_file_char))
1691 macroexpand = Qnil;
1685 1692
1686 if (MARKERP (readcharfun)) 1693 if (MARKERP (readcharfun))
1687 { 1694 {
@@ -1696,7 +1703,7 @@ readevalloop (Lisp_Object readcharfun,
1696 1703
1697 /* We assume START is nil when input is not from a buffer. */ 1704 /* We assume START is nil when input is not from a buffer. */
1698 if (! NILP (start) && !b) 1705 if (! NILP (start) && !b)
1699 abort (); 1706 emacs_abort ();
1700 1707
1701 specbind (Qstandard_input, readcharfun); /* GCPROs readcharfun. */ 1708 specbind (Qstandard_input, readcharfun); /* GCPROs readcharfun. */
1702 specbind (Qcurrent_load_list, Qnil); 1709 specbind (Qcurrent_load_list, Qnil);
@@ -1726,7 +1733,7 @@ readevalloop (Lisp_Object readcharfun,
1726 { 1733 {
1727 ptrdiff_t count1 = SPECPDL_INDEX (); 1734 ptrdiff_t count1 = SPECPDL_INDEX ();
1728 1735
1729 if (b != 0 && NILP (BVAR (b, name))) 1736 if (b != 0 && !BUFFER_LIVE_P (b))
1730 error ("Reading from killed buffer"); 1737 error ("Reading from killed buffer");
1731 1738
1732 if (!NILP (start)) 1739 if (!NILP (start))
@@ -1811,6 +1818,8 @@ readevalloop (Lisp_Object readcharfun,
1811 unbind_to (count1, Qnil); 1818 unbind_to (count1, Qnil);
1812 1819
1813 /* Now eval what we just read. */ 1820 /* Now eval what we just read. */
1821 if (!NILP (macroexpand))
1822 val = call1 (macroexpand, val);
1814 val = eval_sub (val); 1823 val = eval_sub (val);
1815 1824
1816 if (printflag) 1825 if (printflag)
@@ -3673,7 +3682,7 @@ intern_c_string_1 (const char *str, ptrdiff_t len)
3673 /* Creating a non-pure string from a string literal not 3682 /* Creating a non-pure string from a string literal not
3674 implemented yet. We could just use make_string here and live 3683 implemented yet. We could just use make_string here and live
3675 with the extra copy. */ 3684 with the extra copy. */
3676 abort (); 3685 emacs_abort ();
3677 3686
3678 return Fintern (make_pure_c_string (str, len), obarray); 3687 return Fintern (make_pure_c_string (str, len), obarray);
3679} 3688}