aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2015-05-06 10:50:48 -0400
committerStefan Monnier2015-05-06 10:50:48 -0400
commit1340aefd96c13e4e18e1c6b7f5b6fae4611f5265 (patch)
tree7d04b26f8f7820ed2bc872b8851bc1d03f18b04b
parent1f052a5f26250d726618570a816ddb6fd0cc11a0 (diff)
downloademacs-1340aefd96c13e4e18e1c6b7f5b6fae4611f5265.tar.gz
emacs-1340aefd96c13e4e18e1c6b7f5b6fae4611f5265.zip
* lisp/emacs-lisp/testcover.el: Don't use edebug--read (bug#20487)
* lisp/emacs-lisp/testcover.el: Use lexical-binding. (testcover--read): Rename from testcover-read. Change calling convention. Use edebug-read-and-maybe-wrap-form now that edebug-read is gone. (testcover-start): Use add-function. Move edebug-all-defs binding to testcover--read. (testcover-this-defun): Tighten scope of edebug-all-defs binding. (testcover-mark): Remove unused var `item'. * src/lread.c (syms_of_lread): Default load-read-function to `read'.
-rw-r--r--lisp/emacs-lisp/testcover.el27
-rw-r--r--src/alloc.c2
-rw-r--r--src/lread.c6
3 files changed, 21 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el
index a91704a11bf..110c63f777a 100644
--- a/lisp/emacs-lisp/testcover.el
+++ b/lisp/emacs-lisp/testcover.el
@@ -1,4 +1,4 @@
1;;;; testcover.el -- Visual code-coverage tool 1;;;; testcover.el -- Visual code-coverage tool -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 2002-2015 Free Software Foundation, Inc. 3;; Copyright (C) 2002-2015 Free Software Foundation, Inc.
4 4
@@ -191,8 +191,9 @@ problems with type-ahead or post-command-hook, etc. If BYTE-COMPILE is
191non-nil, byte-compiles each function after instrumenting." 191non-nil, byte-compiles each function after instrumenting."
192 (interactive "fStart covering file: ") 192 (interactive "fStart covering file: ")
193 (let ((buf (find-file filename)) 193 (let ((buf (find-file filename))
194 (load-read-function 'testcover-read) 194 (load-read-function load-read-function))
195 (edebug-all-defs t)) 195 (add-function :around load-read-function
196 #'testcover--read)
196 (setq edebug-form-data nil 197 (setq edebug-form-data nil
197 testcover-module-constants nil 198 testcover-module-constants nil
198 testcover-module-1value-functions nil) 199 testcover-module-1value-functions nil)
@@ -207,22 +208,26 @@ non-nil, byte-compiles each function after instrumenting."
207(defun testcover-this-defun () 208(defun testcover-this-defun ()
208 "Start coverage on function under point." 209 "Start coverage on function under point."
209 (interactive) 210 (interactive)
210 (let* ((edebug-all-defs t) 211 (let ((x (let ((edebug-all-defs t))
211 (x (symbol-function (eval-defun nil)))) 212 (symbol-function (eval-defun nil)))))
212 (testcover-reinstrument x) 213 (testcover-reinstrument x)
213 x)) 214 x))
214 215
215(defun testcover-read (&optional stream) 216(defun testcover--read (orig &optional stream)
216 "Read a form using edebug, changing edebug callbacks to testcover callbacks." 217 "Read a form using edebug, changing edebug callbacks to testcover callbacks."
217 (let ((x (edebug-read stream))) 218 (or stream (setq stream standard-input))
218 (testcover-reinstrument x) 219 (if (eq stream (current-buffer))
219 x)) 220 (let ((x (let ((edebug-all-defs t))
221 (edebug-read-and-maybe-wrap-form))))
222 (testcover-reinstrument x)
223 x)
224 (funcall (or orig #'read) stream)))
220 225
221(defun testcover-reinstrument (form) 226(defun testcover-reinstrument (form)
222 "Reinstruments FORM to use testcover instead of edebug. This 227 "Reinstruments FORM to use testcover instead of edebug. This
223function modifies the list that FORM points to. Result is nil if 228function modifies the list that FORM points to. Result is nil if
224FORM should return multiple values, t if should always return same 229FORM should return multiple values, t if should always return same
225value, 'maybe if either is acceptable." 230value, `maybe' if either is acceptable."
226 (let ((fun (car-safe form)) 231 (let ((fun (car-safe form))
227 id val) 232 id val)
228 (cond 233 (cond
@@ -495,7 +500,7 @@ eliminated by adding more test cases."
495 (len (length points)) 500 (len (length points))
496 (changed (buffer-modified-p)) 501 (changed (buffer-modified-p))
497 (coverage (get def 'edebug-coverage)) 502 (coverage (get def 'edebug-coverage))
498 ov j item) 503 ov j)
499 (or (and def-mark points coverage) 504 (or (and def-mark points coverage)
500 (error "Missing edebug data for function %s" def)) 505 (error "Missing edebug data for function %s" def))
501 (when (> len 0) 506 (when (> len 0)
diff --git a/src/alloc.c b/src/alloc.c
index 688363d06e3..030c6e06ba8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5762,7 +5762,7 @@ garbage_collect_1 (void *end)
5762 after GC. It's important to scan finalizers at this stage so 5762 after GC. It's important to scan finalizers at this stage so
5763 that we can be sure that unmarked finalizers are really 5763 that we can be sure that unmarked finalizers are really
5764 unreachable except for references from their associated functions 5764 unreachable except for references from their associated functions
5765 and from other finalizers. */ 5765 and from other finalizers. */
5766 5766
5767 queue_doomed_finalizers (&doomed_finalizers, &finalizers); 5767 queue_doomed_finalizers (&doomed_finalizers, &finalizers);
5768 mark_finalizer_list (&doomed_finalizers); 5768 mark_finalizer_list (&doomed_finalizers);
diff --git a/src/lread.c b/src/lread.c
index a84450a4364..26c19d8338b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4592,8 +4592,10 @@ of the file, regardless of whether or not it has the `.elc' extension. */);
4592 4592
4593 DEFVAR_LISP ("load-read-function", Vload_read_function, 4593 DEFVAR_LISP ("load-read-function", Vload_read_function,
4594 doc: /* Function used by `load' and `eval-region' for reading expressions. 4594 doc: /* Function used by `load' and `eval-region' for reading expressions.
4595The default is nil, which means use the function `read'. */); 4595Called with a single argument (the stream from which to read).
4596 Vload_read_function = Qnil; 4596The default is to use the function `read'. */);
4597 DEFSYM (Qread, "read");
4598 Vload_read_function = Qread;
4597 4599
4598 DEFVAR_LISP ("load-source-file-function", Vload_source_file_function, 4600 DEFVAR_LISP ("load-source-file-function", Vload_source_file_function,
4599 doc: /* Function called in `load' to load an Emacs Lisp source file. 4601 doc: /* Function called in `load' to load an Emacs Lisp source file.