]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoMerge remote-tracking branch 'origin/scratch/oclosure' into fcr scratch/fcr
Stefan Monnier [Sat, 1 Jan 2022 21:41:53 +0000 (16:41 -0500)]
Merge remote-tracking branch 'origin/scratch/oclosure' into fcr

2 years agoFCR: Rename to OClosure
Stefan Monnier [Fri, 31 Dec 2021 20:39:51 +0000 (15:39 -0500)]
FCR: Rename to OClosure

2 years agoArrange to load `nadvice` later in `loadup.el`
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.

2 years agoArrange to load `nadvice` later in `loadup.el`
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.

2 years agokmacro.el: Unify the lambda and the list representations
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.

2 years agokmacro.el: Unify the lambda and the list representations
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.

2 years ago* lisp/emacs-lisp/oclosure.el: Remove obsolete comment
Stefan Monnier [Tue, 28 Dec 2021 01:22:30 +0000 (20:22 -0500)]
* lisp/emacs-lisp/oclosure.el: Remove obsolete comment

2 years ago* lisp/emacs-lisp/fcr.el: Remove obsolete comment
Stefan Monnier [Tue, 28 Dec 2021 01:22:30 +0000 (20:22 -0500)]
* lisp/emacs-lisp/fcr.el: Remove obsolete comment

2 years agoReplace uniquify.el's advice with direct calls
Stefan Monnier [Tue, 28 Dec 2021 00:47:23 +0000 (19:47 -0500)]
Replace uniquify.el's advice with direct calls

* src/buffer.c (Frename_buffer): Call `uniquify--rename-buffer-advice`.
* lisp/files.el (create-file-buffer):
Call`uniquify--create-file-buffer-advice`.

* 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.

2 years agoReplace uniquify.el's advice with direct calls
Stefan Monnier [Tue, 28 Dec 2021 00:47:23 +0000 (19:47 -0500)]
Replace uniquify.el's advice with direct calls

* src/buffer.c (Frename_buffer): Call `uniquify--rename-buffer-advice`.
* lisp/files.el (create-file-buffer):
Call`uniquify--create-file-buffer-advice`.

* 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.

2 years ago* lisp/emacs-lisp/oclosure.el (Commentary:): Add a few notes
Stefan Monnier [Mon, 27 Dec 2021 20:30:07 +0000 (15:30 -0500)]
* lisp/emacs-lisp/oclosure.el (Commentary:): Add a few notes

2 years ago* lisp/emacs-lisp/fcr.el (Commentary:): Add a few notes
Stefan Monnier [Mon, 27 Dec 2021 20:30:07 +0000 (15:30 -0500)]
* lisp/emacs-lisp/fcr.el (Commentary:): Add a few notes

2 years agooclosure.el: Add support for mutable slots
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.

2 years agofcr.el: Add support for mutable slots
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.

2 years agooclosure.el (oclosure-lambda): Change calling convention
Stefan Monnier [Sat, 25 Dec 2021 04:50:31 +0000 (23:50 -0500)]
oclosure.el (oclosure-lambda): Change calling convention

* lisp/emacs-lisp/oclosure.el (oclosure-lambda): Change calling convention.
* lisp/emacs-lisp/nadvice.el (advice--where-alist):
* lisp/emacs-lisp/cl-generic.el (cl-generic-call-method):
* lisp/kmacro.el (kmacro-lambda-form): Adjust accordingly.

2 years agofcr.el (fcr-lambda): Change calling convention
Stefan Monnier [Sat, 25 Dec 2021 04:50:31 +0000 (23:50 -0500)]
fcr.el (fcr-lambda): Change calling convention

* lisp/emacs-lisp/fcr.el (fcr-lambda): Change calling convention.
* lisp/emacs-lisp/nadvice.el (advice--where-alist):
* lisp/emacs-lisp/cl-generic.el (cl-generic-call-method):
* lisp/kmacro.el (kmacro-lambda-form): Adjust accordingly.

