Merge from origin/emacs-29

3b791ebbe1 ; Fix 'usage:' keyword in Ffile_name_concat doc.
ed48b0d657 ; * CONTRIBUTE: Ask not to use non-ASCII unless necessary.
b708e639d6 ; * src/lread.c (maybe_swap_for_eln): Clarify warning mes...
db027a0697 ; Fix bibtex-biblatex-field-alist docstring typo.
a9be5c7ea9 ; * doc/lispref/control.texi (Conditionals): Add missing ...
db5915f30b Fix 'with-sqlite-transaction'
fe491173e8 ; * doc/emacs/files.texi (Image Mode): Fix typo (bug#69671).
feature/positioned-lambdas
Eli Zaretskii 2024-03-16 05:47:41 -04:00
commit cc8a2c57b5
8 changed files with 64 additions and 10 deletions

View File

@ -237,6 +237,8 @@ formatting them:
particular, gnu.org and fsf.org URLs should start with "https:".
- Commit messages should contain only printable UTF-8 characters.
However, we ask that non-ASCII characters be used only if strictly
necessary, not just for aesthetic purposes.
- Commit messages should not contain the "Signed-off-by:" lines that
are used in some other projects.

View File

@ -2392,7 +2392,7 @@ multiply the size by the factor of @w{@code{1 + @var{n} / 10}}, so
@findex image-decrease-size
@kindex i - (Image mode)
@item i -
Decrease the image size (@code{image-increase-size}) by 20%. Prefix
Decrease the image size (@code{image-decrease-size}) by 20%. Prefix
numeric argument controls the decrement; the value of @var{n} means to
multiply the size by the factor of @w{@code{1 - @var{n} / 10}}, so
@w{@kbd{C-u 3 i -}} means to decrease the size by 30%.

View File

@ -323,7 +323,7 @@ described below.
@defmac if-let spec then-form else-forms...
Evaluate each binding in @var{spec} in turn, like in @code{let*}
(@pxref{Local Variables}, stopping if a binding value is @code{nil}.
(@pxref{Local Variables}), stopping if a binding value is @code{nil}.
If all are non-@code{nil}, return the value of @var{then-form},
otherwise the last form in @var{else-forms}.
@end defmac

View File

@ -32,7 +32,8 @@
If BODY completes normally, commit the changes and return
the value of BODY.
If BODY signals an error, or transaction commit fails, roll
back the transaction changes."
back the transaction changes before allowing the signal to
propagate."
(declare (indent 1) (debug (form body)))
(let ((db-var (gensym))
(func-var (gensym))
@ -48,8 +49,8 @@ back the transaction changes."
(setq ,res-var (funcall ,func-var))
(setq ,commit-var (sqlite-commit ,db-var))
,res-var)
(or ,commit-var (sqlite-rollback ,db-var))))
(funcall ,func-var))))
(or ,commit-var (sqlite-rollback ,db-var)))
(funcall ,func-var)))))
(provide 'sqlite)

View File

@ -1012,7 +1012,7 @@ if `bibtex-BibTeX-entry-alist' does not define a comment for FIELD."
("volumes" "Total number of volumes of a multi-volume work")
("year" "Year of publication"))
"Alist of biblatex fields.
It has the same format as `bibtex-BibTeX-entry-alist'."
It has the same format as `bibtex-BibTeX-field-alist'."
:group 'bibtex
:version "28.1"
:type 'bibtex-field-alist)

View File

@ -847,7 +847,7 @@ Each element in COMPONENTS must be a string or nil.
DIRECTORY or the non-final elements in COMPONENTS may or may not end
with a slash -- if they don't end with a slash, a slash will be
inserted before concatenating.
usage: (record DIRECTORY &rest COMPONENTS) */)
usage: (file-name-concat DIRECTORY &rest COMPONENTS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
ptrdiff_t chars = 0, bytes = 0, multibytes = 0, eargs = 0;

View File

@ -1950,9 +1950,9 @@ maybe_swap_for_eln (bool no_native, Lisp_Object *filename, int *fd,
= Fcons (list2
(Qcomp,
CALLN (Fformat,
build_string ("Cannot look up eln "
"file as no source file "
"was found for %s"),
build_string ("Cannot look up .eln file "
"for %s because no source "
"file was found for it"),
*filename)),
Vdelayed_warnings_list);
return;

51
test/lisp/sqlite-tests.el Normal file
View File

@ -0,0 +1,51 @@
;;; sqlite-tests.el --- Tests for sqlite.el -*- lexical-binding: t; -*-
;; Copyright (C) 2024 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(require 'sqlite)
(ert-deftest with-sqlite-transaction ()
(skip-unless (sqlite-available-p))
(let ((db (sqlite-open)))
(sqlite-execute db "create table test (a)")
(should
(eql 42 (with-sqlite-transaction db
(sqlite-execute db "insert into test values (1)")
(should (equal '((1)) (sqlite-select db "select * from test")))
42)))
;; Body runs exactly once.
(should (equal '((1)) (sqlite-select db "select * from test")))))
(ert-deftest with-sqlite-transaction/rollback ()
(skip-unless (sqlite-available-p))
(let ((db (sqlite-open)))
(sqlite-execute db "create table test (a)")
(should (equal '(sqlite-error
("SQL logic error" "no such function: fake" 1 1))
(should-error
(with-sqlite-transaction db
(sqlite-execute db "insert into test values (1)")
(sqlite-execute db "insert into test values (fake(2))")
42))))
;; First insertion (a=1) rolled back.
(should-not (sqlite-select db "select * from test"))))
;;; sqlite-tests.el ends here