1. 16 Mar, 2015 1 commit
  2. 05 Mar, 2015 1 commit
    • Stefan Monnier's avatar
      Replace *-function vars with generic functions in cl-generic. · 21c54786
      Stefan Monnier authored
      * lisp/emacs-lisp/cl-generic.el (cl--generic-generalizer): New struct.
      (cl-generic-tagcode-function, cl-generic-tag-types-function): Remove.
      (cl--generic-t-generalizer): New const.
      (cl--generic-make-method): Rename from `cl--generic-method-make'.
      (cl--generic-make): Change calling convention.
      (cl--generic): Add `options' field.
      (cl-generic-function-options): New function.
      (cl-defgeneric): Rewrite handling of options.  Add support for :method
      options and allow the use of a default body.
      (cl-generic-define): Save options in the corresponding new field.
      (cl-defmethod): Fix ordering of qualifiers.
      (cl-generic-define-method): Use cl-generic-generalizers.
      (cl--generic-get-dispatcher): Change calling convention, and change
      calling convention of the returned function as well so as to take the
      list of methods separately from the generic function object, so that it
      can receive the original generic function object.
      (cl--generic-make-next-function): New function, extracted from
      (cl--generic-make-function): Use it.
      (cl-generic-method-combination-function): Remove.
      (cl--generic-cyclic-definition): New error.
      (cl-generic-call-method): Take a generic function object rather than
      its name.
      (cl-method-qualifiers): New alias.
      (cl--generic-build-combined-method): Use cl-generic-combine-methods,
      don't segregate by qualifiers here any more.
      (cl--generic-standard-method-combination): Segregate by qualifiers
      here instead.  Add support for the `:extra' qualifier.
      (cl--generic-cache-miss): Move earlier, adjust to new calling convention.
      (cl-generic-generalizers, cl-generic-combine-methods):
      New generic functions.
      (cl-no-next-method, cl-no-applicable-method, cl-no-primary-method):
      Use the new "default method in defgeneric" functionality, change
      calling convention to receive a generic function object.
      (cl--generic-head-used): New var.
      (cl--generic-head-generalizer, cl--generic-eql-generalizer)
      (cl--generic-struct-generalizer, cl--generic-typeof-generalizer):
      New consts.
      * lisp/emacs-lisp/eieio-core.el (eieio--generic-generalizer)
      (eieio--generic-subclass-generalizer): New consts.
      (cl-generic-generalizers): New methods.
      * lisp/emacs-lisp/eieio-compat.el (eieio--generic-static-symbol-generalizer)
      (eieio--generic-static-object-generalizer): New consts.
      (cl-generic-generalizers) <(head eieio--static)>: New method.
      * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
      Unfold closures like lambdas.
  3. 23 Feb, 2015 1 commit
  4. 16 Feb, 2015 1 commit
  5. 09 Feb, 2015 1 commit
  6. 04 Feb, 2015 1 commit
  7. 31 Jan, 2015 1 commit
    • Stefan Monnier's avatar
      EIEIO: Simplify help hyperlinks; Try and reduce hardcoding in .elc · e0be229d
      Stefan Monnier authored
      * lisp/emacs-lisp/cl-generic.el (cl--generic-search-method): Fix regexp.
      * lisp/emacs-lisp/eieio-core.el (eieio--check-type): Remove.
      Use cl-check-type everywhere instead.
      (eieio-class-object): Remove, use find-class instead when needed.
      (class-p): Don't inline.
      (eieio-object-p): Check more thoroughly, so we don't treat cl-structs,
      such as eieio classes, as objects.  Don't inline.
      (object-p): Mark as obsolete.
      (eieio-defclass-autoload, eieio-defclass-internal, eieio-oref)
      (eieio--generic-tagcode): Avoid `class-p'.
      (eieio-make-class-predicate, eieio-make-child-predicate): New functions.
      (eieio-defclass-internal): Use current-load-list rather than
      * lisp/emacs-lisp/eieio-opt.el (eieio-help-class, eieio-help-constructor):
      Use find-lisp-object-file-name, help-fns-short-filename and new calling
      convention for eieio-class-def.
      (eieio-build-class-list): Remove function, unused.
      (eieio-method-def): Remove button type, unused.
      (eieio-class-def): Inherit from help-function-def.
      (eieio--defclass-regexp): New constant.
      (find-function-regexp-alist): Use it.
      (eieio--specializers-apply-to-class-p): Handle eieio--static as well.
      (eieio-help-find-method-definition, eieio-help-find-class-definition):
      Remove functions.
      * lisp/emacs-lisp/eieio.el (defclass): Use new eieio-make-class-predicate
      and eieio-make-child-predicate.
      (eieio-class-parents): Use eieio--class-object.
      (slot-boundp, find-class, eieio-override-prin1): Avoid class-p.
      (slot-exists-p): Use find-class.
      * test/automated/eieio-tests.el (eieio-test-23-inheritance-check): Simplify.
  8. 28 Jan, 2015 1 commit
    • Stefan Monnier's avatar
      Tighten up the tagcode used for eieio and cl-struct objects · 2668ac1a
      Stefan Monnier authored
      * lisp/emacs-lisp/eieio-core.el (eieio-defclass-internal): Set the function
      slot of the tag symbol to :quick-object-witness-check.
      (eieio-object-p): Use :quick-object-witness-check.
      (eieio--generic-tagcode): Use cl--generic-struct-tag.
      * lisp/emacs-lisp/cl-preloaded.el: New file.
      * lisp/emacs-lisp/cl-macs.el (cl--bind-inits): Remove, unused.
      (cl--transform-lambda, cl-destructuring-bind): Remove cl--bind-inits.
      (cl--make-usage-args): Strip away &aux args.
      (cl-case, cl-typecase, cl--parse-loop-clause): Use macroexp-let2.
      (cl-the, cl-check-type): Use macroexp-let2 and cl-typep.
      (cl-defstruct): Use `declare' and cl-struct-define.
      * lisp/emacs-lisp/cl-generic.el (cl--generic-struct-tag): New function.
      (cl--generic-struct-tagcode): Use it to tighten the tagcode.
      * lisp/loadup.el: Load cl-preloaded.
      * src/lisp.mk (lisp): Add cl-preloaded.
  9. 26 Jan, 2015 2 commits
    • Stefan Monnier's avatar
      * lisp/emacs-lisp/cl-generic.el (cl--generic-method): New struct. · a9a3d429
      Stefan Monnier authored
      (cl--generic): The method-table is now a (list-of cl--generic-method).
      (cl--generic-member-method): New function.
      (cl-generic-define-method): Use it.
      (cl--generic-build-combined-method, cl--generic-cache-miss):
      Adapt to new method-table.
      (cl--generic-no-next-method-function): Add `method' argument.
      (cl-generic-call-method): Adapt to new method representation.
      (cl--generic-cnm-sample, cl--generic-nnm-sample): Adjust.
      (cl-find-method, cl-method-qualifiers): New functions.
      (cl--generic-method-info): Adapt to new method representation.
      Return a string for the qualifiers.
      * lisp/emacs-lisp/eieio-opt.el (eieio-help-class): Adjust accordingly.
      (eieio-all-generic-functions, eieio-method-documentation):
      Adjust to new method representation.
      * lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Use cl-find-method.
      * test/automated/cl-generic-tests.el: Try and make sure cl-lib is not
      required at run-time.
    • Stefan Monnier's avatar
      * lisp/emacs-lisp/cl-generic.el: Add a method-combination hook. · 4cdde919
      Stefan Monnier authored
      (cl-generic-method-combination-function): New var.
      (cl--generic-lambda): Remove `with-cnm' arg.
      (cl-defmethod): Change accordingly.
      (cl-generic-define-method): Don't check qualifiers validity.
      Preserve all qualifiers in `method-table'.
      (cl-generic-call-method): New function.
      (cl--generic-nest): Remove (morph into cl-generic-call-method).
      (cl--generic-build-combined-method): Adjust to new format of method-table
      and use cl-generic-method-combination-function.
      (cl--generic-standard-method-combination): New function, extracted from
      (cl--generic-cnm-sample): Adjust to new format of method-table.
      * lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Use () qualifiers
      instead of :primary.
      * lisp/emacs-lisp/eieio-datadebug.el (eieio-debug-methodinvoke):
      Remove obsolete function.
      * test/automated/cl-generic-tests.el (cl-generic-test-11-next-method-p):
      New test.
  10. 25 Jan, 2015 1 commit
    • Stefan Monnier's avatar
      * lisp/emacs-lisp/cl-generic.el: Fix next-method-p test · c4e54f96
      Stefan Monnier authored
      Fixes: debbugs:19672
      * lisp/emacs-lisp/cl-generic.el (cl--generic-no-next-method-function): New.
      (cl--generic-build-combined-method, cl--generic-nnm-sample): Use it.
      (cl--generic-typeof-types): Add support for `sequence'.
      (cl-defmethod): Add non-keywords in the qualifiers.
  11. 23 Jan, 2015 1 commit
  12. 22 Jan, 2015 1 commit
  13. 21 Jan, 2015 1 commit
    • Stefan Monnier's avatar
      * lisp/emacs-lisp/eieio*.el: Fix up warnings and improve compatibility · 59e7fe6d
      Stefan Monnier authored
      Fixes: debbugs:19645
      * lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Add support for `declare'.
      (cl--generic-setf-rewrite): Setup the setf expander right away.
      (cl-defmethod): Make sure the setf expander is setup before we expand
      the body.
      (cl-defmethod): Silence byte-compiler warnings.
      (cl-generic-define-method): Shuffle code to change return value.
      (cl--generic-method-info): New function, extracted from
      (cl--generic-describe): Use it.
      * lisp/emacs-lisp/eieio-speedbar.el:
      * lisp/emacs-lisp/eieio-datadebug.el:
      * lisp/emacs-lisp/eieio-custom.el:
      * lisp/emacs-lisp/eieio-base.el: Use cl-defmethod.
      * lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Avoid no-next-method
      errors when there's a `before' but no `primary'.
      (next-method-p): Return nil rather than signal an error.
      (eieio-defgeneric): Remove bogus (fboundp 'method).
      * lisp/emacs-lisp/eieio-opt.el: Adapt to cl-generic.
      (eieio--specializers-apply-to-class-p):	New function.
      (eieio-all-generic-functions): Use it.
      (eieio-method-documentation): Use it as well as cl--generic-method-info.
      Change format of return value.
      (eieio-help-class): Adapt accordingly.
      * lisp/emacs-lisp/eieio.el: Use cl-defmethod.
      (defclass): Generate cl-defmethod calls; use setf methods for :accessor.
      (eieio-object-name-string): Declare as obsolete.
      * test/automated/cl-generic-tests.el (setf cl--generic-2): Make sure
      the setf can be used already in the body of the method.
  14. 20 Jan, 2015 1 commit
    • Stefan Monnier's avatar
      lisp/emacs-lisp/eieio*.el: Rewrite our generics on top of cl-generic · 3a8312d0
      Stefan Monnier authored
      * lisp/emacs-lisp/eieio-generic.el: Remove.
      (defgeneric, defmethod): Move to eieio-compat.el.  Mark obsolete.
      * lisp/emacs-lisp/eieio-compat.el: New file.
      * lisp/emacs-lisp/eieio.el: Don't require eieio-generic any more.
      * lisp/emacs-lisp/eieio-core.el (eieio--slot-originating-class-p):
      Remove unused function.
      (eieio-defclass): Move to eieio-compat.el.
      * lisp/emacs-lisp/macroexp.el (macroexp-macroexpand): New function.
      (macroexp--expand-all): Use it.
      * lisp/emacs-lisp/bytecomp.el (byte-compile-recurse-toplevel): Here too.
  15. 18 Jan, 2015 2 commits
    • Stefan Monnier's avatar
      EIEIO&cl-generic: Add obsolescence warnings and fix corner case · 2a61bd00
      Stefan Monnier authored
      * lisp/emacs-lisp/cl-generic.el (cl-generic-define-method): Correctly handle
      introduction of a new dispatch argument.
      (cl--generic-cache-miss): Handle dispatch on an argument which was not
      considered as dispatchable for this method.
      (cl-defmethod): Warn when adding a method to an obsolete generic function.
      (cl--generic-lambda): Make sure it works if cl-lib is not yet loaded.
      * lisp/emacs-lisp/eieio-generic.el (eieio--defgeneric-init-form):
      Use autoloadp.
      * lisp/emacs-lisp/eieio.el (defclass): Add obsolescence warning for the
      `newname' argument.
      * test/automated/cl-generic-tests.el (cl-generic-test-10-weird): New test.
      Rename other tests to preserve ordering.
    • Stefan Monnier's avatar
      * lisp/emacs-lisp/cl-generic.el: Add support for cl-next-method-p. · 909126de
      Stefan Monnier authored
      (cl-defmethod): Add edebug spec.
      (cl--generic-build-combined-method): Fix call to
      (cl--generic-nnm-sample, cl--generic-cnm-sample): New constant.
      (cl--generic-isnot-nnm-p): New function.
      (cl--generic-lambda): Use it to add support for cl-next-method-p.
      (cl-no-next-method, cl-no-applicable-method): Simplify arg list.
      (cl-next-method-p): New function.
  16. 17 Jan, 2015 1 commit
    • Stefan Monnier's avatar
      Improve handling of doc-strings and describe-function for cl-generic · 24b7f775
      Stefan Monnier authored
      * 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
  17. 16 Jan, 2015 1 commit
  18. 15 Jan, 2015 2 commits
    • Glenn Morris's avatar
    • Stefan Monnier's avatar
      * lisp/emacs-lisp/eieio-core.el: Provide support for cl-generic. · 483c98a0
      Stefan Monnier authored
      (eieio--generic-tagcode): New function.
      (cl-generic-tagcode-function): Use it.
      (eieio--generic-tag-types): New function.
      (cl-generic-tag-types-function): Use it.
      (eieio-object-p): Tighten up the test.
      * lisp/emacs-lisp/cl-generic.el (cl-generic-define-method): Fix paren typo.
      * test/automated/eieio-test-methodinvoke.el (eieio-test-method-store): Add
      keysym arg instead of relying on internal var eieio--generic-call-key.
      Update all callers.
      (eieio-test-cl-generic-1): New tests.
  19. 14 Jan, 2015 1 commit
    • Stefan Monnier's avatar
      * lisp/emacs-lisp/cl-generic.el: New file. · 9def17e9
      Stefan Monnier authored
      * lisp/emacs-lisp/cl-macs.el (cl-flet): Allow (FUN EXP) forms.
      (cl-load-time-value, cl-labels): Use closures rather than
      backquoted lambdas.
      (cl-macrolet): Use `eval' to create the function value, and support CL
      style arguments in for the defined macros.
      * test/automated/cl-generic-tests.el: New file.