diff options
| author | Stefan Monnier | 2015-01-16 22:52:15 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2015-01-16 22:52:15 -0500 |
| commit | 24b7f77581c7eefe484db6cbbd661c04460c66aa (patch) | |
| tree | 59bf6bdfba55d0f5aeb73a755e2420ce19ac7c3a /test | |
| parent | a2cd6d90d20408a6265c8615697dbff94df3f098 (diff) | |
| download | emacs-24b7f77581c7eefe484db6cbbd661c04460c66aa.tar.gz emacs-24b7f77581c7eefe484db6cbbd661c04460c66aa.zip | |
Improve handling of doc-strings and describe-function for cl-generic
* lisp/help-fns.el (find-lisp-object-file-name): Accept any `type' as long
as it's a symbol.
(help-fns-short-filename): New function.
(describe-function-1): Use it. Use autoload-do-load.
* lisp/help-mode.el (help-function-def): Add optional arg `type'.
* lisp/emacs-lisp/cl-generic.el (cl-generic-ensure-function): It's OK to
override an autoload.
(cl-generic-current-method-specializers): Replace dyn-bind variable
with a lexically-scoped macro.
(cl--generic-lambda): Update accordingly.
(cl-generic-define-method): Record manually in the load-history with
type `cl-defmethod'.
(cl--generic-get-dispatcher): Minor optimization.
(cl--generic-search-method): New function.
(find-function-regexp-alist): Add entry for `cl-defmethod' type.
(cl--generic-search-method): Add hyperlinks for methods. Merge the
specializers and the function's arguments.
* lisp/emacs-lisp/eieio-core.el (eieio--defalias): Move to eieio-generic.el.
(eieio-defclass-autoload): Don't record the superclasses any more.
(eieio-defclass-internal): Reuse the old class object if it was just an
autoload stub.
(eieio--class-precedence-list): Load the class if it's autoloaded.
* lisp/emacs-lisp/eieio-generic.el (eieio--defalias): Move from eieio-core.
(eieio--defgeneric-init-form): Don't throw away a previous docstring.
(eieio--method-optimize-primary): Don't mess with the docstring.
(defgeneric): Keep the `args' in the docstring.
(defmethod): Don't use the method's docstring for the generic
function's docstring.
* lisp/emacs-lisp/find-func.el: Use lexical-binding.
(find-function-regexp): Don't rule out `defgeneric'.
(find-function-regexp-alist): Document new possibility of including
a function instead of a regexp.
(find-function-search-for-symbol): Implement that new possibility.
(find-function-library): Don't assume that `function' is a symbol.
(find-function-do-it): Remove unused var `orig-buf'.
* test/automated/cl-generic-tests.el (cl-generic-test-8-after/before):
Rename from cl-generic-test-7-after/before.
(cl--generic-test-advice): New function.
(cl-generic-test-9-advice): New test.
* test/automated/eieio-test-methodinvoke.el (eieio-test-cl-generic-1): Reset
eieio-test--1.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 10 | ||||
| -rw-r--r-- | test/automated/cl-generic-tests.el | 15 | ||||
| -rw-r--r-- | test/automated/eieio-test-methodinvoke.el | 1 |
3 files changed, 25 insertions, 1 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 8ed02ee341b..c40407f496b 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2015-01-17 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * automated/eieio-test-methodinvoke.el (eieio-test-cl-generic-1): Reset | ||
| 4 | eieio-test--1. | ||
| 5 | |||
| 6 | * automated/cl-generic-tests.el (cl-generic-test-8-after/before): | ||
| 7 | Rename from cl-generic-test-7-after/before. | ||
| 8 | (cl--generic-test-advice): New function. | ||
| 9 | (cl-generic-test-9-advice): New test. | ||
| 10 | |||
| 1 | 2015-01-16 Jorgen Schaefer <contact@jorgenschaefer.de> | 11 | 2015-01-16 Jorgen Schaefer <contact@jorgenschaefer.de> |
| 2 | 12 | ||
| 3 | * automated/package-test.el (package-test-install-prioritized): | 13 | * automated/package-test.el (package-test-install-prioritized): |
diff --git a/test/automated/cl-generic-tests.el b/test/automated/cl-generic-tests.el index 57b17b145e8..46397fb7f51 100644 --- a/test/automated/cl-generic-tests.el +++ b/test/automated/cl-generic-tests.el | |||
| @@ -129,7 +129,7 @@ | |||
| 129 | (cons "x&y-int" (cl-call-next-method))) | 129 | (cons "x&y-int" (cl-call-next-method))) |
| 130 | (should (equal (cl--generic-1 1 2) '("x&y-int" "y-int" "x-int" 1 2)))) | 130 | (should (equal (cl--generic-1 1 2) '("x&y-int" "y-int" "x-int" 1 2)))) |
| 131 | 131 | ||
| 132 | (ert-deftest cl-generic-test-7-after/before () | 132 | (ert-deftest cl-generic-test-8-after/before () |
| 133 | (let ((log ())) | 133 | (let ((log ())) |
| 134 | (cl-defgeneric cl--generic-1 (x y)) | 134 | (cl-defgeneric cl--generic-1 (x y)) |
| 135 | (cl-defmethod cl--generic-1 ((_x t) y) (cons y log)) | 135 | (cl-defmethod cl--generic-1 ((_x t) y) (cons y log)) |
| @@ -142,5 +142,18 @@ | |||
| 142 | (should (equal (cl--generic-1 4 6) '("quatre" 6 (:before 4)))) | 142 | (should (equal (cl--generic-1 4 6) '("quatre" 6 (:before 4)))) |
| 143 | (should (equal log '((:after 4) (:before 4)))))) | 143 | (should (equal log '((:after 4) (:before 4)))))) |
| 144 | 144 | ||
| 145 | (defun cl--generic-test-advice (&rest args) (cons "advice" (apply args))) | ||
| 146 | |||
| 147 | (ert-deftest cl-generic-test-9-advice () | ||
| 148 | (cl-defgeneric cl--generic-1 (x y) "My doc.") | ||
| 149 | (cl-defmethod cl--generic-1 (x y) (list x y)) | ||
| 150 | (advice-add 'cl--generic-1 :around #'cl--generic-test-advice) | ||
| 151 | (should (equal (cl--generic-1 4 5) '("advice" 4 5))) | ||
| 152 | (cl-defmethod cl--generic-1 ((_x integer) _y) | ||
| 153 | (cons "integer" (cl-call-next-method))) | ||
| 154 | (should (equal (cl--generic-1 4 5) '("advice" "integer" 4 5))) | ||
| 155 | (advice-remove 'cl--generic-1 #'cl--generic-test-advice) | ||
| 156 | (should (equal (cl--generic-1 4 5) '("integer" 4 5)))) | ||
| 157 | |||
| 145 | (provide 'cl-generic-tests) | 158 | (provide 'cl-generic-tests) |
| 146 | ;;; cl-generic-tests.el ends here | 159 | ;;; cl-generic-tests.el ends here |
diff --git a/test/automated/eieio-test-methodinvoke.el b/test/automated/eieio-test-methodinvoke.el index 6362fc5a8d9..1c3d9c34708 100644 --- a/test/automated/eieio-test-methodinvoke.el +++ b/test/automated/eieio-test-methodinvoke.el | |||
| @@ -384,6 +384,7 @@ | |||
| 384 | (cl-defgeneric eieio-test--1 (x y)) | 384 | (cl-defgeneric eieio-test--1 (x y)) |
| 385 | 385 | ||
| 386 | (ert-deftest eieio-test-cl-generic-1 () | 386 | (ert-deftest eieio-test-cl-generic-1 () |
| 387 | (cl-defgeneric eieio-test--1 (x y)) | ||
| 387 | (cl-defmethod eieio-test--1 (x y) (list x y)) | 388 | (cl-defmethod eieio-test--1 (x y) (list x y)) |
| 388 | (cl-defmethod eieio-test--1 ((_x CNM-0) y) | 389 | (cl-defmethod eieio-test--1 ((_x CNM-0) y) |
| 389 | (cons "CNM-0" (cl-call-next-method 7 y))) | 390 | (cons "CNM-0" (cl-call-next-method 7 y))) |