1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00

* lisp/emacs-lisp/eieio: A bit more cleanup, removing compat code.

* lisp/emacs-lisp/eieio-core.el (eieio-compiled-function-arglist): Remove.
(eieio--with-scoped-class): Use `declare'.
(eieio-defclass): Remove compatibility code.
(no-method-definition, no-next-method, inconsistent-class-hierarchy)
(invalid-slot-type, unbound-slot, invalid-slot-name): Use define-error.
* lisp/emacs-lisp/eieio-opt.el (eieio-lambda-arglist): Remove.
Use help-function-arglist instead.
This commit is contained in:
Stefan Monnier 2014-10-18 22:14:58 -04:00
parent 4e94689452
commit 265331858f
4 changed files with 30 additions and 72 deletions

View File

@ -1,3 +1,14 @@
2014-10-19 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/eieio-opt.el (eieio-lambda-arglist): Remove.
Use help-function-arglist instead.
* emacs-lisp/eieio-core.el (eieio-compiled-function-arglist): Remove.
(eieio--with-scoped-class): Use `declare'.
(eieio-defclass): Remove compatibility code.
(no-method-definition, no-next-method, inconsistent-class-hierarchy)
(invalid-slot-type, unbound-slot, invalid-slot-name): Use define-error.
2014-10-18 Jan Djärv <jan.h.d@swipnet.se>
* cus-start.el (x-gtk-whole-detached-tool-bar): Remove.
@ -33,7 +44,7 @@
2014-10-17 Michal Nazarewicz <mina86@mina86.com>
* textmodes/tildify.el (tildify--pick-alist-entry): rename from
* textmodes/tildify.el (tildify--pick-alist-entry): Rename from
tildify-mode-alist.
2014-10-17 Stefan Monnier <monnier@iro.umontreal.ca>

View File