2 years agooclosure.el (oclosure-define): Use `oclosure--copy` to define accessors
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.

2 years agofcr.el (fcr-defstruct): Use `fcr--copy` to define accessors
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.

2 years agooclosure.el (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.

2 years agofcr.el (accessor): New type
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.

2 years agolisp/emacs-lisp/oclosure.el: Signal errors for invalid code
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.

2 years agolisp/emacs-lisp/fcr.el: Signal errors for invalid code
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.

2 years agolisp/emacs-lisp/cl-macs.el: Align with `master`
Stefan Monnier [Tue, 21 Dec 2021 04:14:03 +0000 (23:14 -0500)]
lisp/emacs-lisp/cl-macs.el: Align with `master`

2 years agolisp/emacs-lisp/cl-macs.el: Align with `master`
Stefan Monnier [Tue, 21 Dec 2021 04:14:03 +0000 (23:14 -0500)]
lisp/emacs-lisp/cl-macs.el: Align with `master`

2 years agocl-macs.el (cl--transform-lambda): Fix last change
Stefan Monnier [Mon, 20 Dec 2021 20:28:51 +0000 (15:28 -0500)]
cl-macs.el (cl--transform-lambda): Fix last change

* lisp/simple.el (interactive-form): Minor simplification.
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Fix last change.

2 years agocl-macs.el (cl--transform-lambda): Fix last change
Stefan Monnier [Mon, 20 Dec 2021 20:28:51 +0000 (15:28 -0500)]
cl-macs.el (cl--transform-lambda): Fix last change

* lisp/simple.el (interactive-form): Minor simplification.
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Fix last change.

2 years agoFix bug#28557
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.

* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric):
Handle non-constant `:documentation`.

* lisp/emacs-lisp/generator.el (iter-lambda):
* lisp/emacs-lisp/oclosure.el (oclosure-lambda):
* lisp/emacs-lisp/cconv.el (cconv--convert-funcbody):
Use `macroexp-parse-body`.

* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
Fix misuse of `cl-lib` without requiring it.

2 years agoFix bug#28557
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.

* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric):
Handle non-constant `:documentation`.

* lisp/emacs-lisp/generator.el (iter-lambda):
* lisp/emacs-lisp/fcr.el (fcr-lambda):
* lisp/emacs-lisp/cconv.el (cconv--convert-funcbody):
Use `macroexp-parse-body`.

* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
Fix misuse of `cl-lib` without requiring it.

2 years ago* lisp/emacs-lisp/cl-generic.el (cl-generic--oclosure-generalizer): Fix precedence
Stefan Monnier [Sun, 19 Dec 2021 04:05:26 +0000 (23:05 -0500)]
* lisp/emacs-lisp/cl-generic.el (cl-generic--oclosure-generalizer): Fix precedence

2 years ago* lisp/emacs-lisp/cl-generic.el (cl-generic--fcr-generalizer): Fix precedence
Stefan Monnier [Sun, 19 Dec 2021 04:05:26 +0000 (23:05 -0500)]
* lisp/emacs-lisp/cl-generic.el (cl-generic--fcr-generalizer): Fix precedence

2 years agocl-print.el: Dispatch on `advice` type
Stefan Monnier [Sun, 19 Dec 2021 00:20:25 +0000 (19:20 -0500)]
cl-print.el: Dispatch on `advice` type

* test/lisp/emacs-lisp/nadvice-tests.el (advice-test-print): New test.

* src/doc.c (store_function_docstring): Don't overwrite an OClosure type.

* lisp/simple.el (function-docstring): Don't return OClosures's type.

* lisp/emacs-lisp/nadvice.el (advice--cl-print-object): New function,
extracted from `cl-print-object`.

* lisp/emacs-lisp/cl-print.el (cl-print-object) <advice>: Use the
`advice` type for the dispatch.  Use `advice--cl-print-object`.

