Stefan Monnier [Fri, 31 Dec 2021 06:53:11 +0000 (01:53 -0500)]
Arrange to load `nadvice` later in `loadup.el`
This is done simply so as to avoid scattering nadvice's code into
`simple.el` and `cl-print.el`.
* lisp/loadup.el ("emacs-lisp/nadvice"): Move down after "simple".
* lisp/help.el (help-command-error-confusable-suggestions): Make it
call `command-error-default`.
(command-error-function): Replace the top-level call to `add-function`
with a simple `setq` since `add-function` is not available at this
stage any more.
* lisp/emacs-lisp/nadvice.el (interactive-form) <advice>:
(cl-print-object) <advice>: Rename from `advice--get-interactive-form`
and `advice--cl-print-object`.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <advice>:
* lisp/simple.el (interactive-form) <advice>: Move to `nadvice.el`.
(pre-redisplay-function): Replace the top-level call to `add-function`
with a simple `setq` since `add-function` is not available at this
stage any more.
* lisp/emacs-lisp/cl-generic.el: Use `oclosure-object` instead of `advice`
as representative of the OClosure specializers to prefill the dispatcher table.
Stefan Monnier [Fri, 31 Dec 2021 06:53:11 +0000 (01:53 -0500)]
Arrange to load `nadvice` later in `loadup.el`
This is done simply so as to avoid scattering nadvice's code into
`simple.el` and `cl-print.el`.
* lisp/loadup.el ("emacs-lisp/nadvice"): Move down after "simple".
* lisp/help.el (help-command-error-confusable-suggestions): Make it
call `command-error-default`.
(command-error-function): Replace the top-level call to `add-function`
with a simple `setq` since `add-function` is not available at this
stage any more.
* lisp/emacs-lisp/nadvice.el (interactive-form) <advice>:
(cl-print-object) <advice>: Rename from `advice--get-interactive-form`
and `advice--cl-print-object`.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <advice>:
* lisp/simple.el (interactive-form) <advice>: Move to `nadvice.el`.
(pre-redisplay-function): Replace the top-level call to `add-function`
with a simple `setq` since `add-function` is not available at this
stage any more.
* lisp/emacs-lisp/cl-generic.el: Use `fcr-object` instead of `advice`
as representative of the FCR specializers to prefill the dispatcher table.
Stefan Monnier [Tue, 28 Dec 2021 17:03:44 +0000 (12:03 -0500)]
kmacro.el: Unify the lambda and the list representations
Kmacros used to be represented as a triplet (MAC COUNTER FORMAT),
and then wrapped into a lambda to turn them into commands.
Replace the triplet with an OClosure so it's directly executable.
Take advantage of the change to promote the key-description
format where applicable.
* lisp/kmacro.el (kmacro): New OClosure type, to replace both `kmacro-function`
and the (MAC COUNTER FORMAT) representation of kmacros.
(kmacro-p): Adjust.
(kmacro-ring-head): Use `kmacro` constructor.
(kmacro-push-ring): Add backward compatibility code for old
list representation.
(kmacro-view-ring-2nd, kmacro-start-macro, kmacro-view-macro):
(kmacro-split-ring-element): Adjust to new representation.
(kmacro-exec-ring-item): Redefine as obsolete alias.
(kmacro-call-ring-2nd, kmacro-end-or-call-macro): Simplify accordingly.
(kmacro-function): Delete OClosure type.
(kmacro): Rename from `kmacro-lambda-form` and streamline
calling convention. Use `execute-kbd-macro` rather than
`kmacro-exec-ring-item`.
(kmacro-lambda-form, kmacro-extract-lambda): Rewrite and mark as obsolete.
(cl-print-object): Use the key-description format and skip the
counter and format parts if they're trivial.
(kmacro-bind-to-key, kmacro-name-last-macro): Simplify.
* test/lisp/kmacro-tests.el (kmacro-tests-kmacro-bind-to-single-key):
Suppress obsoletion warning.
(kmacro-tests-name-last-macro-bind-and-rebind): Tighten the check
a tiny bit.
(kmacro-tests--cl-print): Adjust to the new key-description output.
* lisp/macros.el (macro--string-to-vector): New function.
(insert-kbd-macro): Use it, and change the generated code to use
`kmacro` and the key-description format.
* lisp/edmacro.el (edit-kbd-macro): Adjust to new representation.
(edmacro-finish-edit): Use `kmacro` constructor.
Stefan Monnier [Tue, 28 Dec 2021 17:03:44 +0000 (12:03 -0500)]
kmacro.el: Unify the lambda and the list representations
Kmacros used to be represented as a triplet (MAC COUNTER FORMAT),
and then wrapped into a lambda to turn them into commands.
Replace the triplet with an FCR so it's directly executable.
Take advantage of the change to promote the key-description
format where applicable.
* lisp/kmacro.el (kmacro): New FCR type, to replace both `kmacro-function`
and the (MAC COUNTER FORMAT) representation of kmacros.
(kmacro-p): Adjust.
(kmacro-ring-head): Use `kmacro` constructor.
(kmacro-push-ring): Add backward compatibility code for old
list representation.
(kmacro-view-ring-2nd, kmacro-start-macro, kmacro-view-macro):
(kmacro-split-ring-element): Adjust to new representation.
(kmacro-exec-ring-item): Redefine as obsolete alias.
(kmacro-call-ring-2nd, kmacro-end-or-call-macro): Simplify accordingly.
(kmacro-function): Delete FCR type.
(kmacro): Rename from `kmacro-lambda-form` and streamline
calling convention. Use `execute-kbd-macro` rather than
`kmacro-exec-ring-item`.
(kmacro-lambda-form, kmacro-extract-lambda): Rewrite and mark as obsolete.
(cl-print-object): Use the key-description format and skip the
counter and format parts if they're trivial.
(kmacro-bind-to-key, kmacro-name-last-macro): Simplify.
* test/lisp/kmacro-tests.el (kmacro-tests-kmacro-bind-to-single-key):
Suppress obsoletion warning.
(kmacro-tests-name-last-macro-bind-and-rebind): Tighten the check
a tiny bit.
(kmacro-tests--cl-print): Adjust to the new key-description output.
* lisp/macros.el (macro--string-to-vector): New function.
(insert-kbd-macro): Use it, and change the generated code to use
`kmacro` and the key-description format.
* lisp/edmacro.el (edit-kbd-macro): Adjust to new representation.
(edmacro-finish-edit): Use `kmacro` constructor.
* lisp/uniquify.el (uniquify--rename-buffer-advice)
(uniquify--create-file-buffer-advice): Don't add them as advice any more.
Adjust their calling convention accordingly.
* lisp/uniquify.el (uniquify--rename-buffer-advice)
(uniquify--create-file-buffer-advice): Don't add them as advice any more.
Adjust their calling convention accordingly.
Stefan Monnier [Mon, 27 Dec 2021 05:52:05 +0000 (00:52 -0500)]
oclosure.el: Add support for mutable slots
* lisp/emacs-lisp/oclosure.el (oclosure--defstruct-make-copiers): Adjust for the
case of mutable slots. Optimize the mandatory arg case.
Don't mark the copiers as inlinable.
(oclosure-define): Allow `:type` and `:mutable` properties on slots.
(oclosure--lambda): Add `mutables` arg.
(oclosure-lambda): Pass it.
(oclosure--copy): Add `mutlist` arg.
(oclosure--get): Add `mutable` arg.
(oclosure--set): New function.
(oclosure--mut-getter-prototype, oclosure--mut-setter-prototype):
New prototype functions.
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test, oclosure-tests):
Add test for copier with mandatory arg.
(oclosure-test-mut, oclosure-test--mutate): New test.
* lisp/emacs-lisp/nadvice.el (advice): Use separate copiers
for the two use-cases, to avoid relying on CL keywords, since they're
not optimized away via inlining any more.
(advice--make, advice--tweak): Adjust accordingly.
Stefan Monnier [Mon, 27 Dec 2021 05:52:05 +0000 (00:52 -0500)]
fcr.el: Add support for mutable slots
* lisp/emacs-lisp/fcr.el (fcr--defstruct-make-copiers): Adjust for the
case of mutable slots. Optimize the mandatory arg case.
Don't mark the copiers as inlinable.
(fcr-defstruct): Allow `:type` and `:mutable` properties on slots.
(fcr--lambda): Add `mutables` arg.
(fcr-lambda): Pass it.
(fcr--copy): Add `mutlist` arg.
(fcr--get): Add `mutable` arg.
(fcr--set): New function.
(fcr--mut-getter-prototype, fcr--mut-setter-prototype):
New prototype functions.
* test/lisp/emacs-lisp/fcr-tests.el (fcr-test, fcr-tests):
Add test for copier with mandatory arg.
(fcr-test-mut, fcr-test--mutate): New test.
* lisp/emacs-lisp/nadvice.el (advice): Use separate copiers
for the two use-cases, to avoid relying on CL keywords, since they're
not optimized away via inlining any more.
(advice--make, advice--tweak): Adjust accordingly.
Stefan Monnier [Wed, 22 Dec 2021 15:52:21 +0000 (10:52 -0500)]
oclosure.el (oclosure-define): Use `oclosure--copy` to define accessors
* lisp/emacs-lisp/oclosure.el (oclosure-define): Use `oclosure--copy` to
define accessors. Fix call to `oclosure--defstruct-make-copiers`.
(oclosure--lambda): New macro extracted from `oclosure-lambda`.
(oclosure-lambda): Use it.
(oclosure--accessor-prototype): New constant.
(oclosure-accessor): New type.
Stefan Monnier [Wed, 22 Dec 2021 15:52:21 +0000 (10:52 -0500)]
fcr.el (fcr-defstruct): Use `fcr--copy` to define accessors
* lisp/emacs-lisp/fcr.el (fcr-defstruct): Use `fcr--copy` to
define accessors. Fix call to `fcr--defstruct-make-copiers`.
(fcr--lambda): New macro extracted from `fcr-lambda`.
(fcr-lambda): Use it.
(fcr--accessor-prototype): New constant.
(fcr-accessor): New type.
Stefan Monnier [Wed, 22 Dec 2021 15:06:17 +0000 (10:06 -0500)]
oclosure.el (accessor): New type
* lisp/emacs-lisp/oclosure.el (accessor): New (OClosure) type.
(oclosure-define): Mark the accessor functions
as being of type `accessor`.
(oclosure--accessor-cl-print, oclosure--accessor-docstring): New functions.
* src/doc.c (store_function_docstring): Improve message and fix check.
* lisp/simple.el (function-docstring) <accessor>: New method.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <accessor>: New method.
Stefan Monnier [Wed, 22 Dec 2021 15:06:17 +0000 (10:06 -0500)]
fcr.el (accessor): New type
* lisp/emacs-lisp/fcr.el (accessor): New (FCR) type.
(fcr-defstruct): Mark the accessor functions
as being of type `accessor`.
(fcr--accessor-cl-print, fcr--accessor-docstring): New functions.
* src/doc.c (store_function_docstring): Improve message and fix check.
* lisp/simple.el (function-docstring) <accessor>: New method.
* lisp/emacs-lisp/cl-print.el (cl-print-object) <accessor>: New method.
Stefan Monnier [Tue, 21 Dec 2021 14:57:34 +0000 (09:57 -0500)]
lisp/emacs-lisp/oclosure.el: Signal errors for invalid code
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-tests): Remove left-over
debugging messages.
(oclosure-tests--limits): New test.
* lisp/emacs-lisp/oclosure.el (oclosure-define): Fill the `index-table` and
signal an error in case of duplicate slot names.
(oclosure-lambda): Change use of `oclosure--fix-type` so `cconv-convert` can use
it to detect store-converted slots. Tweak generated code to avoid
a warning.
(oclosure--fix-type): Adjust accordingly.
* lisp/emacs-lisp/cconv.el (cconv-convert): Signal an error if we
store-convert a OClosure slot.
Stefan Monnier [Tue, 21 Dec 2021 14:57:34 +0000 (09:57 -0500)]
lisp/emacs-lisp/fcr.el: Signal errors for invalid code
* test/lisp/emacs-lisp/fcr-tests.el (fcr-tests): Remove left-over
debugging messages.
(fcr-tests--limits): New test.
* lisp/emacs-lisp/fcr.el (fcr-defstruct): Fill the `index-table` and
signal an error in case of duplicate slot names.
(fcr-lambda): Change use of `fcr--fix-type` so `cconv-convert` can use
it to detect store-converted slots. Tweak generated code to avoid
a warning.
(fcr--fix-type): Adjust accordingly.
* lisp/emacs-lisp/cconv.el (cconv-convert): Signal an error if we
store-convert a FCR slot.
Stefan Monnier [Mon, 20 Dec 2021 16:04:37 +0000 (11:04 -0500)]
Fix bug#28557
* test/lisp/emacs-lisp/cconv-tests.el: Remove `:expected-result :failed`
from the bug#28557 tests.
(cconv-tests-cl-function-:documentation): Account for the presence of
the arglist (aka "usage") in the docstring.
Stefan Monnier [Mon, 20 Dec 2021 16:04:37 +0000 (11:04 -0500)]
Fix bug#28557
* test/lisp/emacs-lisp/cconv-tests.el: Remove `:expected-result :failed`
from the bug#28557 tests.
(cconv-tests-cl-function-:documentation): Account for the presence of
the arglist (aka "usage") in the docstring.
Stefan Monnier [Sat, 18 Dec 2021 15:28:57 +0000 (10:28 -0500)]
nadvice.el: Use OClosures rather than handmade bytecodes
* lisp/emacs-lisp/nadvice.el (advice): New OClosure type.
(advice--where-alist): Use OClosures.
(advice--car, advice--cdr, advice--props, advice--where):
Delete functions, now defined for us by `oclosure-define`.
(advice--p): Rewrite.
(advice--make-1): Delete function.
(advice--make, advice--tweak): Use `advice--copy` instead.
* lisp/emacs-lisp/oclosure.el (oclosure--fix-type): Don't use `documentation` to
avoid bootstrap problems.
(oclosure-type): Return nil on non-function objects.
* lisp/help.el (help--docstring-quote, help-add-fundoc-usage)
(help--make-usage, help--make-usage-docstring): Move to `subr.el`.
* lisp/subr.el (docstring--quote, docstring-add-fundoc-usage)
(docstring--make-usage, docstring--make-usage-docstring): New names for
functions moved from `help.el` for bootstrap reasons.
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Use the new names.
Stefan Monnier [Sat, 18 Dec 2021 15:28:57 +0000 (10:28 -0500)]
nadvice.el: Use FCRs rather than handmade bytecodes
* lisp/emacs-lisp/nadvice.el (advice): New FCR type.
(advice--where-alist): Use FCRs.
(advice--car, advice--cdr, advice--props, advice--where):
Delete functions, now defined for us by `fcr-defstruct`.
(advice--p): Rewrite.
(advice--make-1): Delete function.
(advice--make, advice--tweak): Use `advice--copy` instead.
* lisp/emacs-lisp/fcr.el (fcr--fix-type): Don't use `documentation` to
avoid bootstrap problems.
(fcr-type): Return nil on non-function objects.
* lisp/help.el (help--docstring-quote, help-add-fundoc-usage)
(help--make-usage, help--make-usage-docstring): Move to `subr.el`.
* lisp/subr.el (docstring--quote, docstring-add-fundoc-usage)
(docstring--make-usage, docstring--make-usage-docstring): New names for
functions moved from `help.el` for bootstrap reasons.
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Use the new names.
Stefan Monnier [Fri, 17 Dec 2021 04:58:17 +0000 (23:58 -0500)]
(interactive-form, function-docstring): New generic functions
Change `interactive-form` to be a generic function, and
change `documentation` to delegate to a new `function-docstring`
generic function so that we can use `cl-defmethod` to construct
the docstrings and interactive forms of OClosures.
* src/eval.c (Fcommandp): Rewrite to delegate to `interactive-form`
when potentially necessary.
* src/doc.c (Fdocumentation): Delegate to `function-docstring` in
most cases.
* src/data.c (Finternal__interactive_form): Rename from
`Finteractive_form` and simplify to only handle the cases we can't (yet)
handle from Lisp.
(syms_of_data): Adjust accordingly.
* src/callint.c (Fcall_interactively): `interactive-form` is now
defined in Lisp.
* lisp/simple.el: Require `subr-x`.
(function-docstring, interactive-form): New generic functions.
* lisp/loadup.el ("simple"): Postpone loading it after `cl-generic`.
* lisp/emacs-lisp/cl-generic.el (cl--generic-lambda):
Avoid `interactive-form` to avoid breaking bootstrap since it's now
defined as a generic function.
(cl-defmethod): Simplify.
(cl--generic-compiler): New var.
(cl--generic-get-dispatcher): Use it.
(cl--generic-prefill-dispatchers): Rebind it.
Stefan Monnier [Fri, 17 Dec 2021 04:58:17 +0000 (23:58 -0500)]
(interactive-form, function-docstring): New generic functions
Change `interactive-form` to be a generic function, and
change `documentation` to delegate to a new `function-docstring`
generic function so that we can use `cl-defmethod` to construct
the docstrings and interactive forms of FCRs.
* src/eval.c (Fcommandp): Rewrite to delegate to `interactive-form`
when potentially necessary.
* src/doc.c (Fdocumentation): Delegate to `function-docstring` in
most cases.
* src/data.c (Finternal__interactive_form): Rename from
`Finteractive_form` and simplify to only handle the cases we can't (yet)
handle from Lisp.
(syms_of_data): Adjust accordingly.
* src/callint.c (Fcall_interactively): `interactive-form` is now
defined in Lisp.
* lisp/simple.el: Require `subr-x`.
(function-docstring, interactive-form): New generic functions.
* lisp/loadup.el ("simple"): Postpone loading it after `cl-generic`.
* lisp/emacs-lisp/cl-generic.el (cl--generic-lambda):
Avoid `interactive-form` to avoid breaking bootstrap since it's now
defined as a generic function.
(cl-defmethod): Simplify.
(cl--generic-compiler): New var.
(cl--generic-get-dispatcher): Use it.
(cl--generic-prefill-dispatchers): Rebind it.
Stefan Monnier [Tue, 14 Dec 2021 00:07:32 +0000 (19:07 -0500)]
* lisp/loadup.el (oclosure): Load before `nadvice`
* lisp/loadup.el (oclosure): Load before `nadvice`.
* lisp/emacs-lisp/cl-generic.el (cl--generic-class-parents): Move to
`cl-preloaded.el`.
(cl--generic-struct-specializers, cl-generic--oclosure-specializers)
(cl--generic-specializers-apply-to-type-p): Use its new name.
* lisp/emacs-lisp/cl-preloaded.el (cl--class-allparents): New function
moved from `cl-generic.el`.
* lisp/emacs-lisp/oclosure.el (oclosure-define): Use it.
* lisp/emacs-lisp/cl-macs.el (pcase--mutually-exclusive-p):
Don't advise if `nadvice` has not yet been loaded.
Stefan Monnier [Tue, 14 Dec 2021 00:07:32 +0000 (19:07 -0500)]
* lisp/loadup.el (fcr): Load before `nadvice`
* lisp/loadup.el (fcr): Load before `nadvice`.
* lisp/emacs-lisp/cl-generic.el (cl--generic-class-parents): Move to
`cl-preloaded.el`.
(cl--generic-struct-specializers, cl-generic--fcr-specializers)
(cl--generic-specializers-apply-to-type-p): Use its new name.
* lisp/emacs-lisp/cl-preloaded.el (cl--class-allparents): New function
moved from `cl-generic.el`.
* lisp/emacs-lisp/fcr.el (fcr-defstruct): Use it.
* lisp/emacs-lisp/cl-macs.el (pcase--mutually-exclusive-p):
Don't advise if `nadvice` has not yet been loaded.
* test/lisp/kmacro-tests.el (kmacro-tests--cl-print): New test.
* lisp/kmacro.el (kmacro-function): New OClosure type.
(kmacro-lambda-form): Use it.
(kmacro-extract-lambda, kmacro-p): Simplify/rewrite accordingly.
(cl-print-object): New method.
* lisp/emacs-lisp/oclosure.el (oclosure-make): Keep interactive specs before the
function's code.
* test/lisp/kmacro-tests.el (kmacro-tests--cl-print): New test.
* lisp/kmacro.el (kmacro-function): New FCR type.
(kmacro-lambda-form): Use it.
(kmacro-extract-lambda, kmacro-p): Simplify/rewrite accordingly.
(cl-print-object): New method.
* lisp/emacs-lisp/fcr.el (fcr-make): Keep interactive specs before the
function's code.
Stefan Monnier [Mon, 13 Dec 2021 16:33:49 +0000 (11:33 -0500)]
* lisp/emacs-lisp/cl-generic.el: Use OClosure for `cl-next-method-p`
* lisp/emacs-lisp/oclosure.el (oclosure--define): Avoid `cl-lib` at run-time.
(oclosure--type-sym): Delete variable. Use an interned symbol instead,
so the closures stand a chance of being printable readably.
(oclosure--fix-type, oclosure--copy, oclosure-get, oclosure-type): Adjust accordingly.
* lisp/emacs-lisp/cl-generic.el (cl--generic-nnm): New OClosure type.
(cl--generic-no-next-method-function): Delete function.
(cl-generic-call-method): Use it for the default no-next-method case.
(cl--generic-nnm-sample, cl--generic-cnm-sample): Delete vars.
(cl--generic-isnot-nnm-p): Use `oclosure-type`.
Stefan Monnier [Mon, 13 Dec 2021 16:33:49 +0000 (11:33 -0500)]
* lisp/emacs-lisp/cl-generic.el: Use FCR for `cl-next-method-p`
* lisp/emacs-lisp/fcr.el (fcr--define): Avoid `cl-lib` at run-time.
(fcr--type-sym): Delete variable. Use an interned symbol instead,
so the closures stand a chance of being printable readably.
(fcr--fix-type, fcr--copy, fcr-get, fcr-type): Adjust accordingly.
* lisp/emacs-lisp/cl-generic.el (cl--generic-nnm): New FCR type.
(cl--generic-no-next-method-function): Delete function.
(cl-generic-call-method): Use it for the default no-next-method case.
(cl--generic-nnm-sample, cl--generic-cnm-sample): Delete vars.
(cl--generic-isnot-nnm-p): Use `fcr-type`.
Stefan Monnier [Mon, 13 Dec 2021 16:00:04 +0000 (11:00 -0500)]
lisp/emacs-lisp/oclosure.el: Make it available to cl-generic
* lisp/loadup.el: Load `oclosure`.
* lisp/emacs-lisp/oclosure.el: Don't use `cl-lib` at runtime.
(oclosure--copy): Use `named-let` instead of `cl-mapcar`.
(oclosure--struct-tag, oclosure--struct-specializers, oclosure--struct-generalizer)
(cl-generic-generalizers): Move cl-generic support to cl-generic.
* lisp/emacs-lisp/cl-generic.el (cl--generic-oclosure-tag)
(cl-generic--oclosure-specializers, cl-generic--oclosure-generalizer)
(cl-generic-generalizers): Move OClosure support from `oclosure.el`.
Stefan Monnier [Mon, 13 Dec 2021 16:00:04 +0000 (11:00 -0500)]
lisp/emacs-lisp/fcr.el: Make it available to cl-generic
* lisp/loadup.el: Load `fcr`.
* lisp/emacs-lisp/fcr.el: Don't use `cl-lib` at runtime.
(fcr--copy): Use `named-let` instead of `cl-mapcar`.
(fcr--struct-tag, fcr--struct-specializers, fcr--struct-generalizer)
(cl-generic-generalizers): Move cl-generic support to cl-generic.
* lisp/emacs-lisp/cl-generic.el (cl--generic-fcr-tag)
(cl-generic--fcr-specializers, cl-generic--fcr-generalizer)
(cl-generic-generalizers): Move FCR support from `fcr.el`.
Stefan Monnier [Sun, 12 Dec 2021 17:12:30 +0000 (12:12 -0500)]
OClosure: Hybrids between functions and defstructs
* lisp/emacs-lisp/oclosure.el: New file.
* test/lisp/emacs-lisp/oclosure-tests.el: New file.
* src/eval.c (Ffunction): Allow :documentation to return a symbol.
* lisp/emacs-lisp/cconv.el (cconv--convert-function): Tweak ordering of
captured variables.
Stefan Monnier [Sun, 12 Dec 2021 17:12:30 +0000 (12:12 -0500)]
FCR: Hybrids between functions and defstructs
* lisp/emacs-lisp/fcr.el: New file.
* test/lisp/emacs-lisp/fcr-tests.el: New file.
* src/eval.c (Ffunction): Allow :documentation to return a symbol.
* lisp/emacs-lisp/cconv.el (cconv--convert-function): Tweak ordering of
captured variables.
Po Lu [Sun, 12 Dec 2021 13:33:56 +0000 (21:33 +0800)]
Fix overline display over stretch glyphs with box on NS
* src/nsterm.m (ns_dumpglyphs_stretch): Don't draw text
decorations when there is a box.
(ns_draw_glyph_string): Draw text decorations after the box
in stretch glyph that have one.
* lib-src/etags.c (TEX_decode_env): Fix off-by-one parsing of
TEXTAGS environment variable (bug#52438). Based on a patch by
David Fussner <dfussner@googlemail.com> and amended by Andreas
Schwab <schwab@linux-m68k.org>.
Make sqlite-mode-list-tables work on older sqlite versions
* lisp/sqlite-mode.el (sqlite-mode-list-tables): Use sqlite_master
instead of sqlite_schema, since the former name is the historical
name and is available in all sqlite3 versions:
https://sqlite.org/schematab.html
Po Lu [Sun, 12 Dec 2021 01:17:00 +0000 (01:17 +0000)]
Fix drawing overlines on top of stretch glyphs when there is a box
* src/haikuterm.c (haiku_draw_string_box): Also draw text
decorations if the clipping is to be set.
(haiku_draw_glyph_string): Only draw text decorations if
the box will not be drawn with clipping.
* lisp/emacs-lisp/byte-opt.el (byte-optimize--substitutable-p):
Treat (internal-get-closed-var N) as constants for propagation
purposes, because that is effectively what such forms will be compiled
to. This allows for the elimination of some lexical variables.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
* lisp/gnus/gnus-sum.el (gnus-thread-header):
Replace lovingly hand-crafted assembler code with plain Lisp.
With lexical binding the difference is unlikely to be detectable.
Eli Zaretskii [Sat, 11 Dec 2021 18:15:53 +0000 (20:15 +0200)]
Fix hang when deleting a pipe process
* src/w32.h (FILE_DONT_CLOSE): New flag.
* src/w32.c (sys_close): Don't close descriptors used to read from
the pipe process. Leave the FILE_DONT_CLOSE flag set in the
descriptor's info.
(register_aux_fd): Set the FILE_DONT_CLOSE flag in the
descriptor's info.
* src/w32proc.c (reader_thread): When exiting normally, close the
file descriptor used to read from a pipe process. (Bug#52414)
Po Lu [Fri, 10 Dec 2021 13:36:59 +0000 (21:36 +0800)]
Fix the DJGPP port
* config.bat:
* msdos/sed1v2.inp:
* msdos/sed2v2.inp:
* msdos/sed3v2.inp:
* msdos/sedlibmk.inp: Update for Emacs 28.
* msdos/langinfo.h: New file.
* lisp/loadup.el: Use correct path to temacs when dumping on
MS-DOS.
* src/callproc.c (environ) [MSDOS]: New declaration.
(child_setup, emacs_spawn): Update MS-DOS parts for Emacs 28.
* src/fileio.c (Fcopy_file): Don't use copy_file_range on
MS-DOS.
* src/msdos.c (initialize_msdos_display): Add
`defined_color_hook'.
(openat, fchmodat, futimens, utimensat): New functions.
* src/msdos.h (FRAME_X_DISPLAY): New macro.
* src/process.c: Make some more things conditional on
subprocess support.
(PIPECONN_P, PIPECONN1_P) [!subprocesses]: New placeholder
macros.
(Fnum_processors): Return 1 on MSDOS.
(open_channel_for_module): Avoid subprocess specific code
on MSDOS.
* src/xterm.c (handle_one_xevent) <GenericEvent> [HAVE_XINPUT2]: The
variable any_stop_p is used only when HAVE_XWIDGETS, so guard its
declaration accordingly to pacify GCC's -Wunused-variable warning.
Eli Zaretskii [Sat, 11 Dec 2021 09:54:44 +0000 (11:54 +0200)]
Minor cleanups in sqlite.c
* src/sqlite.c (Fsqlite_open): Signal an error if
'init_sqlite_functions' fails. Encode FILE using UTF-8.
(Fsqlite_close, Fsqlite_execute, Fsqlite_select)
(Fsqlite_load_extension): Doc fixes.
(Fsqlite_load_extension): Encode MODULE using UTF-8.
Eli Zaretskii [Sat, 11 Dec 2021 09:26:04 +0000 (11:26 +0200)]
Minor cleanups of sqlite3 code on MS-Windows
* src/sqlite.c (sqlite_loaded_p): Function deleted: not used
anymore.
(init_sqlite_functions) [WINDOWSNT]: Use a static 'bool' variable
to indicate if sqlite3 DLL was successfully loaded.
(Fsqlite_available_p) [WINDOWSNT]: Just call
'init_sqlite_functions' if Vlibrary_cache doesn't mention
'sqlite3'.
* lisp/sqlite-mode.el (sqlite-mode-list-data)
(sqlite--mode--list-data): Don't leave open cursor (because they
block other processes from deleting stuff).
(sqlite-mode-delete): Adjust to new layout.
Stefan Kangas [Sat, 11 Dec 2021 05:56:31 +0000 (06:56 +0100)]
Merge from origin/emacs-28
5708da48d1 Revert "Make `M-x run-python' select the window again" aa2872a127 Make `M-x run-python' select the window again c8e19b3a84 Don't bug out on certain empty elements with ids
Check whether the sqlite supports sqlite3_load_extension
* configure.ac: Check for sqlite3_load_extension, which is
apparently missing in some versions.
* src/sqlite.c: Add guards.
(Fsqlite_load_extension): Ifdef out on systems that doesn't have it.
* configure.ac: Add check for the sqlite library.
* doc/lispref/text.texi (Database): Document it.
* lisp/sqlite.el: New file.
* lisp/term/w32-win.el (dynamic-library-alist): Add a mapping.
* src/Makefile.in (SQLITE3_LIBS): Add the libraries.
* src/alloc.c (union emacs_align_type): Add a Lisp_Sqlite struct.
* src/data.c (Ftype_of): Add sqlite.
* src/emacs.c (main): Load the syms.
* src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN): Add PVEC_SQLITE.
(GCALIGNED_STRUCT): New struct to keep data for sqlite database
objects and statement objects.
(SQLITEP, SQLITE, CHECK_SQLITE, XSQLITE): New macros for accessing
the objects.
* src/pdumper.c (dump_vectorlike): Update hash.
(dump_vectorlike): Don't dump it.
* src/print.c (print_vectorlike): Add a printer for the sqlite
object.