@ -33,20 +33,6 @@
(require 'cl-lib)
;; Compatibility
(if (fboundp 'compiled-function-arglist)
;; XEmacs can only access a compiled functions arglist like this:
(defalias 'eieio-compiled-function-arglist 'compiled-function-arglist)
;; Emacs doesn't have this function, but since FUNC is a vector, we can just
;; grab the appropriate element.
(defun eieio-compiled-function-arglist (func)
"Return the argument list for the compiled function FUNC."
(aref func 0))
)
(put 'eieio--defalias 'byte-hunk-handler
#'byte-compile-file-form-defalias) ;;(get 'defalias 'byte-hunk-handler)
(defun eieio--defalias (name body)
@ -117,12 +103,12 @@ default setting for optimization purposes.")
(defmacro eieio--with-scoped-class (class &rest forms)
"Set CLASS as the currently scoped class while executing FORMS."
(declare (indent 1))
`(unwind-protect
(progn
(push ,class eieio--scoped-class-stack)
,@forms)
(pop eieio--scoped-class-stack)))
(put 'eieio--with-scoped-class 'lisp-indent-function 1)
;;;
;; Field Accessors
@ -678,26 +664,12 @@ See `defclass' for more information."
;; Else - Some error? nil?
nil)))
(if (fboundp 'gv-define-setter)
;; FIXME: We should move more of eieio-defclass into the
;; defclass macro so we don't have to use `eval' and require
;; `gv' at run-time.
(eval `(gv-define-setter ,acces (eieio--store eieio--object)
(list 'eieio-oset eieio--object '',name
eieio--store)))
;; Provide a setf method. It would be cleaner to use
;; defsetf, but that would require CL at runtime.
(put acces 'setf-method
`(lambda (widget)
(let* ((--widget-sym-- (make-symbol "--widget--"))
(--store-sym-- (make-symbol "--store--")))
(list
(list --widget-sym--)
(list widget)
(list --store-sym--)
(list 'eieio-oset --widget-sym-- '',name
--store-sym--)
(list 'getfoo --widget-sym--))))))))
;; FIXME: We should move more of eieio-defclass into the
;; defclass macro so we don't have to use `eval' and require
;; `gv' at run-time.
(eval `(gv-define-setter ,acces (eieio--store eieio--object)
(list 'eieio-oset eieio--object '',name
eieio--store)))))
;; If a writer is defined, then create a generic method of that
;; name whose purpose is to set the value of the slot.
@ -2099,30 +2071,12 @@ is memorized for faster future use."
;;; Here are some special types of errors
;;
(intern "no-method-definition")
(put 'no-method-definition 'error-conditions '(no-method-definition error))
(put 'no-method-definition 'error-message "No method definition")
(intern "no-next-method")
(put 'no-next-method 'error-conditions '(no-next-method error))
(put 'no-next-method 'error-message "No next method")
(intern "invalid-slot-name")
(put 'invalid-slot-name 'error-conditions '(invalid-slot-name error))
(put 'invalid-slot-name 'error-message "Invalid slot name")
(intern "invalid-slot-type")
(put 'invalid-slot-type 'error-conditions '(invalid-slot-type error nil))
(put 'invalid-slot-type 'error-message "Invalid slot type")
(intern "unbound-slot")
(put 'unbound-slot 'error-conditions '(unbound-slot error nil))
(put 'unbound-slot 'error-message "Unbound slot")
(intern "inconsistent-class-hierarchy")
(put 'inconsistent-class-hierarchy 'error-conditions
'(inconsistent-class-hierarchy error nil))
(put 'inconsistent-class-hierarchy 'error-message "Inconsistent class hierarchy")
(define-error 'no-method-definition "No method definition")
(define-error 'no-next-method "No next method")
(define-error 'invalid-slot-name "Invalid slot name")
(define-error 'invalid-slot-type "Invalid slot type")
(define-error 'unbound-slot "Unbound slot")
(define-error 'inconsistent-class-hierarchy "Inconsistent class hierarchy")
;;; Obsolete backward compatibility functions.
;; Needed to run byte-code compiled with the EIEIO of Emacs-23.

View File

@ -356,7 +356,7 @@ are not abstract."
(insert "' " (aref prefix i) " ")
;; argument list
(let* ((func (cdr (car gm)))
(arglst (eieio-lambda-arglist func)))
(arglst (help-function-arglist func)))
(prin1 arglst (current-buffer)))
(insert "\n"
(or (documentation (cdr (car gm)))
@ -374,13 +374,6 @@ are not abstract."
(insert "\n")))
(setq i (1+ i)))))))
(defun eieio-lambda-arglist (func)
"Return the argument list of FUNC, a function body."
(if (symbolp func) (setq func (symbol-function func)))
(if (byte-code-function-p func)
(eieio-compiled-function-arglist func)
(car (cdr func))))
(defun eieio-all-generic-functions (&optional class)
"Return a list of all generic functions.
Optional CLASS argument returns only those functions that contain
@ -419,15 +412,15 @@ function has no documentation, then return nil."
(fboundp after)))
nil
(list (if (fboundp before)
(cons (eieio-lambda-arglist before)
(cons (help-function-arglist before)
(documentation before))
nil)
(if (fboundp primary)
(cons (eieio-lambda-arglist primary)
(cons (help-function-arglist primary)
(documentation primary))
nil)
(if (fboundp after)
(cons (eieio-lambda-arglist after)
(cons (help-function-arglist after)
(documentation after))
nil))))))

View File

@ -910,7 +910,7 @@ Optional argument GROUP is the sub-group of slots to display.
;;;***
;;;### (autoloads nil "eieio-opt" "eieio-opt.el" "99b94c63a73593402e3c825178a44f4f")
;;;### (autoloads nil "eieio-opt" "eieio-opt.el" "889c0a935dddf758dbb65488470ffa06")
;;; Generated autoloads from eieio-opt.el
(autoload 'eieio-browse "eieio-opt" "\