2 years agocl-print.el: Dispatch on `advice` type
Stefan Monnier [Sun, 19 Dec 2021 00:20:25 +0000 (19:20 -0500)]
cl-print.el: Dispatch on `advice` type

* test/lisp/emacs-lisp/nadvice-tests.el (advice-test-print): New test.

* src/doc.c (store_function_docstring): Don't overwrite an FCR type.

* lisp/simple.el (function-docstring): Don't return FCRs's type.

* lisp/emacs-lisp/nadvice.el (advice--cl-print-object): New function,
extracted from `cl-print-object`.

* lisp/emacs-lisp/cl-print.el (cl-print-object) <advice>: Use the
`advice` type for the dispatch.  Use `advice--cl-print-object`.

2 years agonadvice.el: Restore interactive-form handling
Stefan Monnier [Sat, 18 Dec 2021 22:25:50 +0000 (17:25 -0500)]
nadvice.el: Restore interactive-form handling

* test/lisp/emacs-lisp/nadvice-tests.el
(advice-test-call-interactively): Prefer a locally scoped function.

* lisp/simple.el (interactive-form): Don't skip the method dispatch
when recursing.
(interactive-form) <advice>: New method.

* lisp/emacs-lisp/nadvice.el (advice--where-alist): Fix typo.
(advice--get-interactive-form): New function.

* lisp/emacs-lisp/oclosure.el (oclosure-lambda): Fix thinko.

* lisp/emacs-lisp/cl-generic.el: Prefill with an OClosure dispatcher.

2 years agonadvice.el: Restore interactive-form handling
Stefan Monnier [Sat, 18 Dec 2021 22:25:50 +0000 (17:25 -0500)]
nadvice.el: Restore interactive-form handling

* test/lisp/emacs-lisp/nadvice-tests.el
(advice-test-call-interactively): Prefer a locally scoped function.

* lisp/simple.el (interactive-form): Don't skip the method dispatch
when recursing.
(interactive-form) <advice>: New method.

* lisp/emacs-lisp/nadvice.el (advice--where-alist): Fix typo.
(advice--get-interactive-form): New function.

* lisp/emacs-lisp/fcr.el (fcr-lambda): Fix thinko.

* lisp/emacs-lisp/cl-generic.el: Prefill with an FCR dispatcher.

2 years agonadvice.el: Use OClosures rather than handmade bytecodes
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.

2 years agonadvice.el: Use FCRs rather than handmade bytecodes
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.

2 years agoFix bootstrap problems and various misc issues found along the way
Stefan Monnier [Fri, 17 Dec 2021 19:53:03 +0000 (14:53 -0500)]
Fix bootstrap problems and various misc issues found along the way

* lisp/simple.el (function-docstring): Fix call to `signal`.

* lisp/emacs-lisp/oclosure.el (oclosure--define): Use `cl-deftype-satisfies`.

* lisp/emacs-lisp/cl-generic.el (cl--generic-prefill-dispatchers):
Bind `cl--generic-compiler` around the right part of the function (duh!).

2 years agoFix bootstrap problems and various misc issues found along the way
Stefan Monnier [Fri, 17 Dec 2021 19:53:03 +0000 (14:53 -0500)]
Fix bootstrap problems and various misc issues found along the way

* lisp/simple.el (function-docstring): Fix call to `signal`.

* lisp/emacs-lisp/fcr.el (fcr--define): Use `cl-deftype-satisfies`.

* lisp/emacs-lisp/cl-generic.el (cl--generic-prefill-dispatchers):
Bind `cl--generic-compiler` around the right part of the function (duh!).

2 years agolisp/emacs-lisp/oclosure.el: Rename `oclosure-make` to `oclosure-lambda`
Stefan Monnier [Fri, 17 Dec 2021 17:45:01 +0000 (12:45 -0500)]
lisp/emacs-lisp/oclosure.el: Rename `oclosure-make` to `oclosure-lambda`

