1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-01 18:00:40 -08:00

Merge from savannah/emacs-29

d72a4ed65c Fix 'with-sqlite-transaction' when BODY fails
a7b3c92373 ; * doc/emacs/cmdargs.texi (Initial Options): Fix last ch...
fd76a80864 ; Mention that -x and --script ignore file-locals
e0469ddb9d ; * doc/emacs/search.texi (Special Isearch): More accurat...
e521669fb3 Fix wording in ELisp Intro manual
da946ca692 Add missing python-ts-mode keyword (bug#67015)
0128495afd Fix string-pixel-width with global setting of display-lin...

# Conflicts:
#	etc/NEWS
This commit is contained in:
Po Lu 2023-11-24 08:38:03 +08:00
commit 9db8c349f0
8 changed files with 43 additions and 19 deletions

View file

@ -309,6 +309,9 @@ This is like @samp{--script}, but suppresses loading the init files
reaches the end of the script, it exits Emacs and uses the value of reaches the end of the script, it exits Emacs and uses the value of
the final form as the exit value from the script (if the final value the final form as the exit value from the script (if the final value
is numerical). Otherwise, it will always exit with a zero value. is numerical). Otherwise, it will always exit with a zero value.
Note that when Emacs reads the Lisp code in this case, it ignores any
file-local variables (@pxref{Specifying File Variables}), both in the
first line and in a local-variables section near the end of the file.
@item --no-build-details @item --no-build-details
@opindex --no-build-details @opindex --no-build-details

View file

@ -407,8 +407,11 @@ characters, that disables character folding during that search.
@cindex invisible text, searching for @cindex invisible text, searching for
@kindex M-s i @r{(Incremental search)} @kindex M-s i @r{(Incremental search)}
@findex isearch-toggle-invisible @findex isearch-toggle-invisible
To toggle whether or not invisible text is searched, type To toggle whether or not the search will find text made invisible by
@kbd{M-s i} (@code{isearch-toggle-invisible}). @xref{Outline Search}. overlays, type @kbd{M-s i} (@code{isearch-toggle-invisible}).
@xref{Outline Search}. To make all incremental searches find matches
inside invisible text, whether due to text properties or overlay
properties, customize @code{search-invisible} to the value @code{t}.
@kindex M-r @r{(Incremental Search)} @kindex M-r @r{(Incremental Search)}
@kindex M-s r @r{(Incremental Search)} @kindex M-s r @r{(Incremental Search)}

View file

@ -8165,9 +8165,9 @@ the expectation that all goes well has a @code{when}. The code uses
text that exists. text that exists.
A @code{when} expression is simply a programmers' convenience. It is A @code{when} expression is simply a programmers' convenience. It is
an @code{if} without the possibility of an else clause. In your mind, like an @code{if} without the possibility of an else clause. In your
you can replace @code{when} with @code{if} and understand what goes mind, you can replace @code{when} with @code{if} and understand what
on. That is what the Lisp interpreter does. goes on. That is what the Lisp interpreter does.
Technically speaking, @code{when} is a Lisp macro. A Lisp macro Technically speaking, @code{when} is a Lisp macro. A Lisp macro
enables you to define new control constructs and other language enables you to define new control constructs and other language
@ -8176,8 +8176,9 @@ expression which will in turn compute the value. In this case, the
other expression is an @code{if} expression. other expression is an @code{if} expression.
The @code{kill-region} function definition also has an @code{unless} The @code{kill-region} function definition also has an @code{unless}
macro; it is the converse of @code{when}. The @code{unless} macro is macro; it is the opposite of @code{when}. The @code{unless} macro is
an @code{if} without a then clause like an @code{if} except that it has no then-clause, and it supplies
an implicit @code{nil} for that.
For more about Lisp macros, see @ref{Macros, , Macros, elisp, The GNU For more about Lisp macros, see @ref{Macros, , Macros, elisp, The GNU
Emacs Lisp Reference Manual}. The C programming language also Emacs Lisp Reference Manual}. The C programming language also

View file

@ -5486,7 +5486,11 @@ made by the transaction.
@defmac with-sqlite-transaction db body@dots{} @defmac with-sqlite-transaction db body@dots{}
Like @code{progn} (@pxref{Sequencing}), but executes @var{body} with a Like @code{progn} (@pxref{Sequencing}), but executes @var{body} with a
transaction held, and commits the transaction at the end. transaction held, and commits the transaction at the end if @var{body}
completes normally. If @var{body} signals an error, or committing the
transaction fails, the changes in @var{db} performed by @var{body} are
rolled back. The macro returns the value of @var{body} if it
completes normally and commit succeeds.
@end defmac @end defmac
@defun sqlite-pragma db pragma @defun sqlite-pragma db pragma

View file

@ -62,6 +62,11 @@ of showing the shortcuts.
* Incompatible Lisp Changes in Emacs 29.2 * Incompatible Lisp Changes in Emacs 29.2
+++
** 'with-sqlite-transaction' rolls back changes if its BODY fails.
If the BODY of the macro signals an error, or committing the results
of the transaction fails, the changes will now be rolled back.
* Lisp Changes in Emacs 29.2 * Lisp Changes in Emacs 29.2

View file

@ -341,10 +341,9 @@ This construct can only be used with lexical binding."
;; Keeping a work buffer around is more efficient than creating a ;; Keeping a work buffer around is more efficient than creating a
;; new temporary buffer. ;; new temporary buffer.
(with-current-buffer (get-buffer-create " *string-pixel-width*") (with-current-buffer (get-buffer-create " *string-pixel-width*")
;; If `display-line-numbers-mode' is enabled in internal ;; If `display-line-numbers' is enabled in internal buffers
;; buffers, it breaks width calculation, so disable it (bug#59311) ;; (e.g. globally), it breaks width calculation (bug#59311)
(when (bound-and-true-p display-line-numbers-mode) (setq-local display-line-numbers nil)
(display-line-numbers-mode -1))
(delete-region (point-min) (point-max)) (delete-region (point-min) (point-max))
;; Disable line-prefix and wrap-prefix, for the same reason. ;; Disable line-prefix and wrap-prefix, for the same reason.
(setq line-prefix nil (setq line-prefix nil

View file

@ -979,7 +979,7 @@ It makes underscores and dots word constituent chars.")
"raise" "return" "try" "while" "with" "yield" "raise" "return" "try" "while" "with" "yield"
;; These are technically operators, but we fontify them as ;; These are technically operators, but we fontify them as
;; keywords. ;; keywords.
"and" "in" "is" "not" "or")) "and" "in" "is" "not" "or" "not in"))
(defvar python--treesit-builtins (defvar python--treesit-builtins
'("abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" '("abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray"

View file

@ -24,19 +24,28 @@
;;; Code: ;;; Code:
(defmacro with-sqlite-transaction (db &rest body) (defmacro with-sqlite-transaction (db &rest body)
"Execute BODY while holding a transaction for DB." "Execute BODY while holding a transaction for DB.
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."
(declare (indent 1) (debug (form body))) (declare (indent 1) (debug (form body)))
(let ((db-var (gensym)) (let ((db-var (gensym))
(func-var (gensym))) (func-var (gensym))
(res-var (gensym))
(commit-var (gensym)))
`(let ((,db-var ,db) `(let ((,db-var ,db)
(,func-var (lambda () ,@body))) (,func-var (lambda () ,@body))
,res-var ,commit-var)
(if (sqlite-available-p) (if (sqlite-available-p)
(unwind-protect (unwind-protect
(progn (progn
(sqlite-transaction ,db-var) (sqlite-transaction ,db-var)
(funcall ,func-var)) (setq ,res-var (funcall ,func-var))
(sqlite-commit ,db-var)) (setq ,commit-var (sqlite-commit ,db-var))
(funcall ,func-var))))) ,res-var)
(or ,commit-var (sqlite-rollback ,db-var))))
(funcall ,func-var))))
(provide 'sqlite) (provide 'sqlite)