Commit graph

379 commits

Author SHA1 Message Date
Stefan Monnier
67c477ae67 * lisp/emacs-lisp/byte-run.el (function-put): New function.
(defun-declarations-alist): Use it.  Add `pure' and `side-effect-free'.
* lisp/emacs-lisp/cl-macs.el (cl-defstruct, cl-struct-sequence-type)
(cl-struct-slot-info, cl-struct-slot-offset, cl-struct-slot-value):
Use them.
2014-04-22 12:22:13 -04:00
Daniel Colascione
66fda7948f Optimize cl-struct-slot-value; fix test
2014-04-22  Daniel Colascione  <dancol@dancol.org>

	* emacs-lisp/cl-macs.el
	(cl-struct-sequence-type,cl-struct-slot-info): Declare pure.
	(cl-struct-slot-value): Conditionally use aref or nth so that the
	compiler produces optimal code.

2014-04-22  Daniel Colascione  <dancol@dancol.org>

	* automated/cl-lib.el (cl-lib-struct-accessors): Fix test to
	account for removal of `cl-struct-set-slot-value'.
2014-04-21 20:51:12 -07:00
Stefan Monnier
d6f14ca729 * lisp/emacs-lisp/cl-macs.el (cl-struct-slot-offset): Mark as pure.
(cl--set-elt): Don't proclaim as inline.
(cl-struct-slot-value): Remove explicit gv-setter and compiler-macro.
Define as inlinable instead.
(cl-struct-set-slot-value): Remove.
* doc/misc/cl.texi (Structures): Remove cl-struct-set-slot-value.
* lisp/emacs-lisp/cl-lib.el (cl--set-elt): Remove.
* lisp/emacs-lisp/cl-seq.el (cl-replace, cl-substitute, cl-nsubstitute):
Use setf instead.
2014-04-21 23:18:15 -04:00
Stefan Monnier
622eef687c * lisp/emacs-lisp/cl-macs.el (cl--loop-let): Avoid `nil' as var name. 2014-04-21 17:18:12 -04:00
Daniel Colascione
44faec1788 Remove excess parameters on cl--const-expr-val
2014-04-21  Daniel Colascione  <dancol@dancol.org>

	* emacs-lisp/cl-macs.el (cl--const-expr-val): We didn't need the
	last two parameters after all.
	(cl--expr-contains,cl--compiler-macro-typep,cl--compiler-macro-member)
	(cl--compiler-macro-assoc,cl-struct-slot-value)
	(cl-struct-set-slot-value): Stop using them.
2014-04-21 11:00:19 -07:00
Daniel Colascione
2fa1b97db0 Fix cl-loop destructuring under `with' clause 2014-04-20 18:03:39 -07:00
Daniel Colascione
e100022976 unbreak the build 2014-04-20 07:46:13 -07:00
Daniel Colascione
89a2e783c2 defstruct introspection 2014-04-19 19:34:22 -07:00
Daniel Colascione
544ab460f5 Backport &key-parsing improvement from trunk 2014-03-24 13:41:08 -07:00
Daniel Colascione
1edb4a2ec6 Improve performance of &key parsing 2014-03-23 20:06:35 -07:00
Daniel Colascione
7eab98da1b Fix keyword argument parsing. Please bootstrap. 2014-03-22 23:00:18 -07:00
Daniel Colascione
c6b0fbe7db Fix cl-defun keyword arg parsing. Please bootstrap. 2014-03-22 22:50:24 -07:00
Stefan Monnier
3d136b1b72 * lisp/emacs-lisp/cl-macs.el (cl-define-compiler-macro): Add indent rule.
Fixes: debbugs:16829
2014-02-21 12:45:26 -05:00
Stefan Monnier
d4f0427be7 * lisp/emacs-lisp/cl-macs.el: Improve type->predicate mapping.
(cl--macroexp-fboundp): New function.
(cl--make-type-test): Use it.

Fixes: debbugs:16520
2014-01-23 10:01:41 -05:00
Paul Eggert
ba3189039a Update copyright year to 2014 by running admin/update-copyright. 2014-01-01 07:43:34 +00:00
Stefan Monnier
3220d5279d * lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet): Use macroexp-progn.
(cl--block-wrapper): Fix last accidental change.
2013-11-07 14:30:43 -05:00
Nathan Trapuzzano
e6e4db3cac * lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet): Print warning for
malformed bindings form.

Fixes: debbugs:15814
2013-11-06 23:38:00 -05:00
Stefan Monnier
3b7b269256 * lisp/emacs-lisp/cl-macs.el:
(cl--loop-destr-temps): Remove.
(cl--loop-iterator-function): Rename from cl--loop-map-form and change
its convention.
(cl--loop-set-iterator-function): New function.
(cl-loop): Adjust accordingly, so as not to use cl-subst.
(cl--parse-loop-clause): Adjust all uses of cl--loop-map-form.
Bind `it' with `let' instead of substituting it with `cl-subst'.
(cl--unused-var-p): New function.
(cl--loop-let): Don't use the cl--loop-destr-temps hack any more.
Eliminate some unused variable warnings.

Fixes: debbugs:15326
2013-09-27 21:07:18 -04:00
Daniel Colascione
0057865926 * emacs-lisp/cl-macs.el (cl-type-spec): Tell edebug what type
specs are and that they're not evaluated.
2013-09-25 14:39:53 -08:00
Glenn Morris
a2c501b84e * lisp/emacs-lisp/cl-macs.el (cl-defsubst): Remove unused local `pbody'. 2013-09-19 16:31:54 -04:00
Stefan Monnier
e8dfd19797 * lisp/emacs-lisp/cl-macs.el (cl-defsubst): Make it clear that args
are immutable.  Don't use `unsafe' any more.
(cl--defsubst-expand): Don't substitute at the same time as keeping
a residual unused let-binding.  Don't use `unsafe' any more.
2013-08-28 23:49:10 -04:00
Stefan Monnier
5514cc4c84 * lisp/emacs-lisp/timer.el (timer--time-setter): New function.
(timer--time): Use it as gv-setter.
* lisp/emacs-lisp/gv.el (gv-define-simple-setter): Output warning when
setter is not a symbol.
2013-08-12 22:30:52 -04:00
Juanma Barranquero
1048af7c8f lisp/emacs-lisp/cl-macs.el: Fix typos in docstrings. 2013-07-12 03:11:22 +02:00
Stefan Monnier
120597093d * lisp/emacs-lisp/package.el: Include obsolete packages from archives.
Use lexical-binding.
(package-archive-contents): Change format; include obsolete packages.
(package-desc): Use `dir' to mark builtin packages.
(package--from-builtin): Set the `dir' field to `builtin'.
(generated-autoload-file, version-control): Declare.
(package-compute-transaction): Change first arg and return value to be
lists of package-descs.  Adjust to new package-archive-contents format.
(package--add-to-archive-contents): Adjust to new
package-archive-contents format.
(package-download-transaction): Arg is now a list of package-descs.
(package-install): If `pkg' is a package name, pass it as
a requirement, so it is subject to the usual (e.g. disabled) checks.
(describe-package): Accept package-desc as well.
(describe-package-1): Describe a specific package-desc.  Add links to
other package-descs for the same package name.
(package-menu-describe-package): Pass the actual package-desc.
(package-menu-mode): Add to tabulated-list-revert-hook so revert-buffer
works correctly.
(package-desc-status): New function.
(package-menu--refresh): New function, extracted
from package-menu--generate.
(package-menu--generate): Use it.
(package-delete): Update package-alist.
(package-menu-execute): Don't call package-initialize.

* lisp/progmodes/idlw-toolbar.el, lisp/progmodes/idlw-shell.el,
lisp/progmodes/idlw-help.el, lisp/progmodes/idlw-complete-structtag.el,
lisp/progmodes/ebnf-yac.el, lisp/progmodes/ebnf-otz.el,
lisp/progmodes/ebnf-iso.el, lisp/progmodes/ebnf-ebx.el,
lisp/progmodes/ebnf-dtd.el, lisp/progmodes/ebnf-bnf.el,
lisp/progmodes/ebnf-abn.el, lisp/emacs-lisp/package-x.el,
lisp/emacs-lisp/cl-seq.el, lisp/emacs-lisp/cl-macs.el
lisp/cedet/data-debug.el, lisp/cedet/cedet-idutils.el:
Neuter the "Version:" header.
2013-06-25 12:13:49 -04:00
Stefan Monnier
aff6371e32 * lisp/emacs-lisp/cl-loaddefs.el: Don't version-control any more.
* lisp/emacs-lisp/cl-lib.el: Load cl-macs when cl-loaddefs is not
yet available.
* lisp/Makefile.in (AUTOGEN_VCS): Move cl-loaddefs.el...
(AUTOGENEL): ... here.
* lisp/emacs-lisp/cl-macs.el (cl--sublis): New function.
(cl--defsubst-expand): Use it.
* .bzrignore: Don't unignore cl-loaddefs.el.
2013-06-20 16:01:51 -04:00
Stefan Monnier
cf4e5178a3 * lisp/help-fns.el (help-fns--compiler-macro): If the handler function is
named, then put a link to it.
* lisp/help-mode.el (help-function-cmacro): Adjust regexp for cl-lib names.
* lisp/emacs-lisp/cl-macs.el (cl--compiler-macro-typep): New function.
(cl-typep): Use it.
(cl-eval-when): Simplify debug spec.
(cl-define-compiler-macro): Use eval-and-compile.  Give a name to the
compiler-macro function instead of setting `compiler-macro-file'.
2013-06-11 22:16:02 -04:00
Stefan Monnier
208d0342a3 Fix compilation error with simultaneous dynamic+lexical scoping.
Add warning when a defvar appears after the first let-binding.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lexical-variables): New var.
(byte-compile-close-variables): Initialize it.
(byte-compile--declare-var): New function.
(byte-compile-file-form-defvar)
(byte-compile-file-form-define-abbrev-table)
(byte-compile-file-form-custom-declare-variable): Use it.
(byte-compile-make-lambda-lexenv): Change the argument.  Simplify.
(byte-compile-lambda): Share call to byte-compile-arglist-vars.
(byte-compile-bind): Handle dynamic bindings that shadow
lexical bindings.
(byte-compile-unbind): Make arg non-optional.
(byte-compile-let): Simplify.
* lisp/emacs-lisp/cconv.el (byte-compile-lexical-variables): Declare var.
(cconv--analyse-function, cconv-analyse-form): Populate it.
Protect byte-compile-bound-variables to limit the scope of defvars.
(cconv-analyse-form): Add missing rule for (defvar <foo>).
Remove unneeded rule for `declare'.

* lisp/emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin): Use macroexp-let2
so as to avoid depending on cl-adjoin at run-time.
* lisp/emacs-lisp/cl-lib.el (cl-pushnew): Use backquotes.

* lisp/emacs-lisp/macroexp.el (macroexp--compiling-p): New function.
(macroexp--warn-and-return): Use it.
2013-06-04 22:35:40 -04:00
Glenn Morris
d5837773e0 * lisp/emacs-lisp/cl-macs.el (cl-loop): Doc fix. 2013-05-09 22:01:12 -04:00
Glenn Morris
1dfcc79e83 Make cl-floatp-safe just an alias for floatp
* lisp/emacs-lisp/cl-lib.el (cl-floatp-safe): Make it an alias for floatp.

* lisp/emacs-lisp/cl-macs.el (cl--make-type-test)
(cl--compiler-macro-assoc): Use floatp rather than cl-floatp-safe.

* doc/misc/cl.texi: Remove commented out sections about cl-floatp-safe.
2013-02-19 21:07:07 -05:00
Paul Eggert
0877d0dc24 Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca 2013-01-02 08:13:04 -08:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Stefan Monnier
4611a3cce7 * lisp/emacs-lisp/cl-macs.el (cl-tagbody): New macro. 2012-12-06 22:56:57 -05:00
Stefan Monnier
338bfefacb Further cleanup of the "cl-" namespace. Fit CL in 80 columns.
* lisp/emacs-lisp/cl-macs.el (cl--pop2, cl--optimize-safety)
(cl--optimize-speed, cl--not-toplevel, cl--parse-loop-clause)
(cl--expand-do-loop, cl--proclaim-history, cl--declare-stack)
(cl--do-proclaim, cl--proclaims-deferred): Rename from the "cl-" prefix.
(cl-progv): Don't rely on dynamic scoping to find the body.
* lisp/emacs-lisp/cl-lib.el (cl--optimize-speed, cl--optimize-safety)
(cl--proclaims-deferred): Rename from the "cl-" prefix.
(cl-declaim): Use backquotes.
* lisp/emacs-lisp/cl-extra.el (cl-make-random-state, cl-random-state-p):
Use "cl--" prefix for the object's tag.
2012-12-06 16:29:29 -05:00
Glenn Morris
5c9cf0a3f9 Merge from emacs-24; up to 2012-11-20T20:06:17Z!monnier@iro.umontreal.ca 2012-11-26 19:10:32 -08:00
Stefan Monnier
35a1051652 * lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Add back `declare' in
the constructs to keep outside of the `cl-block'.

Fixes: debbugs:12977
2012-11-24 16:34:28 -05:00
Glenn Morris
96e055075d Merge from emacs-24; up to 2012-11-13T18:57:26Z!dgutov@yandex.ru 2012-11-16 09:20:23 -08:00
Juanma Barranquero
662b0ee67c lisp/emacs-lisp/cl-macs.el (cl-loop, cl-do, cl-do*): Doc fixes. 2012-11-15 22:01:25 +01:00
Stefan Monnier
eb31fa401d * lisp/emacs-lisp/cl-macs.el (cl-flet, cl-flet*): Fix docstring.
Fixes: debbugs:12895
2012-11-15 13:35:05 -05:00
Stefan Monnier
589fc4791f * lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Defend against
potential binding of print-gensym to t, and prettify (back)quotes in
case they appear in args's default values.

Fixes: debbugs:12884
2012-11-14 20:26:52 -05:00
Stefan Monnier
413d4689c0 * lisp/emacs-lisp/cl.el (dolist, dotimes, declare): Use advice-add to
override the default.
* lisp/emacs-lisp/cl-macs.el (cl-dolist, cl-dotimes): Rewrite without using
cl--dotimes/dolist.
* lisp/subr.el (dolist, dotimes, declare): Redefine them normally, even when
`cl' is loaded.

* lisp/emacs-lisp/nadvice.el (advice--normalize): New function, extracted
from add-advice.
(advice--strip-macro): New function.
(advice--defalias-fset): Use them to handle macros.
(advice-add): Use them.
(advice-member-p): Correctly handle macros.
2012-11-12 22:00:09 -05:00
Glenn Morris
5593ed900d Misc small cl doc fixes
* emacs-lisp/cl-extra.el (cl-maplist, cl-mapcan): Doc fix.

* emacs-lisp/cl-extra.el (cl-prettyexpand):
* emacs-lisp/cl-lib.el (cl-proclaim, cl-declaim):
* emacs-lisp/cl-macs.el (cl-destructuring-bind, cl-locally)
(cl-the, cl-compiler-macroexpand): Add basic doc strings.
2012-11-05 00:29:12 -08:00
Glenn Morris
4913840013 Rename cl-loop-handler, cl-loop-for-handler back to their original names
* lisp/emacs-lisp/cl-macs.el (cl-parse-loop-clause):
Rename handler properties back from cl-- to cl-.

Fixes: debbugs:12788
2012-11-03 11:32:09 -07:00
Glenn Morris
5c677d4410 * lisp/emacs-lisp/cl-macs.el (cl-do-all-symbols): Add doc string. 2012-11-03 11:03:39 -07:00
Glenn Morris
a05cb6e326 More cl doc updates
* doc/misc/cl.texi: Don't mess with the TeX section number counter.
Use Texinfo recommended convention for quotes+punctuation.
(Overview, Sequence Functions): Rephrase for better line-breaking.
(Time of Evaluation, Type Predicates, Modify Macros, Function Bindings)
(Macro Bindings, Conditionals, Iteration, Loop Basics)
(Random Numbers, Mapping over Sequences, Structures)
(Porting Common Lisp): Further updates for cl-lib namespace.
(Modify Macros, Declarations, Macro Bindings, Structures):
Break long lines in examples.
(Dynamic Bindings): Update for changed progv behavior.
(Loop Examples, Efficiency Concerns): Markup fixes.
(Structures): Remove TeX margin change.

* lisp/emacs-lisp/cl-macs.el (cl-progv): Doc fix.

* etc/NEWS: Related markup.
2012-10-24 20:58:40 -04:00
Stefan Monnier
94c66ce57b * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Obey the :read-only property. 2012-10-09 02:01:10 -04:00
Stefan Monnier
685f87b00f * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Improve docstring. 2012-10-06 13:34:57 -04:00
Glenn Morris
e60b51abaa * bytecomp.el (byte-compile-cl-file-p): Only "cl.el" counts as cl these days.
Remove no longer appropriate file-local suppression of CL warnings in
lisp/emacs-lisp/cl-*.el files.
2012-09-28 19:30:52 -04:00
Stefan Monnier
9b851e2550 New emacs-lisp-byte-code-mode; misc minor changes.
* lisp/emacs-lisp/lisp-mode.el (emacs-list-byte-code-comment-re): New var.
(emacs-lisp-byte-code-comment)
(emacs-lisp-byte-code-syntax-propertize, emacs-lisp-byte-code-mode):
New functions.
(eval-sexp-add-defvars): Don't skip defvars in column >0.
(eval-defun-2): Remove bogus interactive spec.
(lisp-indent-line): Remove redundant whole-exp code, now done in
indent-according-to-mode.
(save-match-data): Remove redundant indent data.
* lisp/emacs-lisp/benchmark.el (benchmark-run, benchmark-run-compiled):
Use `declare'.
* lisp/gnus/qp.el (quoted-printable-decode-region):
Inline+CSE+strength-reduction.
2012-09-09 21:16:13 -04:00
Stefan Monnier
d458ef98df * lisp/emacs-lisp/cl-macs.el (cl--do-arglist): Understand _ on &key args.
(cl--make-usage-args): Strip _ from argument names.

Fixes: debbugs:12367
2012-09-06 11:35:08 -04:00
Stefan Monnier
972debf2e7 Macro-expand interpreted code during load.
* src/lread.c (readevalloop): Call internal-macroexpand-for-load to perform
eager (load-time) macro-expansion.
* src/lisp.mk (lisp): Add macroexp.
* lisp/loadup.el: Load macroexp.  Remove hack.
* lisp/emacs-lisp/macroexp.el (macroexp--eval-if-compile): New function.
(macroexp--expand-all): Use it to get better warnings.
(macroexp--backtrace, macroexp--trim-backtrace-frame)
(internal-macroexpand-for-load): New functions.
(macroexp--pending-eager-loads): New var.
(emacs-startup-hook): New hack to replace one in loadup.el.
* lisp/emacs-lisp/cl-macs.el (cl--compiler-macro-list*)
(cl--compiler-macro-cXXr): Move to top, before they can be used.
(cl-psetf): Simplify.
(cl-defstruct): Add indent rule.
2012-09-04 13:40:25 -04:00