* lisp/emacs-lisp/oclosure.el (oclosure-lambda): Rename from `oclosure-make`.
* lisp/emacs-lisp/cl-generic.el (cl-generic-call-method):
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-tests):
* lisp/kmacro.el (kmacro-lambda-form): Adjust accordingly.

2 years agolisp/emacs-lisp/fcr.el: Rename `fcr-make` to `fcr-lambda`
Stefan Monnier [Fri, 17 Dec 2021 17:45:01 +0000 (12:45 -0500)]
lisp/emacs-lisp/fcr.el: Rename `fcr-make` to `fcr-lambda`

* lisp/emacs-lisp/fcr.el (fcr-lambda): Rename from `fcr-make`.
* lisp/emacs-lisp/cl-generic.el (cl-generic-call-method):
* test/lisp/emacs-lisp/fcr-tests.el (fcr-tests):
* lisp/kmacro.el (kmacro-lambda-form): Adjust accordingly.

2 years ago(interactive-form, function-docstring): New generic functions
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/macroexp.el (internal-macroexpand-for-load):
Don't neuter eager macroexpansion errors.

* 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.

2 years ago(interactive-form, function-docstring): New generic functions
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/macroexp.el (internal-macroexpand-for-load):
Don't neuter eager macroexpansion errors.

* 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.

2 years ago* lisp/loadup.el (oclosure): Load before `nadvice`
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.

2 years ago* lisp/loadup.el (fcr): Load before `nadvice`
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.

2 years ago* lisp/kmacro.el: Use OClosure instead of messing with internals
Stefan Monnier [Mon, 13 Dec 2021 21:43:58 +0000 (16:43 -0500)]
* lisp/kmacro.el: Use OClosure instead of messing with internals

* test/lisp/progmodes/elisp-mode-tests.el
(xref-elisp-generic-co-located-default): Silence warnings.

* 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.

* lisp/edmacro.el (edmacro-finish-edit): Prefer `kmacro-p`.

2 years ago* lisp/kmacro.el: Use FCR instead of messing with internals
Stefan Monnier [Mon, 13 Dec 2021 21:43:58 +0000 (16:43 -0500)]
* lisp/kmacro.el: Use FCR instead of messing with internals

* test/lisp/progmodes/elisp-mode-tests.el
(xref-elisp-generic-co-located-default): Silence warnings.

* 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.

* lisp/edmacro.el (edmacro-finish-edit): Prefer `kmacro-p`.

2 years ago* lisp/emacs-lisp/cl-generic.el: Use OClosure for `cl-next-method-p`
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`.

2 years ago* lisp/emacs-lisp/cl-generic.el: Use FCR for `cl-next-method-p`
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`.

2 years agolisp/emacs-lisp/oclosure.el: Make it available to cl-generic
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`.

2 years agolisp/emacs-lisp/fcr.el: Make it available to cl-generic
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`.

2 years agoOClosure: Hybrids between functions and defstructs
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.

2 years agoFCR: Hybrids between functions and defstructs
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.

2 years agoFix overline display over stretch glyphs with box on NS
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.

2 years agoFix overline display when there is a box
Po Lu [Sun, 12 Dec 2021 13:05:35 +0000 (21:05 +0800)]
Fix overline display when there is a box

* src/w32term.c (w32_draw_glyph_string):
* src/xterm.c (x_draw_glyph_string): Draw box before any text
decorations.

2 years agoReally fix the etags TEX parsing
Lars Ingebrigtsen [Sun, 12 Dec 2021 10:45:11 +0000 (11:45 +0100)]
Really fix the etags TEX parsing

