Commit 26533185 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* 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.
parent 4e946894
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> 2014-10-18 Jan Djärv <jan.h.d@swipnet.se>
   
* cus-start.el (x-gtk-whole-detached-tool-bar): Remove. * cus-start.el (x-gtk-whole-detached-tool-bar): Remove.
...@@ -33,7 +44,7 @@ ...@@ -33,7 +44,7 @@
   
2014-10-17 Michal Nazarewicz <mina86@mina86.com> 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. tildify-mode-alist.
   
2014-10-17 Stefan Monnier <monnier@iro.umontreal.ca> 2014-10-17 Stefan Monnier <monnier@iro.umontreal.ca>
......
...@@ -33,20 +33,6 @@ ...@@ -33,20 +33,6 @@
(require 'cl-lib) (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 (put 'eieio--defalias 'byte-hunk-handler
#'byte-compile-file-form-defalias) ;;(get 'defalias 'byte-hunk-handler) #'byte-compile-file-form-defalias) ;;(get 'defalias 'byte-hunk-handler)
(defun eieio--defalias (name body) (defun eieio--defalias (name body)
...@@ -117,12 +103,12 @@ default setting for optimization purposes.") ...@@ -117,12 +103,12 @@ default setting for optimization purposes.")
(defmacro eieio--with-scoped-class (class &rest forms) (defmacro eieio--with-scoped-class (class &rest forms)
"Set CLASS as the currently scoped class while executing FORMS." "Set CLASS as the currently scoped class while executing FORMS."
(declare (indent 1))
`(unwind-protect `(unwind-protect
(progn (progn
(push ,class eieio--scoped-class-stack) (push ,class eieio--scoped-class-stack)
,@forms) ,@forms)
(pop eieio--scoped-class-stack))) (pop eieio--scoped-class-stack)))
(put 'eieio--with-scoped-class 'lisp-indent-function 1)
;;; ;;;
;; Field Accessors ;; Field Accessors
...@@ -678,26 +664,12 @@ See `defclass' for more information." ...@@ -678,26 +664,12 @@ See `defclass' for more information."
;; Else - Some error? nil? ;; Else - Some error? nil?
nil))) nil)))
(if (fboundp 'gv-define-setter)
;; FIXME: We should move more of eieio-defclass into the ;; FIXME: We should move more of eieio-defclass into the
;; defclass macro so we don't have to use `eval' and require ;; defclass macro so we don't have to use `eval' and require
;; `gv' at run-time. ;; `gv' at run-time.
(eval `(gv-define-setter ,acces (eieio--store eieio--object) (eval `(gv-define-setter ,acces (eieio--store eieio--object)
(list 'eieio-oset eieio--object '',name (list 'eieio-oset eieio--object '',name
eieio--store))) 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--))))))))
;; If a writer is defined, then create a generic method of that ;; If a writer is defined, then create a generic method of that
;; name whose purpose is to set the value of the slot. ;; name whose purpose is to set the value of the slot.
...@@ -2099,30 +2071,12 @@ is memorized for faster future use." ...@@ -2099,30 +2071,12 @@ is memorized for faster future use."
;;; Here are some special types of errors ;;; Here are some special types of errors
;; ;;
(intern "no-method-definition") (define-error 'no-method-definition "No method definition")
(put 'no-method-definition 'error-conditions '(no-method-definition error)) (define-error 'no-next-method "No next method")
(put 'no-method-definition 'error-message "No method definition") (define-error 'invalid-slot-name "Invalid slot name")
(define-error 'invalid-slot-type "Invalid slot type")
(intern "no-next-method") (define-error 'unbound-slot "Unbound slot")
(put 'no-next-method 'error-conditions '(no-next-method error)) (define-error 'inconsistent-class-hierarchy "Inconsistent class hierarchy")
(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")
;;; Obsolete backward compatibility functions. ;;; Obsolete backward compatibility functions.
;; Needed to run byte-code compiled with the EIEIO of Emacs-23. ;; Needed to run byte-code compiled with the EIEIO of Emacs-23.
......
...@@ -356,7 +356,7 @@ are not abstract." ...@@ -356,7 +356,7 @@ are not abstract."
(insert "' " (aref prefix i) " ") (insert "' " (aref prefix i) " ")
;; argument list ;; argument list
(let* ((func (cdr (car gm))) (let* ((func (cdr (car gm)))
(arglst (eieio-lambda-arglist func))) (arglst (help-function-arglist func)))
(prin1 arglst (current-buffer))) (prin1 arglst (current-buffer)))
(insert "\n" (insert "\n"
(or (documentation (cdr (car gm))) (or (documentation (cdr (car gm)))
...@@ -374,13 +374,6 @@ are not abstract." ...@@ -374,13 +374,6 @@ are not abstract."
(insert "\n"))) (insert "\n")))
(setq i (1+ i))))))) (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) (defun eieio-all-generic-functions (&optional class)
"Return a list of all generic functions. "Return a list of all generic functions.
Optional CLASS argument returns only those functions that contain Optional CLASS argument returns only those functions that contain
...@@ -419,15 +412,15 @@ function has no documentation, then return nil." ...@@ -419,15 +412,15 @@ function has no documentation, then return nil."
(fboundp after))) (fboundp after)))
nil nil
(list (if (fboundp before) (list (if (fboundp before)
(cons (eieio-lambda-arglist before) (cons (help-function-arglist before)
(documentation before)) (documentation before))
nil) nil)
(if (fboundp primary) (if (fboundp primary)
(cons (eieio-lambda-arglist primary) (cons (help-function-arglist primary)
(documentation primary)) (documentation primary))
nil) nil)
(if (fboundp after) (if (fboundp after)
(cons (eieio-lambda-arglist after) (cons (help-function-arglist after)
(documentation after)) (documentation after))
nil)))))) nil))))))
......
...@@ -910,7 +910,7 @@ Optional argument GROUP is the sub-group of slots to display. ...@@ -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 ;;; Generated autoloads from eieio-opt.el
(autoload 'eieio-browse "eieio-opt" "\ (autoload 'eieio-browse "eieio-opt" "\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment