]> code.delx.au - gnu-emacs/commitdiff
* lisp/emacs-lisp/testcover.el: Don't use edebug--read (bug#20487)
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 6 May 2015 14:50:48 +0000 (10:50 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 6 May 2015 14:50:48 +0000 (10:50 -0400)
* 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'.

lisp/emacs-lisp/testcover.el
src/alloc.c
src/lread.c

index a91704a11bf41a059682a8a289565c9dc09b632f..110c63f777ab4fd1c2de04477d81fe5994c74fec 100644 (file)
@@ -1,4 +1,4 @@
-;;;; testcover.el -- Visual code-coverage tool
+;;;; testcover.el -- Visual code-coverage tool  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2002-2015 Free Software Foundation, Inc.
 
@@ -191,8 +191,9 @@ problems with type-ahead or post-command-hook, etc.  If BYTE-COMPILE is
 non-nil, byte-compiles each function after instrumenting."
   (interactive "fStart covering file: ")
   (let ((buf                (find-file filename))
-       (load-read-function 'testcover-read)
-       (edebug-all-defs t))
+       (load-read-function load-read-function))
+    (add-function :around load-read-function
+                  #'testcover--read)
     (setq edebug-form-data                       nil
          testcover-module-constants             nil
          testcover-module-1value-functions nil)
@@ -207,22 +208,26 @@ non-nil, byte-compiles each function after instrumenting."
 (defun testcover-this-defun ()
   "Start coverage on function under point."
   (interactive)
-  (let* ((edebug-all-defs t)
-        (x (symbol-function (eval-defun nil))))
+  (let ((x (let ((edebug-all-defs t))
+             (symbol-function (eval-defun nil)))))
     (testcover-reinstrument x)
     x))
 
-(defun testcover-read (&optional stream)
+(defun testcover--read (orig &optional stream)
   "Read a form using edebug, changing edebug callbacks to testcover callbacks."
-  (let ((x (edebug-read stream)))
-    (testcover-reinstrument x)
-    x))
+  (or stream (setq stream standard-input))
+  (if (eq stream (current-buffer))
+      (let ((x (let ((edebug-all-defs t))
+                 (edebug-read-and-maybe-wrap-form))))
+        (testcover-reinstrument x)
+        x)
+    (funcall (or orig #'read) stream)))
 
 (defun testcover-reinstrument (form)
   "Reinstruments FORM to use testcover instead of edebug.  This
 function modifies the list that FORM points to.  Result is nil if
 FORM should return multiple values, t if should always return same
-value, 'maybe if either is acceptable."
+value, `maybe' if either is acceptable."
   (let ((fun (car-safe form))
        id val)
     (cond
@@ -495,7 +500,7 @@ eliminated by adding more test cases."
         (len      (length points))
         (changed (buffer-modified-p))
         (coverage (get def 'edebug-coverage))
-        ov j item)
+        ov j)
     (or (and def-mark points coverage)
        (error "Missing edebug data for function %s" def))
     (when (> len 0)
index 688363d06e33a680d130753216775a2fb2e0b6f5..030c6e06ba82606e70f0420001c62bcb626dbb9f 100644 (file)
@@ -5762,7 +5762,7 @@ garbage_collect_1 (void *end)
      after GC.  It's important to scan finalizers at this stage so
      that we can be sure that unmarked finalizers are really
      unreachable except for references from their associated functions
-     and from other finalizers. */
+     and from other finalizers.  */
 
   queue_doomed_finalizers (&doomed_finalizers, &finalizers);
   mark_finalizer_list (&doomed_finalizers);
index a84450a4364c1b0afbd63fa1c7e0526fb018ddbd..26c19d8338b71a60f1cdf9c67e8f867f2fa0a8ca 100644 (file)
@@ -4592,8 +4592,10 @@ of the file, regardless of whether or not it has the `.elc' extension.  */);
 
   DEFVAR_LISP ("load-read-function", Vload_read_function,
               doc: /* Function used by `load' and `eval-region' for reading expressions.
-The default is nil, which means use the function `read'.  */);
-  Vload_read_function = Qnil;
+Called with a single argument (the stream from which to read).
+The default is to use the function `read'.  */);
+  DEFSYM (Qread, "read");
+  Vload_read_function = Qread;
 
   DEFVAR_LISP ("load-source-file-function", Vload_source_file_function,
               doc: /* Function called in `load' to load an Emacs Lisp source file.