mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 14:30:50 -08:00
Add online-help support to describe types
* lisp/help-fns.el (describe-symbol-backends): Move to help-mode.el. (describe-symbol): Improve the selection of default. * lisp/help-mode.el: Require cl-lib. (describe-symbol-backends): Move from help-fns.el. (help-make-xrefs): Use it. * lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Add entry for types. (cl--typedef-regexp): New const. (find-function-regexp-alist): Add entry for types. (cl-help-type, cl-type-definition): New buttons. (cl-find-class): New function. (cl-describe-type): New command. (cl--describe-class, cl--describe-class-slot) (cl--describe-class-slots): New functions, moved from eieio-opt.el. * lisp/emacs-lisp/cl-generic.el (cl--generic-method-documentation) (cl--generic-all-functions, cl--generic-specializers-apply-to-type-p): New functions. Moved from eieio-opt.el. (cl--generic-class-parents): New function, extracted from cl--generic-struct-specializers. (cl--generic-struct-specializers): Use it. * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Use pcase-dolist. Improve constructor's docstrings. (cl-struct-unknown-slot): New error. (cl-struct-slot-offset): Use it. * lisp/emacs-lisp/cl-preloaded.el (cl-struct-define): Record the type definition in current-load-list. * lisp/emacs-lisp/eieio-core.el (eieio--known-slot-names): New var. (eieio--add-new-slot): Set it. (eieio-defclass-internal): Use new name for current-load-list. (eieio-oref): Add compiler-macro to warn about unknown slots. * lisp/emacs-lisp/eieio.el (defclass): Update eieio--known-slot-names as compile-time as well. Improve constructor docstrings. * lisp/emacs-lisp/eieio-opt.el (eieio-help-class) (eieio--help-print-slot, eieio-help-class-slots): Move to cl-extra.el. (eieio-class-def): Remove button. (eieio-help-constructor): Use new name for load-history element. (eieio--specializers-apply-to-class-p, eieio-all-generic-functions) (eieio-method-documentation): Move to cl-generic.el. (eieio-display-method-list): Use new names. * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add "define-linline". (lisp-fdefs): Remove "defsubst". (el-fdefs): Add "defsubst", "cl-defsubst", and "define-linline". * lisp/emacs-lisp/macroexp.el (macroexp--warned): New var. (macroexp--warn-and-return): Use it to avoid inf-loops. Add `compile-only' argument.
This commit is contained in:
parent
287bce9888
commit
59b5723c9b
11 changed files with 358 additions and 286 deletions
|
|
@ -119,20 +119,28 @@ and also to avoid outputting the warning during normal execution."
|
|||
(member '(declare-function . byte-compile-macroexpand-declare-function)
|
||||
macroexpand-all-environment))
|
||||
|
||||
(defvar macroexp--warned (make-hash-table :test #'equal :weakness 'key))
|
||||
|
||||
(defun macroexp--warn-and-return (msg form)
|
||||
(defun macroexp--warn-and-return (msg form &optional compile-only)
|
||||
(let ((when-compiled (lambda () (byte-compile-log-warning msg t))))
|
||||
(cond
|
||||
((null msg) form)
|
||||
((macroexp--compiling-p)
|
||||
`(progn
|
||||
(macroexp--funcall-if-compiled ',when-compiled)
|
||||
,form))
|
||||
(if (gethash form macroexp--warned)
|
||||
;; Already wrapped this exp with a warning: avoid inf-looping
|
||||
;; where we keep adding the same warning onto `form' because
|
||||
;; macroexpand-all gets right back to macroexpanding `form'.
|
||||
form
|
||||
(puthash form form macroexp--warned)
|
||||
`(progn
|
||||
(macroexp--funcall-if-compiled ',when-compiled)
|
||||
,form)))
|
||||
(t
|
||||
(message "%s%s" (if (stringp load-file-name)
|
||||
(concat (file-relative-name load-file-name) ": ")
|
||||
"")
|
||||
msg)
|
||||
(unless compile-only
|
||||
(message "%s%s" (if (stringp load-file-name)
|
||||
(concat (file-relative-name load-file-name) ": ")
|
||||
"")
|
||||
msg))
|
||||
form))))
|
||||
|
||||
(defun macroexp--obsolete-warning (fun obsolescence-data type)
|
||||
|
|
@ -208,30 +216,30 @@ Assumes the caller has bound `macroexpand-all-environment'."
|
|||
(macroexp--cons
|
||||
'condition-case
|
||||
(macroexp--cons err
|
||||
(macroexp--cons (macroexp--expand-all body)
|
||||
(macroexp--all-clauses handlers 1)
|
||||
(cddr form))
|
||||
(cdr form))
|
||||
(macroexp--cons (macroexp--expand-all body)
|
||||
(macroexp--all-clauses handlers 1)
|
||||
(cddr form))
|
||||
(cdr form))
|
||||
form))
|
||||
(`(,(or `defvar `defconst) . ,_) (macroexp--all-forms form 2))
|
||||
(`(function ,(and f `(lambda . ,_)))
|
||||
(macroexp--cons 'function
|
||||
(macroexp--cons (macroexp--all-forms f 2)
|
||||
nil
|
||||
(cdr form))
|
||||
form))
|
||||
(macroexp--cons (macroexp--all-forms f 2)
|
||||
nil
|
||||
(cdr form))
|
||||
form))
|
||||
(`(,(or `function `quote) . ,_) form)
|
||||
(`(,(and fun (or `let `let*)) . ,(or `(,bindings . ,body) dontcare))
|
||||
(macroexp--cons fun
|
||||
(macroexp--cons (macroexp--all-clauses bindings 1)
|
||||
(macroexp--all-forms body)
|
||||
(cdr form))
|
||||
form))
|
||||
(macroexp--cons (macroexp--all-clauses bindings 1)
|
||||
(macroexp--all-forms body)
|
||||
(cdr form))
|
||||
form))
|
||||
(`(,(and fun `(lambda . ,_)) . ,args)
|
||||
;; Embedded lambda in function position.
|
||||
(macroexp--cons (macroexp--all-forms fun 2)
|
||||
(macroexp--all-forms args)
|
||||
form))
|
||||
(macroexp--all-forms args)
|
||||
form))
|
||||
;; The following few cases are for normal function calls that
|
||||
;; are known to funcall one of their arguments. The byte
|
||||
;; compiler has traditionally handled these functions specially
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue