Commit graph

3601 commits

Author SHA1 Message Date
Stefan Monnier
a61428c42d * lisp/emacs-lisp/nadvice.el: Add buffer-local support to add-function.
(advice--buffer-local-function-sample): New var.
(advice--set-buffer-local, advice--buffer-local): New functions.
(add-function, remove-function): Use them.
2012-11-14 22:20:49 -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
1668ea9062 * lisp/emacs-lisp/nadvice.el: Add around advice for interactive specs.
(advice-eval-interactive-spec): New function.
(advice--make-interactive-form): Support around advice.

Fixes: debbugs:12844
2012-11-14 15:27:42 -05:00
Stefan Monnier
9c3912d3d9 * lisp/emacs-lisp/gv.el (setf): Fix debug spec for multiple assignments.
Fixes: debbugs:12879
2012-11-13 20:12:52 -05:00
Tsuyoshi Kitamoto
a77b8d5eb0 * emacs-lisp/advice.el: Fix typos in comment. 2012-11-13 13:09:20 -05:00
Stefan Monnier
3c442f8b25 * lisp/emacs-lisp/advice.el: Layer on top of nadvice.el.
Remove out of date self-require hack.
(ad-do-advised-functions): Use simple `dolist'.
(ad-advice-name, ad-advice-protected, ad-advice-enabled)
(ad-advice-definition): Redefine as functions.
(ad-advice-classes): Move before first use.
(ad-make-origname, ad-set-orig-definition, ad-clear-orig-definition)
(ad-make-mapped-call, ad-make-advised-docstring, ad-make-plain-docstring)
(ad--defalias-fset): Remove functions.
(ad-make-advicefunname, ad-clear-advicefunname-definition): New functions.
(ad-get-orig-definition): Rewrite.
(ad-make-advised-definition-docstring): Change base docstring.
(ad-real-orig-definition): Rewrite.
(ad-map-arglists): Change name of called function.
(ad--make-advised-docstring): Redirect `function' from ad-Advice-...
(ad-make-advised-definition): Simplify.
(ad-assemble-advised-definition): Tweak for new calling context.
(ad-activate-advised-definition): Setup ad-Advice-* instead of ad-Orig-*.
(ad--defalias-fset): Rename from ad-handle-definition.  Make it set the
function and call ad-activate if needed.
(ad-activate, ad-deactivate): Don't call ad-handle-definition any more.
(ad-recover): Clear ad-Advice-* instead of ad-Orig-*.
(ad-compile-function): Compile ad-Advice-*.
(ad-activate-on-top-level, ad-with-auto-activation-disabled): Remove.
(ad-start-advice, ad-stop-advice): Remove.
2012-11-13 09:12:46 -05:00
Stefan Monnier
7db1bda8a4 * lisp/emacs-lisp/advice.el: Remove support for freezing.
(ad-make-freeze-docstring, ad-make-freeze-definition): Remove functions.
(ad-make-single-advice-docstring, ad-defadvice-flags, defadvice):
Remove support for `freeze'.
2012-11-12 23:05:35 -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
f78ee6afc0 Merge from emacs-24; up to 2012-11-09T14:45:15Z!dmantipov@yandex.ru 2012-11-12 18:25:59 -08:00
Stefan Monnier
f8705f6e31 * lisp/emacs-lisp/gv.el (gv-define-simple-setter): One more fix.
Fixes: debbugs:12871
2012-11-12 16:31:15 -05:00
Stefan Monnier
231d8498eb * lisp/emacs-lisp/nadvice.el: New package.
* lisp/subr.el (special-form-p): New function.
* lisp/emacs-lisp/elp.el: Use lexical-binding and advice-add.
(elp-all-instrumented-list): Remove var.
(elp-not-profilable): Remove elp-wrapper.
(elp-profilable-p): Use autoloadp and special-form-p.
(elp--advice-name): New const.
(elp-instrument-function): Use advice-add.
(elp--instrumented-p): New predicate.
(elp-restore-function): Use advice-remove.
(elp-restore-all, elp-reset-all): Use mapatoms.
(elp-set-master): Use elp--instrumented-p.
(elp--make-wrapper): Rename from elp-wrapper, return a function
suitable for advice-add.  Use cl-inf.
(elp-results): Use mapatoms+elp--instrumented-p.
* lisp/emacs-lisp/debug.el: Use lexical-binding and advice-add.
(debug-function-list): Remove var.
(debug): Rename arg, and then let-bind it explicitly inside.
(debugger-setup-buffer): Rename arg.
(debugger-setup-buffer): Adjust counts to new debug-on-entry setup.
(debugger-frame-number): Adjust to new debug-on-entry setup.
(debug--implement-debug-on-entry): Rename from
implement-debug-on-entry, add argument.
(debugger-special-form-p): Remove, use special-form-p instead.
(debug-on-entry): Use advice-add.
(debug--function-list): New function.
(cancel-debug-on-entry): Use it, along with advice-remove.
(debug-arglist, debug-convert-byte-code, debug-on-entry-1): Remove.
(debugger-list-functions): Use debug--function-list instead of
debug-function-list.
* lisp/emacs-lisp/advice.el (ad-save-real-definition): Remove, unused.
(ad-special-form-p): Remove, use special-form-p instead.
(ad-set-advice-info): Use add-function and remove-function.
(ad--defalias-fset): Adjust accordingly.
* test/automated/advice-tests.el: New tests.
2012-11-12 15:43:43 -05:00
Glenn Morris
c02ed5ace8 Auto-commit of loaddefs files. 2012-11-11 06:22:06 -05:00
Glenn Morris
57fc0fee5f Document debugger-bury-or-kill
* doc/lispref/debugging.texi (Using Debugger): Mention debugger-bury-or-kill.

* lisp/emacs-lisp/debug.el (debugger-bury-or-kill): Doc tweak.

* etc/NEWS: Related edit.
2012-11-10 17:16:25 -08:00
Glenn Morris
68146aa5ab * lisp/emacs-lisp/debug.el (debugger-bury-or-kill): Fix :version. 2012-11-10 16:40:37 -08:00
Glenn Morris
6baf66d53b Merge from emacs-24; up to 2012-11-08T14:54:03Z!monnier@iro.umontreal.ca 2012-11-10 15:13:33 -08:00
Stefan Monnier
32e5c58ca9 Provide new `defalias-fset-function' symbol property.
* src/lisp.h (AUTOLOADP): New macro.
* src/eval.c (Fautoload): Don't attach to loadhist, call Fdefalias instead.
* src/data.c (Ffset): Remove special ad-advice-info handling.
(Fdefalias): Handle autoload definitions and new Qdefalias_fset_function.
(Fsubr_arity): CSE.
(Finteractive_form): Simplify.
(Fquo): Don't insist on having at least 2 arguments.
(Qdefalias_fset_function): New var.
* lisp/emacs-lisp/advice.el (ad-set-advice-info): Set defalias-fset-function.
(ad--defalias-fset): New function.
(ad-safe-fset): Remove.
(ad-make-freeze-definition): Use cl-letf*.
2012-11-09 17:20:47 -05:00
Stefan Monnier
6858633a9c * lisp/emacs-lisp/advice.el: Miscellaneous cleanup. Use lexical-binding.
(fset, documentation): Don't save real def since we don't advise.
(ad-do-advised-functions): Remove problematic `result-form'.
(ad-safe-fset): `ad-real-fset' => `fset'.
(ad-read-advised-function): Don't assume that ad-do-advised-functions
uses CL's dolist internally.
(ad-arglist): Remove unused arg `name'.
(ad-docstring, ad-make-advised-docstring):
`ad-real-documentation' => `documentation'.
(warning-suppress-types): Declare.
(ad-set-arguments): Simple CSE.
(ad-recover-normality): Sanity check.
2012-11-09 15:41:03 -05:00
Stefan Monnier
f5925cd9f5 * lisp/emacs-lisp/bytecomp.el (byte-compile-out-toplevel): Don't turn
(funcall '(lambda ..) ..) into ((lambda ..) ..).
2012-11-09 10:56:51 -05:00
Stefan Monnier
57618ecf33 New property dynamic-docstring-function for docstrings.
* src/doc.c (Fdocumentation): Handle new property
dynamic-docstring-function to replace the old ad-advice-info.
* lisp/emacs-lisp/advice.el: Use new dynamic docstrings.
(ad-make-advised-definition-docstring, ad-advised-definition-p):
Use dynamic-docstring-function instead of ad-advice-info.
(ad--make-advised-docstring): New function extracted from
ad-make-advised-docstring.
(ad-make-advised-docstring): Use it.
* lisp/progmodes/sql.el (sql--make-help-docstring): New function, extracted
from sql-help.
(sql-help): Use it with dynamic-docstring-function.
2012-11-08 23:10:16 -05:00
Stefan Monnier
e703069f9c * lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
Byte-compile *before* eval in eval-and-compile.
(byte-compile-log-warning): Remove redundant inhibit-read-only.
(byte-compile-file-form-autoload): Don't hide actual definition.
(byte-compile-maybe-guarded): Accept `functionp' as well.
2012-11-08 09:58:15 -05:00
Stefan Monnier
a9a5c7f690 * lisp/emacs-lisp/gv.el (gv-deref): Move setter declaration, to fix bootstrap. 2012-11-08 09:54:03 -05:00
Stefan Monnier
32170f7ff2 * lisp/emacs-lisp/advice.el: Require `cl-lib' at run-time to fix
miscompilation of trace.el.
2012-11-08 09:36:47 -05:00
Stefan Monnier
784c1a7b3a * lisp/emacs-lisp/gv.el (gv-ref, gv-deref): New function and macro. 2012-11-08 09:21:21 -05:00
Stefan Monnier
d14bb752ea * lisp/emacs-lisp/gv.el (gv-ref, gv-deref): New function and macro. 2012-11-08 08:34:06 -05:00
Stefan Monnier
4162672227 * lisp/emacs-lisp/gv.el (gv-define-simple-setter): Fix last change.
Fixes: debbugs:12812
2012-11-07 20:24:14 -05:00
Glenn Morris
031b2ea7f5 More cl-lib and gv doc updates
* lisp/emacs-lisp/cl.el (define-setf-expander, defsetf)
(define-modify-macro): Doc fixes.

* doc/misc/cl.texi (Obsolete Setf Customization):
Give defsetf gv.el replacements.

* etc/NEWS: Related edit.
2012-11-07 00:56:16 -08:00
Glenn Morris
2ee1d59f5b Small doc updates for generalized variables
* lisp/emacs-lisp/gv.el (gv-letplace): Fix doc typo.
(gv-define-simple-setter): Update doc of `fix-return'.

* doc/lispref/variables.texi (Adding Generalized Variables):
Update description of FIX-RETURN expansion.

* doc/misc/cl.texi (Obsolete Setf Customization):
Revert defsetf example to the more correct let rather than prog1.
2012-11-06 20:37:07 -08:00
Stefan Monnier
b715ed4447 * lisp/emacs-lisp/gv.el (gv-define-simple-setter): Don't evaluate `val'
twice when `fix-return' is set.

Fixes: debbugs:12813
2012-11-06 22:39:33 -05:00
Stefan Monnier
d57c286eea * lisp/emacs-lisp/cl.el (defsetf): Pass the third arg to
gv-define-simple-setter.

Fixes: debbugs:12812
2012-11-06 22:14:27 -05:00
Dmitry Antipov
8e6a67b7fa * emacs-lisp/byte-opt.el (toplevel): Add compare-window-configurations,
frame-first-window, frame-root-window, frame-selected-window,
minibuffer-selected-window, minibuffer-window,
window-absolute-pixel-edges, window-at, window-body-height,
window-body-width, window-display-table, window-combination-limit,
window-frame, window-fringes, window-inside-absolute-pixel-edges,
window-inside-edges, window-inside-pixel-edges, window-left-child,
window-left-column, window-margins, window-next-buffers,
window-next-sibling, window-new-normal, window-new-total,
window-normal-size, window-parameter, window-parameters, window-parent,
window-pixel-edges, window-point, window-prev-buffers,
window-prev-sibling, window-redisplay-end-trigger, window-scroll-bars,
window-start, window-text-height, window-top-child, window-top-line,
window-total-height, window-total-width and window-use-time to the list
of functions without side-effects.
(toplevel): Add window-valid-p to the list of error-free functions
without side-effects.
2012-11-06 11:37:06 +04:00
Glenn Morris
6b3770fb9d * lisp/emacs-lisp/gv.el (gv-define-setter): Fix doc typo. 2012-11-05 20:36:44 -05:00
Glenn Morris
7e92a49396 Auto-commit of loaddefs files. 2012-11-05 07:20:41 -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
f6c6e09c7f Auto-commit of loaddefs files. 2012-11-04 07:22:06 -05:00
Glenn Morris
6163a6801e Auto-commit of loaddefs files. 2012-11-04 06:23:35 -05:00
Glenn Morris
f58542e151 Merge from emacs-24; up to 2012-11-03T05:11:34Z!dmantipov@yandex.ru 2012-11-03 12:14:22 -07:00
Glenn Morris
376a8e83bb Rename cl-random-time to cl--random-time
* emacs-lisp/cl-lib.el (cl--random-time): Rename from cl-random-time. 
(cl--gensym-counter, cl--random-state): Update callers.
* emacs-lisp/cl-extra.el (cl-make-random-state): Update callers.

Fixes: debbugs:12773
2012-11-03 11:36:09 -07: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
3a6851d9b4 Decouple "noruntime" and "cl-functions" bytecomp warnings
* lisp/emacs-lisp/bytecomp.el (byte-compile-eval):
Decouple "noruntime" and "cl-functions" warnings.
2012-11-02 18:35:01 -04:00
Glenn Morris
fcc1acdadb Auto-commit of loaddefs files. 2012-10-30 06:18:56 -04:00
Glenn Morris
f43a5263c1 cl-mapc small fixes
* lisp/emacs-lisp/cl-extra.el (cl-mapc): Add autoload cookie.  Doc fix.

* doc/misc/cl.texi (Mapping over Sequences): Mention cl-mapc naming oddity.
2012-10-30 01:03:22 -07:00
Glenn Morris
4ddedf94c8 Doc and manual updates for cl-letf and letf
Fixes: debbugs:12760

* doc/misc/cl.texi (Modify Macros): Update for cl-letf changes.
(Obsolete Lexical Macros): Say a little more about letf/cl-letf.

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

* etc/NEWS: Related edit.
2012-10-30 00:34:37 -07:00
Stefan Monnier
c606253cb5 * lisp/emacs-lisp/cl.el (letf): Add missing indent rules.
Fixes: debbugs:12759
2012-10-29 09:50:05 -04:00
Glenn Morris
a0ccbcbddc * lisp/emacs-lisp/cl.el (defsetf): Doc fix. 2012-10-28 18:12:53 -07:00
Daniel Hackney
cd44022cb0 * lisp/emacs-lisp/package.el (package-generate-autoloads): Kill buffer
"PKGNAME-autoloads.el" in case we created it.
2012-10-28 16:41:49 -04:00
Stefan Monnier
150f809c34 * lisp/emacs-lisp/advice.el (ad-assemble-advised-definition):
Silence bogus compiler warnings for ad-do-it.
2012-10-26 14:01:30 -04:00
Stefan Monnier
63314e5730 * lisp/emacs-lisp/macroexp.el (macroexp--expand-all):
Obey byte-compile-warning-enabled-p.

Fixes: debbugs:12486
2012-10-26 11:59:40 -04:00
David Engster
3f2a848dbe Merge CEDET upstream.
* emacs-lisp/eieio.el (eieio-update-lisp-imenu-expression):
Removed.  This feature is already integrated in imenu.

* emacs-lisp/eieio-opt.el: Remove require for `button' since it is
always loaded.  Require `speedbar' unconditionally.

* semantic/analyze.el (semantic-analyze-dereference-alias): New
function to dereference aliases.
(semantic-analyze-current-context-default): Use it.

* semantic/grammar.el (semantic-grammar-create-package):
* srecode/compile.el (srecode-compile-templates): Throw a proper
error if semantic-mode is not enabled (bug#9968).

Compiler warning fixes:

* semantic.el (semantic-elapsed-time): Make it a defsubst.

* srecode/dictionary.el (srecode-adebug-dictionary): Remove
require for `semantic'.

* srecode/map.el:
* srecode/insert.el: Declare functions from `data-debug'.

* semantic/grammar.el: Require `help-fns'.  Declare functions from
`eldoc', which is required in function body.

* srecode/java.el:
* semantic/texi.el:
* semantic/grammar-wy.el:
* semantic/db-file.el:
* semantic/db-el.el:
* semantic/chart.el: Fix requires.

* ede/locate.el: Remove useless requires. Declare functions
instead and require in functions when needed.
2012-10-25 22:13:16 +02:00
Stefan Monnier
a7723be6dd * lisp/emacs-lisp/package.el (package-installed-p): Warn if not ready.
Fixes: debbugs:12721
2012-10-25 08:38:09 -04:00