emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9db8c349f06 1/6: Merge from savannah/emacs-29


From: Po Lu
Subject: master 9db8c349f06 1/6: Merge from savannah/emacs-29
Date: Thu, 23 Nov 2023 19:48:04 -0500 (EST)

branch: master
commit 9db8c349f0674c356ad1c04e62d75af958c486e8
Merge: 29d42d9158a d72a4ed65ce
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge from savannah/emacs-29
    
    d72a4ed65ce Fix 'with-sqlite-transaction' when BODY fails
    a7b3c923733 ; * doc/emacs/cmdargs.texi (Initial Options): Fix last ch...
    fd76a80864d ; Mention that -x and --script ignore file-locals
    e0469ddb9d4 ; * doc/emacs/search.texi (Special Isearch): More accurat...
    e521669fb3f Fix wording in ELisp Intro manual
    da946ca6924 Add missing python-ts-mode keyword (bug#67015)
    0128495afde Fix string-pixel-width with global setting of display-lin...
    
    # Conflicts:
    #       etc/NEWS
---
 doc/emacs/cmdargs.texi              |  3 +++
 doc/emacs/search.texi               |  7 +++++--
 doc/lispintro/emacs-lisp-intro.texi | 11 ++++++-----
 doc/lispref/text.texi               |  6 +++++-
 etc/NEWS.29                         |  5 +++++
 lisp/emacs-lisp/subr-x.el           |  7 +++----
 lisp/progmodes/python.el            |  2 +-
 lisp/sqlite.el                      | 21 +++++++++++++++------
 8 files changed, 43 insertions(+), 19 deletions(-)

diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 9514e3414e1..38e683bd7f5 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -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
 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.
+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
 @opindex --no-build-details
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index a79176fcefb..7efd4cc796c 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -407,8 +407,11 @@ characters, that disables character folding during that 
search.
 @cindex invisible text, searching for
 @kindex M-s i @r{(Incremental search)}
 @findex isearch-toggle-invisible
-  To toggle whether or not invisible text is searched, type
-@kbd{M-s i} (@code{isearch-toggle-invisible}).  @xref{Outline Search}.
+  To toggle whether or not the search will find text made invisible by
+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-s r @r{(Incremental Search)}
diff --git a/doc/lispintro/emacs-lisp-intro.texi 
b/doc/lispintro/emacs-lisp-intro.texi
index c5b33ac5eaa..e4a0f585f69 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -8165,9 +8165,9 @@ the expectation that all goes well has a @code{when}.  
The code uses
 text that exists.
 
 A @code{when} expression is simply a programmers' convenience.  It is
-an @code{if} without the possibility of an else clause.  In your mind,
-you can replace @code{when} with @code{if} and understand what goes
-on.  That is what the Lisp interpreter does.
+like an @code{if} without the possibility of an else clause.  In your
+mind, you can replace @code{when} with @code{if} and understand what
+goes on.  That is what the Lisp interpreter does.
 
 Technically speaking, @code{when} is a Lisp macro.  A Lisp macro
 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.
 
 The @code{kill-region} function definition also has an @code{unless}
-macro; it is the converse of @code{when}.  The @code{unless} macro is
-an @code{if} without a then clause
+macro; it is the opposite of @code{when}.  The @code{unless} macro is
+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
 Emacs Lisp Reference Manual}.  The C programming language also
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 45436cd2bc6..5d05ef18d4f 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -5486,7 +5486,11 @@ made by the transaction.
 
 @defmac with-sqlite-transaction db body@dots{}
 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
 
 @defun sqlite-pragma db pragma
diff --git a/etc/NEWS.29 b/etc/NEWS.29
index 1b3532b5657..333699f1015 100644
--- a/etc/NEWS.29
+++ b/etc/NEWS.29
@@ -62,6 +62,11 @@ of showing the shortcuts.
 
 * 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
 
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 572822351b1..fec0a0301a7 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -341,10 +341,9 @@ This construct can only be used with lexical binding."
     ;; Keeping a work buffer around is more efficient than creating a
     ;; new temporary buffer.
     (with-current-buffer (get-buffer-create " *string-pixel-width*")
-      ;; If `display-line-numbers-mode' is enabled in internal
-      ;; buffers, it breaks width calculation, so disable it (bug#59311)
-      (when (bound-and-true-p display-line-numbers-mode)
-        (display-line-numbers-mode -1))
+      ;; If `display-line-numbers' is enabled in internal buffers
+      ;; (e.g. globally), it breaks width calculation (bug#59311)
+      (setq-local display-line-numbers nil)
       (delete-region (point-min) (point-max))
       ;; Disable line-prefix and wrap-prefix, for the same reason.
       (setq line-prefix nil
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index d3cb5a77e22..1a797bb1a03 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -979,7 +979,7 @@ It makes underscores and dots word constituent chars.")
     "raise" "return" "try" "while" "with" "yield"
     ;; These are technically operators, but we fontify them as
     ;; keywords.
-    "and" "in" "is" "not" "or"))
+    "and" "in" "is" "not" "or" "not in"))
 
 (defvar python--treesit-builtins
   '("abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray"
diff --git a/lisp/sqlite.el b/lisp/sqlite.el
index aad0aa40fa4..8a525739c9a 100644
--- a/lisp/sqlite.el
+++ b/lisp/sqlite.el
@@ -24,19 +24,28 @@
 ;;; Code:
 
 (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)))
   (let ((db-var (gensym))
-        (func-var (gensym)))
+        (func-var (gensym))
+        (res-var (gensym))
+        (commit-var (gensym)))
     `(let ((,db-var ,db)
-           (,func-var (lambda () ,@body)))
+           (,func-var (lambda () ,@body))
+           ,res-var ,commit-var)
        (if (sqlite-available-p)
            (unwind-protect
                (progn
                  (sqlite-transaction ,db-var)
-                 (funcall ,func-var))
-             (sqlite-commit ,db-var))
-         (funcall ,func-var)))))
+                 (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))))
 
 (provide 'sqlite)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]