* lib-src/etags.c (TEX_decode_env): Re-fix off-by-one parsing of
TEXTAGS environment variable (bug#52438).

2 years agoFix an off-by-one error in TEX parsing in etags
Lars Ingebrigtsen [Sun, 12 Dec 2021 10:26:22 +0000 (11:26 +0100)]
Fix an off-by-one error in TEX parsing in etags

* 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>.

2 years agoCheck for support in sqlite-mode-open-file
Lars Ingebrigtsen [Sun, 12 Dec 2021 09:22:52 +0000 (10:22 +0100)]
Check for support in sqlite-mode-open-file

* lisp/sqlite-mode.el (sqlite-mode-open-file): Error out earlier
when we don't have sqlite support.

2 years agoeshell: Prefer octal number for file modes
Stefan Kangas [Sun, 12 Dec 2021 08:12:14 +0000 (09:12 +0100)]
eshell: Prefer octal number for file modes

* lisp/eshell/esh-util.el (eshell-private-file-modes)
(eshell-private-directory-modes): Prefer octal number for file modes.

2 years ago; * lisp/emacs-lisp/shortdoc.el (keymaps): Fix typo.
Stefan Kangas [Sun, 12 Dec 2021 08:04:11 +0000 (09:04 +0100)]
; * lisp/emacs-lisp/shortdoc.el (keymaps): Fix typo.

2 years agoMake with-sqlite-transaction mode code efficient
Lars Ingebrigtsen [Sun, 12 Dec 2021 06:22:44 +0000 (07:22 +0100)]
Make with-sqlite-transaction mode code efficient

* lisp/sqlite.el (with-sqlite-transaction): Rewrite to only
include BODY once.

2 years ago* src/xterm.c (x_detect_focus_change): Fix XI2 focus on GTK builds.
Po Lu [Sun, 12 Dec 2021 06:20:18 +0000 (14:20 +0800)]
* src/xterm.c (x_detect_focus_change): Fix XI2 focus on GTK builds.

2 years agoFix last change
Po Lu [Sun, 12 Dec 2021 06:13:05 +0000 (14:13 +0800)]
Fix last change

* src/xterm.c (x_detect_focus_change): Test against
FOCUS_EXPLICIT.

2 years agoFix some compilation warnings in sqlite-less builds
dick r. chiang [Sun, 12 Dec 2021 06:13:37 +0000 (07:13 +0100)]
Fix some compilation warnings in sqlite-less builds

* test/src/sqlite-tests.el:
* lisp/sqlite-mode.el: Avoid compilation warnings in builds
without libsqlite (bug#52440).

2 years agoFix frame focus on X Toolkit builds with XInput 2
Po Lu [Sun, 12 Dec 2021 06:00:09 +0000 (14:00 +0800)]
Fix frame focus on X Toolkit builds with XInput 2

* src/xterm.c (x_detect_focus_change): Allow focus_state to not
be FOCUS_EXPLICIT when handling FocusIn and FocusOut events.

2 years agoUpdate bovine/gcc-tests for newer Macos versions
Lars Ingebrigtsen [Sun, 12 Dec 2021 05:57:02 +0000 (06:57 +0100)]
Update bovine/gcc-tests for newer Macos versions

* test/lisp/cedet/semantic/bovine/gcc-tests.el
(semantic-gcc-test-output-parser-this-machine): Update gcc->llvm
detection to Macos Monterey.

2 years agoMerge from origin/emacs-28
Stefan Kangas [Sun, 12 Dec 2021 05:31:07 +0000 (06:31 +0100)]
Merge from origin/emacs-28

8a0734329a Avoid undefined behavior in 'send-process-region' (Bug#523...
30dd5c9acc Update to Org 9.5.1-25-g9ca3bc
a374849926 Fix the DJGPP port

2 years agoTweak erroring in sqlite-mode-delete
Lars Ingebrigtsen [Sun, 12 Dec 2021 04:55:35 +0000 (05:55 +0100)]
Tweak erroring in sqlite-mode-delete

* lisp/sqlite-mode.el (sqlite-mode-delete): Use user-error instead
of error for user-level stuff.

2 years agoMake sqlite-mode-list-tables work on older sqlite versions
Lars Ingebrigtsen [Sun, 12 Dec 2021 04:41:07 +0000 (05:41 +0100)]
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

2 years agoClear precision scroll interpolation when direction changes
Po Lu [Sun, 12 Dec 2021 02:54:50 +0000 (10:54 +0800)]
Clear precision scroll interpolation when direction changes

* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate):
Clear scroll interpolation when direction changes.

2 years agoFix drawing overlines on top of stretch glyphs when there is a box
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.

2 years agoConstant-propagate access to captured variables
Mattias Engdegård [Sat, 11 Dec 2021 21:11:08 +0000 (22:11 +0100)]
Constant-propagate access to captured variables

* 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.

2 years agoReimplement gnus-thread-header in Lisp
Mattias Engdegård [Sat, 11 Dec 2021 20:59:13 +0000 (21:59 +0100)]
Reimplement gnus-thread-header in Lisp

* 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.

2 years ago; * lisp/subr.el (start-process-shell-command): Add missing period.
Philipp Stephani [Sat, 11 Dec 2021 18:33:50 +0000 (19:33 +0100)]
; * lisp/subr.el (start-process-shell-command): Add missing period.

2 years agoFix hang when deleting a pipe process
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)

2 years agoAvoid undefined behavior in 'send-process-region' (Bug#52369).
Philipp Stephani [Sat, 11 Dec 2021 12:51:34 +0000 (13:51 +0100)]
Avoid undefined behavior in 'send-process-region' (Bug#52369).

* src/process.c (send_process): Signal an error if the file descriptor
has already been closed.

2 years agoUpdate to Org 9.5.1-25-g9ca3bc
Kyle Meyer [Sat, 11 Dec 2021 17:31:13 +0000 (12:31 -0500)]
Update to Org 9.5.1-25-g9ca3bc

2 years agoFix the DJGPP port
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.

2 years agoImprove documentation of sqlite3 support
Eli Zaretskii [Sat, 11 Dec 2021 11:04:55 +0000 (13:04 +0200)]
Improve documentation of sqlite3 support

* lisp/sqlite-mode.el (sqlite-mode-list-data):
* configure.ac (HAVE_SQLITE3): Fix typos.

* doc/lispref/text.texi (Database): Improve and clarify wording,
add index entries, mention all the function arguments.

* etc/NEWS: Minor wording changes of the sqlite entries.

2 years agoUse window height to determine wheel event pixel deltas on XInput 2
Po Lu [Sat, 11 Dec 2021 10:30:01 +0000 (18:30 +0800)]
Use window height to determine wheel event pixel deltas on XInput 2

* src/xterm.c (handle_one_xevent): Use window height instead of
frame height to determine the height of a scroll unit.

2 years agoPrevent hang when exiting Emacs on Haiku
Po Lu [Sat, 11 Dec 2021 10:07:48 +0000 (10:07 +0000)]
Prevent hang when exiting Emacs on Haiku

* src/haiku_support.cc (be_app_quit): Don't wait for app
thread to also quit.

2 years ago* src/sqlite.c (row_to_value): Call 'make_unibyte_string'.
Eli Zaretskii [Sat, 11 Dec 2021 10:05:54 +0000 (12:05 +0200)]
* src/sqlite.c (row_to_value): Call 'make_unibyte_string'.

2 years agoPacify unused variable warning in xterm.c
Basil L. Contovounesios [Sat, 11 Dec 2021 09:47:55 +0000 (11:47 +0200)]
Pacify unused variable warning in xterm.c

* 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.

2 years agoMinor cleanups in sqlite.c
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.

2 years agoMinor cleanups of sqlite3 code on MS-Windows
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'.

2 years agoFix a typo in sqlite.c
Eli Zaretskii [Sat, 11 Dec 2021 08:51:09 +0000 (10:51 +0200)]
Fix a typo in sqlite.c

* src/sqlite.c (Fsqlite_select): Fix a typo in arguments to
make_sqlite.

2 years agoAdd confirmation to sqlite-mode-delete
Lars Ingebrigtsen [Sat, 11 Dec 2021 08:28:57 +0000 (09:28 +0100)]
Add confirmation to sqlite-mode-delete

* lisp/sqlite-mode.el (sqlite-mode-delete): Add confirmation.

2 years agoDon't leave open cursors when listing sqlite data
Lars Ingebrigtsen [Sat, 11 Dec 2021 08:02:52 +0000 (09:02 +0100)]
Don't leave open cursors when listing sqlite data

* 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.

2 years agoAdd FIXME comment
Lars Ingebrigtsen [Sat, 11 Dec 2021 07:18:02 +0000 (08:18 +0100)]
Add FIXME comment

* lisp/sqlite-mode.el (sqlite-mode-delete): New command.
(sqlite--mode--list-data, sqlite-mode-list-data): Adjust to new
command.

2 years agoAdd an sqlite-mode-delete command
Lars Ingebrigtsen [Sat, 11 Dec 2021 07:11:10 +0000 (08:11 +0100)]
Add an sqlite-mode-delete command

* lisp/sqlite-mode.el (sqlite-mode-delete): New command.
(sqlite--mode--list-data, sqlite-mode-list-data): Adjust to new
command.

2 years agoFix Fsqlite_finalize book-keeping
Lars Ingebrigtsen [Sat, 11 Dec 2021 06:47:34 +0000 (07:47 +0100)]
Fix Fsqlite_finalize book-keeping

* src/sqlite.c (Fsqlite_finalize): Mark the object as dead.

2 years ago; * etc/NEWS: Fix wording in recent entry.
Stefan Kangas [Sat, 11 Dec 2021 06:10:02 +0000 (07:10 +0100)]
; * etc/NEWS: Fix wording in recent entry.

2 years agoMerge from origin/emacs-28
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

2 years agoImprove sqlite-mode--tablify tables
Lars Ingebrigtsen [Sat, 11 Dec 2021 05:50:58 +0000 (06:50 +0100)]
Improve sqlite-mode--tablify tables

* lisp/sqlite-mode.el (sqlite-mode--tablify): Tweak column widths
and sanitize newlines.

2 years agoCheck whether the sqlite supports sqlite3_load_extension
Lars Ingebrigtsen [Sat, 11 Dec 2021 05:40:01 +0000 (06:40 +0100)]
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.

2 years agoFix sqlite-mode.el build problems
Lars Ingebrigtsen [Sat, 11 Dec 2021 05:31:42 +0000 (06:31 +0100)]
Fix sqlite-mode.el build problems

* lisp/sqlite-mode.el (sqlite-mode-list-tables): Fix function
rename usage.

2 years agoFix some sqlite doc string typos
Lars Ingebrigtsen [Sat, 11 Dec 2021 05:26:37 +0000 (06:26 +0100)]
Fix some sqlite doc string typos

* src/sqlite.c (Fsqlite_load_extension, Fsqlite_more_p): Fix typos
in doc strings.

2 years agoAdd a new mode for examining sqlite files
Lars Ingebrigtsen [Sat, 11 Dec 2021 05:23:57 +0000 (06:23 +0100)]
Add a new mode for examining sqlite files

* lisp/sqlite-mode.el: New file.

2 years agoFix comment in heading
Lars Ingebrigtsen [Sat, 11 Dec 2021 04:22:42 +0000 (05:22 +0100)]
Fix comment in heading

2 years agoAdd NEWS entry for sqlite
Lars Ingebrigtsen [Sat, 11 Dec 2021 03:57:22 +0000 (04:57 +0100)]
Add NEWS entry for sqlite

2 years agoAdd sqlite3 support to Emacs
Lars Ingebrigtsen [Sat, 11 Dec 2021 03:55:57 +0000 (04:55 +0100)]
Add sqlite3 support to Emacs

* 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.

* src/sqlite.c: New file.

* test/src/sqlite-tests.el: Add tests.