]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/ert.el (describe-symbol-backends): Add ourselves
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 23 Jan 2018 03:00:55 +0000 (22:00 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 23 Jan 2018 03:00:55 +0000 (22:00 -0500)
(ert-describe-test): Return the description text as well.
Remove left over version check.
* lisp/help-mode.el (describe-symbol-backends): Add docstring.

lisp/emacs-lisp/ert.el
lisp/help-mode.el

index 029a2939a0b1fbb74f56e58142331f2bf4b32068..a47108545d1a639a37dd582e53a633db9008d794 100644 (file)
@@ -2549,8 +2549,6 @@ To be used in the ERT results buffer."
 (defun ert-describe-test (test-or-test-name)
   "Display the documentation for TEST-OR-TEST-NAME (a symbol or ert-test)."
   (interactive (list (ert-read-test-name-at-point "Describe test")))
-  (when (< emacs-major-version 24)
-    (user-error "Requires Emacs 24 or later"))
   (let (test-name
         test-definition)
     (cl-etypecase test-or-test-name
@@ -2587,7 +2585,9 @@ To be used in the ERT results buffer."
             (insert (substitute-command-keys
                      (or (ert-test-documentation test-definition)
                          "It is not documented."))
-                    "\n")))))))
+                    "\n")
+            ;; For describe-symbol-backends.
+            (buffer-string)))))))
 
 (defun ert-results-describe-test-at-point ()
   "Display the documentation of the test at point.
@@ -2599,6 +2599,11 @@ To be used in the ERT results buffer."
 
 ;;; Actions on load/unload.
 
+(require 'help-mode)
+(add-to-list 'describe-symbol-backends
+             `("ERT test" ,#'ert-test-boundp
+               ,(lambda (s _b _f) (ert-describe-test s))))
+
 (add-to-list 'find-function-regexp-alist '(ert--test . ert--find-test-regexp))
 (add-to-list 'minor-mode-alist '(ert--current-run-stats
                                  (:eval
@@ -2613,7 +2618,7 @@ To be used in the ERT results buffer."
                          'ert--activate-font-lock-keywords)
   nil)
 
-(defvar ert-unload-hook '())
+(defvar ert-unload-hook ())
 (add-hook 'ert-unload-hook #'ert--unload-function)
 
 
index ee481cf43f67b846451379aa201b109d171ea1d8..4fb3fb85c99323ea60a0da22d745a90ad790d620 100644 (file)
@@ -421,7 +421,15 @@ it does not already exist."
         (or (and (boundp symbol) (not (keywordp symbol)))
             (get symbol 'variable-documentation)))
      ,#'describe-variable)
-    ("face" ,#'facep ,(lambda (s _b _f) (describe-face s)))))
+    ("face" ,#'facep ,(lambda (s _b _f) (describe-face s))))
+  "List of providers of information about symbols.
+Each element has the form (NAME TESTFUN DESCFUN) where:
+  NAME is a string naming a category of object, such as \"type\" or \"face\".
+  TESTFUN is a predicate which takes a symbol and returns non-nil if the
+    symbol is such an object.
+  DESCFUN is a function which takes three arguments (a symbol, a buffer,
+    and a frame), inserts the description of that symbol in the current buffer
+    and returns that text as well.")
 
 ;;;###autoload
 (defun help-make-xrefs (&optional buffer)