Commit db30296b authored by Glenn Morris's avatar Glenn Morris

Put re-loaded file back at start of load-history (bug#26837)

* src/lread.c (readevalloop): Fix the "whole buffer" check to
operate in the correct buffer.
(Feval_buffer): Move point back to the start after checking
for lexical binding.
* test/src/lread-tests.el (lread-test-bug26837): New test.
* test/data/somelib.el, test/data/somelib2.el: New test data files.
parent d6d5020c
......@@ -1885,7 +1885,7 @@ readevalloop (Lisp_Object readcharfun,
/* On the first cycle, we can easily test here
whether we are reading the whole buffer. */
if (b && first_sexp)
whole_buffer = (PT == BEG && ZV == Z);
whole_buffer = (BUF_PT (b) == BUF_BEG (b) && BUF_ZV (b) == BUF_Z (b));
instream = stream;
......@@ -2008,6 +2008,7 @@ This function preserves the position of point. */)
record_unwind_protect (save_excursion_restore, save_excursion_save ());
specbind (Qlexical_binding, lisp_file_lexically_bound_p (buf) ? Qt : Qnil);
readevalloop (buf, 0, filename,
!NILP (printflag), unibyte, Qnil, Qnil, Qnil);
unbind_to (count, Qnil);
;;; -*- lexical-binding: t; -*-
;; blah
(defun somefunc () t)
(provide 'somelib)
;;; -*- lexical-binding: t; -*-
;; blah
(defun somefunc2 () t)
(provide 'somelib2)
......@@ -142,4 +142,17 @@ literals (Bug#20852)."
"unescaped character literals "
"\", (, ), ;, [, ] detected!")))))
(ert-deftest lread-test-bug26837 ()
"Test for ."
(let ((load-path (cons
(expand-file-name "data" (getenv "EMACS_TEST_DIRECTORY")))
(load "somelib" nil t)
(should (string-suffix-p "/somelib.el" (caar load-history)))
(load "somelib2" nil t)
(should (string-suffix-p "/somelib2.el" (caar load-history)))
(load "somelib" nil t)
(should (string-suffix-p "/somelib.el" (caar load-history)))))
;;; lread-tests.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment