From 0c029ae8bcb486ed4c52516f9e3605c0f8eaad87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sat, 9 Sep 2023 11:59:18 -0500 Subject: [PATCH 01/36] ; tweak etc/TODO item * etc/TODO (Support external rules for indentation): Add reference to discussion. --- etc/TODO | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/TODO b/etc/TODO index ef91c17298b..f1b3373e9e5 100644 --- a/etc/TODO +++ b/etc/TODO @@ -452,6 +452,10 @@ reformat the region of source code according to the rules. The next step is to use these rules during editing of files residing in a directory that has such an indentation-rules spec in it. +For some discussion and implementation ideas (including possibly using +LSP), see the thread starting at +https://lists.gnu.org/archive/html/emacs-devel/2023-09/msg00609.html + ** FFI (foreign function interface) See eg https://lists.gnu.org/r/emacs-devel/2013-10/msg00246.html From 459b5f6b6d1028217a723ad4693596edfcd0e32e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 10 Sep 2023 11:38:46 +0200 Subject: [PATCH 02/36] ; * admin/authors.el (authors-aliases): Update. --- admin/authors.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin/authors.el b/admin/authors.el index 671c3750d57..41ae67e34d9 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -100,6 +100,7 @@ files.") ("Fabián Ezequiel Gallina" "Fabian Ezequiel Gallina" "Fabi.n E\\. Gallina") (nil "felix.*EmacsWiki") (nil "felix\\.dick@web\\.de") + ("Felicián Németh" "Felician Nemeth") (nil "foudfou") ("Feraidoon Mehri" "NightMachinary" @@ -114,6 +115,7 @@ files.") ("Garid Zorigoo" "garid3000" "garidzorigoo@gmail\\.com") ("Gerd Möllmann" "Gerd Moellmann") (nil "haqle314") + ("Grégoire Jadi" "Gregoire Jadi") ("Hallvard B. Furuseth" "Hallvard B Furuseth" "Hallvard Furuseth") (nil "hokomo@airmail\\.cc" "hokomo") ("Hrvoje Nikšić" "Hrvoje Niksic") @@ -127,6 +129,7 @@ files.") ("J. Alexander Branham" "Alex Branham") ("Jaeyoun Chung" "Jae-youn Chung" "Jae-you Chung" "Chung Jae-youn") ("Jan Djärv" "Jan D\\>" "Jan Djarv") + ("Jan Synáček" "Jan Synacek") ("João Távora" "João Tãvora") ("Jay K. Adams" "Jay Adams") ("J.D. Smith" "Jd Smith") @@ -139,6 +142,7 @@ files.") (nil "jgarte@" "jgart") (nil "jicksaw@pm\\.me" "jicksaw") ("Jimmy Aguilar Mena" "Ergus") + ("Jindřich Makovička" "Jindrich Makovicka") ("Johan Bockgård" "Johan Bockgard") ("John F. Carr" "John F Carr") ("John J Foerch" "John Foerch") @@ -161,6 +165,7 @@ files.") ("Kenichi Handa" "Ken'ichi Handa" "Kenichi HANDA" "K\\. Handa") ("Kevin Greiner" "Kevin J. Greiner") ("Kim F. Storm" "Kim Storm") + ("Kjartan Óli Ágústsson" "Kjartan Oli Agustsson") ;; The dash is a kludge, so this contributor is not ignored. ("kobarity-" "kobarity@gmail\\.com") ("Koen van Greevenbroek" "realcomplex" "koenvg@posteo\\.net") From 3f04efe9e7d56388d29bb19c875c2004691eab4d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 10 Sep 2023 18:31:06 +0300 Subject: [PATCH 03/36] ; * src/font.h (struct font): Comment about use of average_width. --- src/font.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/font.h b/src/font.h index 492c2e58b09..aea49d6a823 100644 --- a/src/font.h +++ b/src/font.h @@ -298,10 +298,16 @@ struct font SPACE glyph, the value is 0. */ int space_width; - /* Average width of glyphs in the font. If the font itself doesn't - have that information, but has glyphs of ASCII characters, the - value is the average width of those glyphs. Otherwise, the value - is 0. */ + /* Average width of glyphs in the font. Should be the average width + of the glyphs of ASCII characters. The value for the default + face's font is used to determine the canonical character width of + the frame (see FRAME_COLUMN_WIDTH). For fonts that are not + fixed-pitch, the font backend should actually calculate the value + from the glyphs of ASCII characters in the range 32..126 + inclusively; relying on the average-width attribute recorded in + the font is unreliable in this case, especially in fonts that + support CJK scripts, where many characters are wide. Value can + be zero if the font doesn't have glyphs for ASCII characters. */ int average_width; /* Ascent and descent of the font (in pixels). */ From 35d88c657e15a762cb37ee354c63f1540c035268 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 10 Sep 2023 21:07:03 +0200 Subject: [PATCH 04/36] Document using Flymake together with Eglot * doc/misc/flymake.texi (Top, Using Flymake): Document using Flymake together with Eglot. (Bug#60040) --- doc/misc/flymake.texi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 66dba8a1d3c..be8fedf5672 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -59,8 +59,11 @@ types of diagnostics. To learn about using Flymake, @pxref{Using Flymake}. -Flymake is designed to be easily extended to support new backends via -an Elisp interface. @xref{Extending Flymake}. +When the Emacs LSP support mode Eglot is enabled, Flymake will use +that as an additional back-end. @xref{Eglot Features,,, eglot, Eglot: +The Emacs LSP Client} Flymake is also designed to be easily extended +to support new backends via an Elisp interface. @xref{Extending +Flymake}. Historically, Flymake used to accept diagnostics from a single backend. Although obsolete, it is still functional. To learn how to @@ -93,6 +96,10 @@ already setup this hook for you, by adding @dfn{backend functions} to @code{flymake-diagnostic-functions}. If you know Elisp you may also write your own Flymake backend functions. @xref{Backend functions}. +When the Emacs LSP support mode Eglot is enabled, Flymake will use +that as an additional back-end automatically. @xref{Eglot Features,,, +eglot, Eglot: The Emacs LSP Client} + @menu * Starting Flymake:: * Finding diagnostics:: From 5ab2792d5c19ccd2509e94a0ad3e024b6d33537e Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 11 Sep 2023 01:40:30 +0200 Subject: [PATCH 05/36] Update defvar usage tips example in manual * doc/lispref/variables.texi (Tips for Defining): Change example to be about syntax tables instead of old way of defining keymaps using 'defvar' and 'make-sparse-keymap'. (Bug#59224) --- doc/lispref/variables.texi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index f7322e11365..5de5ac6efa7 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -678,15 +678,15 @@ which are being phased out.) it as safe or risky; see @ref{File Local Variables}. When defining and initializing a variable that holds a complicated -value (such as a keymap with bindings in it), it's best to put the +value (such as a syntax table for a major mode), it's best to put the entire computation of the value into the @code{defvar}, like this: @example -(defvar my-mode-map - (let ((map (make-sparse-keymap))) - (keymap-set map "C-c C-a" 'my-command) +(defvar my-major-mode-syntax-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?# "<" table) @dots{} - map) + table) @var{docstring}) @end example @@ -696,9 +696,9 @@ loading the file, the variable is either still uninitialized or initialized properly, never in-between. If it is still uninitialized, reloading the file will initialize it properly. Second, reloading the file once the variable is initialized will not alter it; that is -important if the user has run hooks to alter part of the contents -(such as, to rebind keys). Third, evaluating the @code{defvar} form -with @kbd{C-M-x} will reinitialize the map completely. +important if the user has changed its value. Third, evaluating the +@code{defvar} form with @kbd{C-M-x} will reinitialize the variable +completely. @node Accessing Variables @section Accessing Variable Values From 6554ec224654186c9c87f4f0ee48b7353da84a7b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 11 Sep 2023 02:35:31 +0200 Subject: [PATCH 06/36] Update docs for passing of Thien-Thi Nguyen * doc/emacs/ack.texi (Acknowledgments): Add Thien-Thi Nguyen. * lisp/play/zone.el: Set maintainer to emacs-devel. --- doc/emacs/ack.texi | 5 +++++ lisp/play/zone.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi index 7d7f76b6645..de9af96e289 100644 --- a/doc/emacs/ack.texi +++ b/doc/emacs/ack.texi @@ -905,6 +905,11 @@ Takahashi Naoto co-wrote @file{quail.el} (q.v.), and wrote Thomas Neumann and Eric Raymond wrote @file{make-mode.el}, a mode for editing makefiles. +@item +Thien-Thi Nguyen wrote the @samp{xpm}, @samp{gnugo}, and +@samp{ascii-art-to-unicode} packages. He also made substantial +contributions to many others, such as @file{vc.el}. + @item Thien-Thi Nguyen and Dan Nicolaescu wrote @file{hideshow.el}, a minor mode for selectively displaying blocks of text. diff --git a/lisp/play/zone.el b/lisp/play/zone.el index 235c6f4e7b5..b8a83baa44b 100644 --- a/lisp/play/zone.el +++ b/lisp/play/zone.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2000-2023 Free Software Foundation, Inc. ;; Author: Victor Zandy -;; Maintainer: Thien-Thi Nguyen +;; Maintainer: emacs-devel@gnu.org ;; Keywords: games ;; Created: June 6, 1998 From d11d81dfcc6b50a8e889789e2d4696af1a544f7f Mon Sep 17 00:00:00 2001 From: shynur Date: Mon, 11 Sep 2023 22:56:39 +0800 Subject: [PATCH 07/36] ; Fix doc typos (Bug#65868) --- doc/emacs/custom.texi | 2 +- doc/lispref/compile.texi | 2 +- doc/lispref/keymaps.texi | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index ea29876be80..7ca618bd2f6 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -626,7 +626,7 @@ button. the theme file and asks if you really want to load it. Because loading a Custom theme can execute arbitrary Lisp code, you should only say yes if you know that the theme is safe; in that case, Emacs -offers to remember in the future that the theme is safe(this is done +offers to remember in the future that the theme is safe (this is done by saving the theme file's SHA-256 hash to the variable @code{custom-safe-themes}; if you want to treat all themes as safe, change its value to @code{t}). Themes that come with Emacs (in the diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 25b897125dd..96d66445360 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -422,7 +422,7 @@ execution of the compiled file. For example, @lisp (eval-when-compile (unless (fboundp 'some-new-thing) - (defmacro 'some-new-thing () + (defmacro some-new-thing () (compatibility code)))) @end lisp diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 24b7738caff..be924b5655a 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -90,7 +90,7 @@ Manual}. (kbd "C-x C-f") @result{} "\C-x\C-f" (kbd "C-x 4 C-f") @result{} "\C-x4\C-f" (kbd "X") @result{} "X" -(kbd "RET") @result{} "\^M" +(kbd "RET") @result{} "^M" (kbd "C-c SPC") @result{} "\C-c@ " (kbd " SPC") @result{} [f1 32] (kbd "C-M-") @result{} [C-M-down] From 33ee3e588fd9744714f1c0ab64de75a61db5eaca Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 11 Sep 2023 12:47:32 -0700 Subject: [PATCH 08/36] Fix regression of treesit_cursor_helper_1 * src/treesit.c (treesit_cursor_helper_1) (treesit_cursor_first_child_for_byte): Use ts_tree_cursor_goto_first_child_for_byte first, and ts_tree_cursor_goto_first_child second. --- src/treesit.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/treesit.c b/src/treesit.c index cb2113b3faf..8419452d54a 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -2160,7 +2160,10 @@ return nil. */) static bool treesit_cursor_first_child_for_byte (TSTreeCursor *cursor, ptrdiff_t pos, bool named) { - if (!ts_tree_cursor_goto_first_child (cursor)) + /* ts_tree_cursor_goto_first_child_for_byte is significantly faster, + so despite it having problems, we try it first. */ + if (ts_tree_cursor_goto_first_child_for_byte (cursor, pos) == -1 + && !ts_tree_cursor_goto_first_child (cursor)) return false; TSNode node = ts_tree_cursor_current_node (cursor); @@ -2890,7 +2893,11 @@ treesit_cursor_helper_1 (TSTreeCursor *cursor, TSNode *target, if (ts_node_eq (cursor_node, *target)) return true; - if (ts_tree_cursor_goto_first_child_for_byte (cursor, start_pos) == -1) + /* ts_tree_cursor_goto_first_child_for_byte is significantly faster, + so despite it having problems (see bug#60127), we try it + first. */ + if (ts_tree_cursor_goto_first_child_for_byte (cursor, start_pos) == -1 + && !ts_tree_cursor_goto_first_child (cursor)) return false; /* Go through each sibling that could contain TARGET. Because of From 946b395e7e1cd3685ca094531d8dbd1b89b0a7e6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 12 Sep 2023 21:45:19 +0300 Subject: [PATCH 09/36] * lisp/progmodes/c-ts-mode.el (c++-ts-mode): Provide (bug#65895). --- lisp/progmodes/c-ts-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 48d1fb09089..8660b65f309 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1377,5 +1377,6 @@ the code is C or C++ and based on that chooses whether to enable (add-to-list 'auto-mode-alist '("\\.h\\'" . c-or-c++-ts-mode))) (provide 'c-ts-mode) +(provide 'c++-ts-mode) ;;; c-ts-mode.el ends here From 1fb2fb501f34d7c08462209a798e65904ea7b8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= Date: Tue, 5 Sep 2023 21:29:27 +0200 Subject: [PATCH 10/36] typescript-ts-mode, tsx-ts-mode: Fix syntax properties for regexp and jsx Propertize regexps as strings and JSX elements as generic strings. * lisp/progmodes/typescript-ts-mode.el (ts-ts--s-p-query) (tsx-ts--s-p-query): New variables. (ts-ts--syntax-propertize, tsx-ts--syntax-propertize) (ts-ts--syntax-propertize-captures): New functions. (typescript-ts-mode, tsx-ts-mode): Use them (bug#65470). --- lisp/progmodes/typescript-ts-mode.el | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 96ea18523e3..57382c9cb31 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -418,6 +418,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." (keyword string escape-sequence) (constant expression identifier number pattern property) (function bracket delimiter))) + (setq-local syntax-propertize-function #'ts-ts--syntax-propertize) (treesit-major-mode-setup))) @@ -464,9 +465,47 @@ at least 3 (which is the default value)." (keyword string escape-sequence) (constant expression identifier jsx number pattern property) (function bracket delimiter))) + (setq-local syntax-propertize-function #'tsx-ts--syntax-propertize) (treesit-major-mode-setup))) +(defvar ts-ts--s-p-query + (when (treesit-available-p) + (treesit-query-compile 'typescript + '(((regex pattern: (regex_pattern) @regexp)))))) + +(defvar tsx-ts--s-p-query + (when (treesit-available-p) + (treesit-query-compile 'tsx + '(((regex pattern: (regex_pattern) @regexp)) + ((variable_declarator value: (jsx_element) @jsx)) + ((assignment_expression right: (jsx_element) @jsx)) + ((arguments (jsx_element) @jsx)) + ((parenthesized_expression (jsx_element) @jsx)) + ((return_statement (jsx_element) @jsx)))))) + +(defun ts-ts--syntax-propertize (beg end) + (let ((captures (treesit-query-capture 'typescript ts-ts--s-p-query beg end))) + (ts-ts--syntax-propertize-captures captures))) + +(defun tsx-ts--syntax-propertize (beg end) + (let ((captures (treesit-query-capture 'tsx tsx-ts--s-p-query beg end))) + (ts-ts--syntax-propertize-captures captures))) + +(defun ts-ts--syntax-propertize-captures (captures) + (pcase-dolist (`(,name . ,node) captures) + (let* ((ns (treesit-node-start node)) + (ne (treesit-node-end node)) + (syntax (pcase-exhaustive name + ('regexp + (cl-decf ns) + (cl-incf ne) + (string-to-syntax "\"/")) + ('jsx + (string-to-syntax "|"))))) + (put-text-property ns (1+ ns) 'syntax-table syntax) + (put-text-property (1- ne) ne 'syntax-table syntax)))) + (if (treesit-ready-p 'tsx) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))) From 5dcc4b7eab1bb6949bfcd179b3582f777dcc2cea Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 13 Sep 2023 02:21:04 +0300 Subject: [PATCH 11/36] Tweak s-p-f for js-ts-mode * lisp/progmodes/js.el (js-ts--s-p-query): Consider two more contexts (bug#65470). --- lisp/progmodes/js.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 9b6da4ec2fc..1528c6b7de5 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3871,6 +3871,8 @@ Currently there are `js-mode' and `js-ts-mode'." '(((regex pattern: (regex_pattern) @regexp)) ((variable_declarator value: (jsx_element) @jsx)) ((assignment_expression right: (jsx_element) @jsx)) + ((arguments (jsx_element) @jsx)) + ((parenthesized_expression (jsx_element) @jsx)) ((return_statement (jsx_element) @jsx)))))) (defun js-ts--syntax-propertize (beg end) From a65d1a5a16734ec987ce2644d25b5156931cbd2a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 13 Sep 2023 17:23:03 +0300 Subject: [PATCH 12/36] Improve documentation of 'list-abbrevs' * doc/emacs/abbrevs.texi (Editing Abbrevs): Describe how system abbrevs are shown by 'list-abbrevs'. Suggested by Shynur Xie . (Bug#65907) --- doc/emacs/abbrevs.texi | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi index 3678377e9b5..6c171d47427 100644 --- a/doc/emacs/abbrevs.texi +++ b/doc/emacs/abbrevs.texi @@ -275,6 +275,8 @@ Edit a list of abbrevs; you can add, alter or remove definitions. @example @var{various other tables@dots{}} +(python-mode-skeleton-abbrev-table) +"class" (sys) 0 "" python-skeleton-class (lisp-mode-abbrev-table) "ks" 0 "keymap-set" (global-abbrev-table) @@ -297,11 +299,14 @@ keeps track of this to help you see which abbrevs you actually use, so that you can eliminate those that you don't use often. The string at the end of the line is the expansion. - Some abbrevs are marked with @samp{(sys)}. These @dfn{system abbrevs} -(@pxref{Abbrevs,,, elisp, The Emacs Lisp Reference Manual}) are -pre-defined by various modes, and are not saved to your abbrev file. -To disable a system abbrev, define an abbrev of the same name that -expands to itself, and save it to your abbrev file. + Some abbrevs are marked with @samp{(sys)}. These @dfn{system +abbrevs} (@pxref{Abbrevs,,, elisp, The Emacs Lisp Reference Manual}) +are pre-defined by various modes, and are not saved to your abbrev +file. To disable a system abbrev, define an abbrev of the same name +that expands to itself, and save it to your abbrev file. The system +abbrevs have an associated hook function, which is called to perform +the abbrev expansion; the name of that function follows the abbrev +expansion in the buffer shown by @code{list-abbrevs}. @findex edit-abbrevs @kindex C-c C-c @r{(Edit Abbrevs)} From 9396d73942e0c912d978c25f9883e51668d33255 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 13 Sep 2023 19:49:29 +0300 Subject: [PATCH 13/36] * doc/emacs/text.texi (Outline Minor Mode): Add a note about value 'insert'. * lisp/outline.el (outline-minor-mode-use-buttons): Add a note and a comment about the value 'insert' (bug#65874). --- doc/emacs/text.texi | 9 +++++---- lisp/outline.el | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 7037c8c943a..0691cc7b78b 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -1020,10 +1020,11 @@ addition to ellipsis, to show that a section is hidden. Clicking the mouse on the button toggles display of the section. If the value of this variable is @code{insert}, the buttons are inserted directly into the buffer text, so @key{RET} on the button will also toggle display -of the section, like a mouse click does. If the value is -@code{in-margins}, Outline minor mode will use the window margins to -indicate that a section is hidden. The buttons are customizable as icons -(@pxref{Icons}). +of the section, like a mouse click does. Using the value @code{insert} +is not recommended in editable buffers because it modifies them. +If the value is @code{in-margins}, Outline minor mode will use the +window margins to indicate that a section is hidden. The buttons are +customizable as icons (@pxref{Icons}). @vindex outline-minor-mode-cycle If the @code{outline-minor-mode-cycle} user option is diff --git a/lisp/outline.el b/lisp/outline.el index 97a51c9b92a..d8dd491212e 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -314,12 +314,15 @@ These buttons can be used to hide and show the body under the heading. When the value is `insert', additional placeholders for buttons are inserted to the buffer, so buttons are not only clickable, but also typing `RET' on them can hide and show the body. +Using the value `insert' is not recommended in editable +buffers because it modifies them. When the value is `in-margins', then clickable buttons are displayed in the margins before the headings. When the value is `t', clickable buttons are displayed in the buffer before the headings. The values `t' and `in-margins' can be used in editing buffers because they don't modify the buffer." + ;; The value `insert' is not intended to be customizable. :type '(choice (const :tag "Do not use outline buttons" nil) (const :tag "Show outline buttons in margins" in-margins) (const :tag "Show outline buttons in buffer" t)) From 6cc6455e931913e42ef844c4a7d6ddcd0bf53788 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Mon, 11 Sep 2023 19:58:14 +0100 Subject: [PATCH 14/36] Fix SVG colors (bug#56182) * src/image.c (svg_load_image): Reverse the R and B bytes in the Windows colors before using them to generate the SVG. --- src/image.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/image.c b/src/image.c index 8ee802a9d62..c717ac88dca 100644 --- a/src/image.c +++ b/src/image.c @@ -11423,6 +11423,18 @@ svg_load_image (struct frame *f, struct image *img, char *contents, img->background_valid = 1; } +#if HAVE_NTGUI + /* Windows stores the image colours in BGR format, and SVG expects + them in RGB. */ + foreground = (foreground & 0x0000FF) << 16 + | (foreground & 0xFF0000) >> 16 + | (foreground & 0x00FF00); + + background = (background & 0x0000FF) << 16 + | (background & 0xFF0000) >> 16 + | (background & 0x00FF00); +#endif + wrapped_contents = xmalloc (buffer_size); if (buffer_size <= snprintf (wrapped_contents, buffer_size, wrapper, From 0065621d0d36112922792d7c46085230e999cba3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 13 Sep 2023 18:49:55 -0400 Subject: [PATCH 15/36] (report_overlay_modification): Fix bug#65929 Somehow the new overlay code in Emacs-29 changed slightly the test to decide when to run the `modification-hooks` of overlays, with the consequence that these hook functions end up being executed also when text is deleted right after an empty overlay, which is contrary to Emacs-28 behavior as well as contrary to the Texinfo doc. * src/buffer.c (report_overlay_modification): Better reproduce the Emacs-28 code. * test/src/buffer-tests.el (overlay-modification-hooks): Add corresponding test. --- src/buffer.c | 2 +- test/src/buffer-tests.el | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index 252231357bc..db362ffe7b0 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4091,7 +4091,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, } /* Test for intersecting intervals. This does the right thing for both insertion and deletion. */ - if (! insertion || (end_arg > obegin && begin_arg < oend)) + if (end_arg > obegin && begin_arg < oend) { Lisp_Object prop = Foverlay_get (overlay, Qmodification_hooks); if (!NILP (prop)) diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 45914b2b6b0..aa30533c6a0 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el @@ -142,6 +142,7 @@ properties." (expected-calls . ((modification-hooks (nil 3 4)) (modification-hooks (t 3 4 1))))) ((replace . "4")) + ((replace . "4") (overlay-beg . 4)) ;bug#65929 ((replace . "12") (expected-calls . ((modification-hooks (nil 1 3)) (modification-hooks (t 1 2 2))))) From 01e8a0c6cbf38c80ceb43b099ae1624697048302 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 13 Sep 2023 22:45:02 +0200 Subject: [PATCH 16/36] Doc fix for prettify-symbols-unprettify-at-point * lisp/progmodes/prog-mode.el (prettify-symbols-unprettify-at-point): Document that it has to be set before enabling 'prettify-symbols-mode'. (Bug#65884) --- lisp/progmodes/prog-mode.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 0f3a477abe5..4d8246155e9 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -216,7 +216,10 @@ If set to the symbol `right-edge', also unprettify if point is immediately after the symbol. The prettification will be reapplied as soon as point moves away from the symbol. If set to nil, the prettification persists even when point is -on the symbol." +on the symbol. + +This will only have an effect if it is set to a non-nil before +`prettify-symbols-mode' is activated." :version "25.1" :type '(choice (const :tag "Never unprettify" nil) (const :tag "Unprettify when point is inside" t) From ea14b0dcc206e1ab46797a8d1e122bcac8523851 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 14 Sep 2023 09:21:28 +0300 Subject: [PATCH 17/36] : Doc fix. * lisp/progmodes/prog-mode.el (prettify-symbols-unprettify-at-point): Doc fix. --- lisp/progmodes/prog-mode.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 4d8246155e9..fc0916af061 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -218,8 +218,8 @@ reapplied as soon as point moves away from the symbol. If set to nil, the prettification persists even when point is on the symbol. -This will only have an effect if it is set to a non-nil before -`prettify-symbols-mode' is activated." +This will only have an effect if it is set to a non-nil value +before `prettify-symbols-mode' is activated." :version "25.1" :type '(choice (const :tag "Never unprettify" nil) (const :tag "Unprettify when point is inside" t) From 809305e6d8fb2489b86a1fbf850f88d17a7864f0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 14 Sep 2023 12:52:14 +0300 Subject: [PATCH 18/36] Fix 'window-text-pixel-size' when there are several images at START * src/xdisp.c (window_text_pixel_size): Remove unnecessary call to 'move_it_to'. (Bug#65899) (Bug#54862) --- src/xdisp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index 11417070804..b39b13215f3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11420,7 +11420,6 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to, else move_it_in_display_line (&it, start, it1_x + 1, MOVE_TO_POS | MOVE_TO_X); - move_it_to (&it, start - 1, -1, -1, -1, MOVE_TO_POS); start_x = it.current_x; /* If we didn't change our buffer position, the pixel width of what's here was not yet accounted for; do it From 5ec8be1d58922eb7af95f720882dbb56410129d4 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 14 Sep 2023 16:08:54 +0300 Subject: [PATCH 19/36] ; * lisp/subr.el (string-suffix-p, string-prefix-p): Doc fix. --- lisp/subr.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index ce23a699624..426e8145cae 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -5494,9 +5494,11 @@ See also `string-equal'." (eq t (compare-strings string1 0 nil string2 0 nil t))) (defun string-prefix-p (prefix string &optional ignore-case) - "Return non-nil if PREFIX is a prefix of STRING. + "Return non-nil if STRING begins with PREFIX. +PREFIX should be a string; the function returns non-nil if the +characters at the beginning of STRING compare equal with PREFIX. If IGNORE-CASE is non-nil, the comparison is done without paying attention -to case differences." +to letter-case differences." (declare (pure t) (side-effect-free t)) (let ((prefix-length (length prefix))) (if (> prefix-length (length string)) nil @@ -5504,9 +5506,11 @@ to case differences." 0 prefix-length ignore-case))))) (defun string-suffix-p (suffix string &optional ignore-case) - "Return non-nil if SUFFIX is a suffix of STRING. + "Return non-nil if STRING ends with SUFFIX. +SUFFIX should be a string; the function returns non-nil if the +characters at end of STRING compare equal with SUFFIX. If IGNORE-CASE is non-nil, the comparison is done without paying -attention to case differences." +attention to letter-case differences." (declare (pure t) (side-effect-free t)) (let ((start-pos (- (length string) (length suffix)))) (and (>= start-pos 0) From c9cb8ee0fc0dd3cad7b56b8fc37f943a0f12f326 Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Thu, 14 Sep 2023 08:24:43 -0300 Subject: [PATCH 20/36] Fix defcustom in saveplace.el (Bug#65977) * lisp/saveplace.el (save-place-ignore-files-regexp): Allow nil. --- lisp/saveplace.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/saveplace.el b/lisp/saveplace.el index 71cd8b9bc0e..92228dc8e78 100644 --- a/lisp/saveplace.el +++ b/lisp/saveplace.el @@ -133,7 +133,8 @@ Useful for temporary file such as commit message files that are automatically created by the VCS. If set to nil, this feature is disabled, i.e., the position is recorded for all files." :version "24.1" - :type 'regexp) + :type '(choice (const :tag "Record position for all files" nil) + regexp)) (declare-function dired-current-directory "dired" (&optional localp)) From f0a89fa1d0e5b380ecadb57052c95b31110c0323 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 14 Sep 2023 16:18:03 +0300 Subject: [PATCH 21/36] ; * lisp/saveplace.el (save-place-ignore-files-regexp): Fix last change. --- lisp/saveplace.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/saveplace.el b/lisp/saveplace.el index 92228dc8e78..97c631b39b0 100644 --- a/lisp/saveplace.el +++ b/lisp/saveplace.el @@ -128,12 +128,12 @@ removable and network volumes." (defcustom save-place-ignore-files-regexp "\\(?:COMMIT_EDITMSG\\|hg-editor-[[:alnum:]]+\\.txt\\|svn-commit\\.tmp\\|bzr_log\\.[[:alnum:]]+\\)$" - "Regexp matching files for which no position should be recorded. -Useful for temporary file such as commit message files that are -automatically created by the VCS. If set to nil, this feature is -disabled, i.e., the position is recorded for all files." + "Regexp matching files whose positions should not be recorded. +Useful to exclude temporary files, such as commit message files that are +automatically created by VCSes. If set to nil, this feature is +disabled, i.e., no files are excluded." :version "24.1" - :type '(choice (const :tag "Record position for all files" nil) + :type '(choice (const :tag "Don't exclude any files" nil) regexp)) (declare-function dired-current-directory "dired" (&optional localp)) From 738d8543337ee01eaa889f26da473dc84f652b8a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Sep 2023 10:02:00 +0300 Subject: [PATCH 22/36] Support emacsclient on Windows with server on GNU or Unix systems * lisp/server.el (server-process-filter): If 'tty-name' is literally "CONOUT$", assume the client runs on MS-Windows and force the frame type to GUI. This allows to run emacsclient on MS-Windows when the server runs on a Posix host. (Bug#65812) --- lisp/server.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/server.el b/lisp/server.el index 104fc060c05..1006fee5c4c 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1262,9 +1262,12 @@ The following commands are accepted by the client: ;; choice there.) In daemon mode on Windows, we can't ;; make tty frames, so force the frame type to GUI ;; there too. - (when (and (eq system-type 'windows-nt) - (or (daemonp) - (eq window-system 'w32))) + (when (or (and (eq system-type 'windows-nt) + (or (daemonp) + (eq window-system 'w32))) + ;; Client runs on Windows, but the server + ;; runs on a Posix host. + (equal tty-name "CONOUT$")) (push "-window-system" args-left))) ;; -position +LINE[:COLUMN]: Set point to the given From 29055412f2d99efbce09447cf88fca567eeafc86 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Sep 2023 10:17:30 +0300 Subject: [PATCH 23/36] ; Fix doc string of 'lsh' * lisp/subr.el (lsh): Doc fix. Suggested by Richard Stallman . --- lisp/subr.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 426e8145cae..d5c461346cb 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -507,8 +507,10 @@ If COUNT is negative, shifting is actually to the right. In this case, if VALUE is a negative fixnum treat it as unsigned, i.e., subtract 2 * `most-negative-fixnum' from VALUE before shifting it. -This function is provided for compatibility. In new code, use `ash' -instead." +Most uses of this function turn out to be mistakes. We recommend +to use `ash' instead, unless COUNT could ever be negative, and +if, when COUNT is negative, your program really needs the special +treatment of negative COUNT provided by this function." (declare (compiler-macro (lambda (form) (macroexp-warn-and-return "avoid `lsh'; use `ash' instead" From 2fc7463c0e5de1d57e0641e91616f9ffc0d663de Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 15 Sep 2023 14:28:09 +0300 Subject: [PATCH 24/36] ; * INSTALL: Don't advertise -O3. (Bug#65988) --- INSTALL | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 2bb8df52dc9..28483b41726 100644 --- a/INSTALL +++ b/INSTALL @@ -492,12 +492,12 @@ shell such as Bash, which uses these variables: ./configure \ CPPFLAGS='-I/foo/myinclude' LDFLAGS='-L/bar/mylib' \ - CFLAGS='-O3' LIBS='-lfoo -lbar' + CFLAGS='-Og' LIBS='-lfoo -lbar' (this is all one shell command). This tells 'configure' to instruct the preprocessor to look in the '/foo/myinclude' directory for header files (in addition to the standard directories), instruct the linker -to look in '/bar/mylib' for libraries, pass the -O3 optimization +to look in '/bar/mylib' for libraries, pass the -Og optimization switch to the compiler, and link against libfoo and libbar libraries in addition to the standard ones. From 6fe11b88ed044f08680a174ce1b7677b1a5d9be1 Mon Sep 17 00:00:00 2001 From: Davide Masserut Date: Thu, 24 Aug 2023 18:33:39 +0200 Subject: [PATCH 25/36] Avoid using --display in emacsclient to reuse frames on PGTK Using hard-coded display values can cause PGTK graphical frames to open using the wrong backend or not open at all. * Makefile.in (install-etc): Use --reuse-frame instead of --display=$DISPLAY. (Bug#65509) --- Makefile.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.in b/Makefile.in index f5fda0eb61a..0ab34c8be6a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -830,6 +830,9 @@ EMACS_ICON=emacs ifeq (${USE_STARTUP_NOTIFICATION},no) USE_STARTUP_NOTIFICATION_SED_CMD=-e "/^StartupNotify=true$$/d" endif +ifeq ($(HAVE_PGTK),yes) +USE_WAYLAND_DISPLAY_SED_CMD=-e "s/display=[^ ]*/reuse-frame/" +endif install-etc: umask 022; ${MKDIR_P} "$(DESTDIR)${desktopdir}" tmp=etc/emacs.tmpdesktop; rm -f $${tmp}; \ @@ -844,6 +847,7 @@ install-etc: sed -e "/^Exec=/ s|emacsclient|${bindir}/$${client_name}|" \ -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \ $(USE_STARTUP_NOTIFICATION_SED_CMD) \ + $(USE_WAYLAND_DISPLAY_SED_CMD) \ ${srcdir}/etc/emacsclient.desktop > $${tmp}; \ ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}.desktop"; \ rm -f $${tmp} @@ -857,6 +861,7 @@ install-etc: client_name=`echo emacsclient | sed '$(TRANSFORM)'`${EXEEXT}; \ sed -e "/^Exec=/ s|emacsclient|${bindir}/$${client_name}|" \ -e "/^Icon=emacs/ s/emacs/${EMACS_NAME}/" \ + $(USE_WAYLAND_DISPLAY_SED_CMD) \ ${srcdir}/etc/emacsclient-mail.desktop > $${tmp}; \ ${INSTALL_DATA} $${tmp} "$(DESTDIR)${desktopdir}/$${client_name}-mail.desktop"; \ rm -f $${tmp} From 65f4810003b617ea2e5a1149ad66521640bd7fec Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 15 Sep 2023 16:30:58 +0300 Subject: [PATCH 26/36] tsx-ts-mode--font-lock-compatibility-bb1f97b: Improve * lisp/progmodes/typescript-ts-mode.el (tsx-ts-mode--font-lock-compatibility-bb1f97b): Test the more complex query, because the current one leads to false positives (mentioned in bug#65470). --- lisp/progmodes/typescript-ts-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 57382c9cb31..7108ff49b28 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -163,7 +163,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." ;; but then raises an error if the wrong node type is used. So it is ;; important to check with the new node type (member_expression) (condition-case nil - (progn (treesit-query-capture language '((member_expression) @capture)) + (progn (treesit-query-capture language '(jsx_opening_element (member_expression) @capture)) '((jsx_opening_element [(member_expression (identifier)) (identifier)] @typescript-ts-jsx-tag-face) From e110312ad959f2119c788a97be60451b3231d652 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Sep 2023 08:55:17 +0300 Subject: [PATCH 27/36] ; * doc/lispref/minibuf.texi (Text from Minibuffer): Mention alias. --- doc/lispref/minibuf.texi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 5ef061891b9..620c58ec6e9 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -374,6 +374,7 @@ key, so the text properties are only preserved on the last three characters. @end defvar +@vindex minibuffer-mode-map @defvar minibuffer-local-map This @anchor{Definition of minibuffer-local-map} @@ -414,6 +415,9 @@ default, it makes the following bindings: @code{file-cache-minibuffer-complete} @end ignore @end table + +@noindent +The variable @code{minibuffer-mode-map} is an alias for this variable. @end defvar @defun read-no-blanks-input prompt &optional initial inherit-input-method From ba924be4522e9ed0a79ae61df2bf1a31b7355630 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Sep 2023 09:25:08 +0300 Subject: [PATCH 28/36] ; * etc/DEBUG: Improve the redisplay section. --- etc/DEBUG | 91 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/etc/DEBUG b/etc/DEBUG index cfa033d6c0c..8b997e50081 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -472,6 +472,16 @@ and, assuming that "xtype" says that args[0] is a symbol: ** Debugging Emacs redisplay problems +The Emacs display code includes special debugging code, but it is normally +disabled. Configuring Emacs with --enable-checking='yes,glyphs' enables it. + +Building Emacs like that activates many assertions which scrutinize display +code operation more than Emacs does normally. (To see the code which tests +these assertions, look for calls to the 'eassert' macros.) Any assertion that +is reported to fail should be investigated. Redisplay problems that cause +aborts or segfaults in production builds of Emacs will many times be caught by +these assertions before they cause a crash. + If you configured Emacs with --enable-checking='glyphs', you can use redisplay tracing facilities from a running Emacs session. @@ -481,21 +491,18 @@ code paths taken by the display engine under various conditions, especially if some redisplay optimizations produce wrong results. (You know that redisplay optimizations might be involved if "M-x redraw-display RET", or even just typing "M-x", causes Emacs to correct the bad display.) Since the cursor -blinking feature triggers periodic redisplay cycles, we recommend disabling -'blink-cursor-mode' before invoking 'trace-redisplay', so that you have less -clutter in the trace. You can also have up to 30 last trace messages dumped to -standard error by invoking the 'dump-redisplay-history' command. +blinking feature and ElDoc trigger periodic redisplay cycles, we recommend +disabling 'blink-cursor-mode' and 'global-eldoc-mode' before invoking +'trace-redisplay', so that you have less clutter in the trace. You can also +have up to 30 last trace messages dumped to standard error by invoking the +'dump-redisplay-history' command. To find the code paths which were taken by the display engine, search xdisp.c for the trace messages you see. The command 'dump-glyph-matrix' is useful for producing on standard error stream a full dump of the selected window's glyph matrix. See the function's -doc string for more details. If you are debugging redisplay issues in -text-mode frames, you may find the command 'dump-frame-glyph-matrix' useful. - -Other commands useful for debugging redisplay are 'dump-glyph-row' and -'dump-tool-bar-row'. +doc string for more details. If you run Emacs under GDB, you can print the contents of any glyph matrix by just calling that function with the matrix as its argument. For example, the @@ -507,13 +514,11 @@ whose pointer is in 'w': (The second argument 2 tells dump_glyph_matrix to print the glyphs in a long form.) -The Emacs display code includes special debugging code, but it is normally -disabled. Configuring Emacs with --enable-checking='yes,glyphs' enables it. +If you are debugging redisplay issues in text-mode frames, you may find the +command 'dump-frame-glyph-matrix' useful. -Building Emacs like that activates many assertions which scrutinize -display code operation more than Emacs does normally. (To see the -code which tests these assertions, look for calls to the 'eassert' -macros.) Any assertion that is reported to fail should be investigated. +Other commands useful for debugging redisplay are 'dump-glyph-row' and +'dump-tool-bar-row'. When you debug display problems running emacs under X, you can use the 'ff' command to flush all pending display updates to the screen. @@ -535,36 +540,40 @@ object of the relevant type as argument. For example, 'pgrowx' dumps all glyphs in its argument, which must be of type 'struct glyph_row'. Since redisplay is performed by Emacs very frequently, you need to place your -breakpoints cleverly to avoid hitting them all the time, when the issue you are -debugging did not (yet) happen. Here are some useful techniques for that: +breakpoints cleverly to avoid hitting them all the time, when the issue you +are debugging did not (yet) happen. Here are some useful techniques for that: - . Put a breakpoint at 'Fredraw_display' before running Emacs. Then do - whatever is required to reproduce the bad display, and invoke "M-x - redraw-display". The debugger will kick in, and you can set or enable - breakpoints in strategic places, knowing that the bad display will be + . Put a breakpoint at 'Frecenter' or 'Fredraw_display' before running Emacs. + Then do whatever is required to reproduce the bad display, and type C-l or + "M-x redraw-display" just before invoking the last action that reproduces + the bug. The debugger will kick in, and you can set or enable breakpoints + in strategic places, knowing that the bad display will happen soon. With a + breakpoint at 'Fredraw_display', you can even reproduce the bug and invoke + "M-x redraw-display" afterwards, knowing that the bad display will be redrawn from scratch. - . For debugging incorrect cursor position, a good place to put a breakpoint is - in 'set_cursor_from_row'. The first time this function is called as part of - 'redraw-display', Emacs is redrawing the minibuffer window, which is usually - not what you want; type "continue" to get to the call you want. In general, - always make sure 'set_cursor_from_row' is called for the right window and - buffer by examining the value of w->contents: it should be the buffer whose - display you are debugging. + . For debugging incorrect cursor position, a good place to put a breakpoint + is in 'set_cursor_from_row'. The first time this function is called as + part of 'redraw-display', Emacs is redrawing the minibuffer window, which + is usually not what you want; type "continue" to get to the call you want. + In general, always make sure 'set_cursor_from_row' is called for the right + window and buffer by examining the value of w->contents: it should be the + buffer whose display you are debugging. . 'set_cursor_from_row' is also a good place to look at the contents of a screen line (a.k.a. "glyph row"), by means of the 'pgrow' GDB command. Of course, you need first to make sure the cursor is on the screen line which - you want to investigate. If you have set a breakpoint in 'Fredraw_display', - as advised above, move cursor to that line before invoking 'redraw-display'. + you want to investigate. If you have set a breakpoint in 'Fredraw_display' + or 'Frecenter', as advised above, move cursor to that line before invoking + these commands. . If the problem happens only at some specific buffer position or for some - specific rarely-used character, you can make your breakpoints conditional on - those values. The display engine maintains the buffer and string position - it is processing in the it->current member; for example, the buffer - character position is in it->current.pos.charpos. Most redisplay functions - accept a pointer to a 'struct it' object as their argument, so you can make - conditional breakpoints in those functions, like this: + specific rarely-used character, you can make your breakpoints conditional + on those values. The display engine maintains the buffer and string + position it is processing in the it->current member; for example, the + buffer character position is in it->current.pos.charpos. Most redisplay + functions accept a pointer to a 'struct it' object as their argument, so + you can make conditional breakpoints in those functions, like this: (gdb) break x_produce_glyphs if it->current.pos.charpos == 1234 @@ -578,6 +587,16 @@ debugging did not (yet) happen. Here are some useful techniques for that: GET_FROM_IMAGE for displaying an image, etc. See 'enum it_method' in dispextern.h for the full list of values. + . When the display engine is processing a 'display' text property or an + overlay string, it pushes on the iterator stack the state variables + describing its iteration of buffer text, then reinitializes the iterator + object for processing the property or overlay. The it->sp ("stack + pointer") member, if it is greater than zero, means the iterators stack was + pushed at least once. You can therefore condition your breakpoints on the + value of it->sp being positive or being of a certain positive value, to + debug display problems that happen only with display properties or + overlays. + ** Debugging problems with native-compiled Lisp. When you encounter problems specific to native-compilation of Lisp, we From 8970cdd009aa4444666e9a3e05c2743839b35c3a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Sep 2023 09:26:30 +0300 Subject: [PATCH 29/36] ; Fix last change. --- etc/DEBUG | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/DEBUG b/etc/DEBUG index 8b997e50081..d24e0e6ce00 100644 --- a/etc/DEBUG +++ b/etc/DEBUG @@ -591,9 +591,9 @@ are debugging did not (yet) happen. Here are some useful techniques for that: overlay string, it pushes on the iterator stack the state variables describing its iteration of buffer text, then reinitializes the iterator object for processing the property or overlay. The it->sp ("stack - pointer") member, if it is greater than zero, means the iterators stack was - pushed at least once. You can therefore condition your breakpoints on the - value of it->sp being positive or being of a certain positive value, to + pointer") member, if it is greater than zero, means the iterator's stack + was pushed at least once. You can therefore condition your breakpoints on + the value of it->sp being positive or being of a certain positive value, to debug display problems that happen only with display properties or overlays. From 58fd212d8a2ff5e5205efdc49d419cbb05611e32 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Sep 2023 10:33:10 +0300 Subject: [PATCH 30/36] Fix Emoji zooming commands * lisp/international/emoji.el (emoji-zoom-increase): Handle the case where face property at point is a list of faces. (Bug#65994) --- lisp/international/emoji.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index 04854ede6be..8a34be91d10 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -726,10 +726,14 @@ FACTOR is the multiplication factor for the size." (add-text-properties (point) (1+ (point)) (list 'face - (if (eq (car old) :height) - (plist-put (copy-sequence old) :height newheight) + (cond + ((eq (car old) :height) + (plist-put (copy-sequence old) :height newheight)) + ((plistp (car old)) (cons (plist-put (car old) :height newheight) (cdr old))) + (t + (append (list (list :height newheight)) old))) 'rear-nonsticky t)) (add-face-text-property (point) (1+ (point)) (list :height newheight)) From f880b94e64918ab3b82d10048b519570e4b055ce Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Sep 2023 10:53:05 +0300 Subject: [PATCH 31/36] Fix the 'C' and 'c' categories of characters * lisp/international/characters.el: Fix categories of Chinese characters. (Bug65995) --- lisp/international/characters.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 9aea5e27063..21e2b59a1a4 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -141,10 +141,10 @@ with L, LRE, or LRO Unicode bidi character type.") ;; Chinese characters (Unicode) (modify-category-entry '(#x2E80 . #x312F) ?|) (modify-category-entry '(#x3190 . #x33FF) ?|) -(modify-category-entry '(#x3400 . #x4DB5) ?C) -(modify-category-entry '(#x4E00 . #x9FD5) ?C) -(modify-category-entry '(#x3400 . #x9FD5) ?c) -(modify-category-entry '(#x3400 . #x9FD5) ?|) +(modify-category-entry '(#x3400 . #x4DBF) ?C) +(modify-category-entry '(#x4E00 . #x9FFF) ?C) +(modify-category-entry '(#x3400 . #x9FFF) ?c) +(modify-category-entry '(#x3400 . #x9FFF) ?|) (modify-category-entry '(#xF900 . #xFAFF) ?C) (modify-category-entry '(#xF900 . #xFAFF) ?c) (modify-category-entry '(#xF900 . #xFAFF) ?|) From 825be05b379b1643adf6d0495deb691ac566e090 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 16 Sep 2023 09:59:31 +0200 Subject: [PATCH 32/36] Support one-time passwords in Tramp * doc/misc/tramp.texi (Remote shell setup): Describe tramp-otp-password-prompt-regexp. * lisp/net/tramp-sh.el (tramp-actions-before-shell) (tramp-actions-copy-out-of-band): Use `tramp-otp-password-prompt-regexp'. * lisp/net/tramp.el (tramp-otp-password-prompt-regexp): New defcustom. (tramp-action-otp-password): New defun. --- doc/misc/tramp.texi | 6 ++++++ lisp/net/tramp-sh.el | 2 ++ lisp/net/tramp.el | 29 +++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 7aea2795ba2..eb7d59a97b8 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2417,8 +2417,10 @@ which may not be the same as the local login shell prompt, @value{tramp} sets a similar default value for both prompts. @item @code{tramp-password-prompt-regexp} +@item @code{tramp-otp-password-prompt-regexp} @item @code{tramp-wrong-passwd-regexp} @vindex tramp-password-prompt-regexp +@vindex tramp-otp-password-prompt-regexp @vindex tramp-wrong-passwd-regexp @value{tramp} uses @code{tramp-password-prompt-regexp} to @@ -2452,6 +2454,10 @@ This user option is, by default, initialized from is usually more convenient to add new passphrases to that user option instead of altering this user option. +The user option @code{tramp-otp-password-prompt-regexp} has a similar +purpose, but for one-time passwords. Those passwords are not cached +by @value{tramp} for reuse. + Similar localization may be necessary for handling wrong password prompts, for which @value{tramp} uses @code{tramp-wrong-passwd-regexp}. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 5a1e73aab2b..59d5c00515f 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -535,6 +535,7 @@ shell from reading its init file." (defconst tramp-actions-before-shell '((tramp-login-prompt-regexp tramp-action-login) (tramp-password-prompt-regexp tramp-action-password) + (tramp-otp-password-prompt-regexp tramp-action-otp-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) (shell-prompt-pattern tramp-action-succeed) (tramp-shell-prompt-pattern tramp-action-succeed) @@ -558,6 +559,7 @@ corresponding PATTERN matches, the ACTION function is called.") (defconst tramp-actions-copy-out-of-band '((tramp-password-prompt-regexp tramp-action-password) + (tramp-otp-password-prompt-regexp tramp-action-otp-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) (tramp-copy-failed-regexp tramp-action-permission-denied) (tramp-security-key-confirm-regexp tramp-action-show-and-confirm-message) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d10f93b34b2..502ededcfb7 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -679,6 +679,16 @@ The `sudo' program appears to insert a `^@' character into the prompt." :version "29.1" :type 'regexp) +(defcustom tramp-otp-password-prompt-regexp + (rx bol (* nonl) + ;; JumpCloud. + (group (| "Verification code")) + (* nonl) (any "::៖") (* blank)) + "Regexp matching one-time password prompts. +The regexp should match at end of buffer." + :version "29.2" + :type 'regexp) + (defcustom tramp-wrong-passwd-regexp (rx bol (* nonl) (| "Permission denied" @@ -5538,6 +5548,25 @@ of." (narrow-to-region (point-max) (point-max)))) t) +(defun tramp-action-otp-password (proc vec) + "Query the user for a one-time password." + (with-current-buffer (process-buffer proc) + (let ((case-fold-search t) + prompt) + (goto-char (point-min)) + (tramp-check-for-regexp proc tramp-process-action-regexp) + (setq prompt (concat (match-string 1) " ")) + (tramp-message vec 3 "Sending %s" (match-string 1)) + ;; We don't call `tramp-send-string' in order to hide the + ;; password from the debug buffer and the traces. + (process-send-string + proc + (concat + (tramp-read-passwd-without-cache proc prompt) tramp-local-end-of-line)) + ;; Hide password prompt. + (narrow-to-region (point-max) (point-max)))) + t) + (defun tramp-action-succeed (_proc _vec) "Signal success in finding shell prompt." (throw 'tramp-action 'ok)) From cbd8fac283aa6573501d7b17b50ec4a83d9cf1e3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Sep 2023 12:17:23 +0300 Subject: [PATCH 33/36] Fix Unicode normalization of characters * lisp/international/ucs-normalize.el (ucs-normalize-composition-exclusions, check-range): Update from Unicode 15.0 data. (Bug#65996) * test/lisp/international/ucs-normalize-tests.el (ucs-normalize-tests--failing-lines-part1) (ucs-normalize-tests--failing-lines-part2): Update to reflect changes in ucs-normalize.el. * admin/notes/unicode: Mention the updates in ucs-normalize.el. --- admin/notes/unicode | 5 + lisp/international/ucs-normalize.el | 14 +- .../lisp/international/ucs-normalize-tests.el | 134 ++---------------- 3 files changed, 31 insertions(+), 122 deletions(-) diff --git a/admin/notes/unicode b/admin/notes/unicode index 31c850af8fd..b36dd428b0d 100644 --- a/admin/notes/unicode +++ b/admin/notes/unicode @@ -90,6 +90,11 @@ might need to be updated because it knows about used and unused ranges of Unicode codepoints, which a new release of the Unicode Standard could change. +The data used by ucs-normalize.el might need to be updated. +Specifically, the values of 'ucs-normalize-composition-exclusions' and +'check-range", defined at the beginning of ucs-normalize.el, should be +verified against the latest Unicode data files. + Next, test normalization functions against NormalizationTests.txt, in the test/ directory run: diff --git a/lisp/international/ucs-normalize.el b/lisp/international/ucs-normalize.el index aed7a6a1392..67e8ab428e9 100644 --- a/lisp/international/ucs-normalize.el +++ b/lisp/international/ucs-normalize.el @@ -131,11 +131,19 @@ #x1D1BF #x1D1C0) "Composition Exclusion List. This list is taken from - https://www.unicode.org/Public/UNIDATA/5.2/CompositionExclusions.txt") + https://www.unicode.org/Public/UNIDATA/15.0/CompositionExclusions.txt") + + ;; Unicode ranges where decompositions & combining characters are + ;; defined. Find them by running the following Awk program on + ;; UnicodeData.txt: + ;; + ;; gawk -F";" "$6 != \"\" {print $0}" - ;; Unicode ranges that decompositions & combining characters are defined. (defvar check-range nil) - (setq check-range '((#x00a0 . #x3400) (#xA600 . #xAC00) (#xF900 . #x110ff) (#x1d000 . #x1dfff) (#x1f100 . #x1f2ff) (#x2f800 . #x2faff))) + (setq check-range + '((#x00A0 . #x3400) (#xA600 . #xAC00) (#xF900 . #x11100) + (#x11100 . #x11A00) (#x1D000 . #x1E100) (#x1EE00 . #x1F300) + (#x1FBF0 . #x1FC00) (#x2F800 . #x2FB00))) ;; Basic normalization functions (defun nfd (char) diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el index 97b8fa66cd3..e874bf3ebde 100644 --- a/test/lisp/international/ucs-normalize-tests.el +++ b/test/lisp/international/ucs-normalize-tests.el @@ -184,43 +184,7 @@ Must be called with `ucs-normalize-tests--norm-buf' as current buffer." (should-not (ucs-normalize-tests--rule1-failing-for-partX 0))) (defconst ucs-normalize-tests--failing-lines-part1 - (list 2412 2413 2414 15133 15134 15135 15136 15137 - 15138 15139 15140 15141 15142 15143 15144 15145 - 15146 15147 15148 15149 15150 15151 15152 15153 - 15154 15155 15156 15157 15158 15159 15160 15161 - 15162 15163 15164 15165 15166 15167 15168 15169 - 15170 15171 15172 15173 15174 15175 15176 15177 - 15178 15179 15180 15181 15182 15183 15184 15185 - 15186 15187 15188 15192 15193 15194 15195 15196 - 15197 15198 15199 15200 15201 16211 16212 16213 - 16214 16215 16216 16217 16218 16219 16220 16221 - 16222 16223 16224 16225 16226 16227 16228 16229 - 16230 16231 16232 16233 16234 16235 16236 16237 - 16238 16239 16240 16241 16242 16243 16244 16245 - 16246 16247 16248 16249 16250 16251 16252 16253 - 16254 16255 16256 16257 16258 16259 16260 16261 - 16262 16263 16264 16265 16266 16267 16268 16269 - 16270 16271 16272 16273 16274 16275 16276 16277 - 16278 16279 16280 16281 16282 16283 16284 16285 - 16286 16287 16288 16289 16290 16291 16292 16293 - 16294 16295 16296 16297 16298 16299 16300 16301 - 16302 16303 16304 16305 16306 16307 16308 16309 - 16310 16311 16312 16313 16314 16315 16316 16317 - 16318 16319 16320 16321 16322 16323 16324 16325 - 16326 16327 16328 16329 16330 16331 16332 16333 - 16334 16335 16336 16337 16338 16339 16340 16341 - 16342 16343 16344 16345 16346 16347 16348 16349 - 16350 16351 16352 16353 16354 16355 16356 16357 - 16358 16359 16360 16361 16362 16363 16364 16365 - 16366 16367 16368 16369 16370 16371 16372 16373 - 16374 16375 16376 16377 16378 16379 16380 16381 - 16382 16383 16384 16385 16386 16387 16388 16389 - 16390 16391 16392 16393 16394 16395 16396 16397 - 16398 16399 16400 16401 16402 16403 16404 16405 - 16406 16407 16408 16409 16410 16411 16412 16413 - 16550 16551 16552 16553 16554 16555 16556 16557 - 16488 16489 16490 16491 16492 16493 16494 16495 - 16496 16497 16558 16559)) + (list )) ;; Keep a record of failures, for consulting afterwards (the ert ;; backtrace only shows a truncated version of these lists). @@ -283,88 +247,20 @@ Must be called with `ucs-normalize-tests--norm-buf' as current buffer." ucs-normalize-tests--failing-lines-part1))) (defconst ucs-normalize-tests--failing-lines-part2 - (list 17087 17088 17089 17090 17091 17092 17093 17094 - 17098 17099 17100 17101 17102 17103 17104 17105 - 17106 17107 17108 17113 17114 17115 17116 17117 - 17118 17119 17120 17125 17126 17127 17128 17129 - 17130 17131 17132 17133 17134 17135 17136 17137 - 17138 17139 17140 17141 17142 17143 17144 17145 - 17146 17157 17158 17159 17160 17161 17162 17163 - 17164 17185 17186 17187 17188 17189 17190 17197 - 17198 17199 17200 17207 17208 17209 17210 17211 - 17212 17213 17214 17219 17220 17221 17222 17275 - 17276 17285 17286 17295 17296 17309 17310 17311 - 17312 17313 17314 17315 17316 17317 17318 17319 - 17320 17325 17326 17373 17374 17419 17420 17421 - 17422 17433 17434 17439 17440 17465 17466 17473 - 17474 17479 17480 17485 17486 17491 17492 17497 - 17498 17499 17500 17501 17502 17505 17506 17507 - 17508 17511 17512 17519 17520 17523 17524 17527 - 17528 17531 17532 17551 17552 17555 17556 17599 - 17600 17601 17602 17603 17604 17605 17607 17608 - 17609 17610 17611 17612 17613 17615 17617 17619 - 17621 17623 17625 17627 17629 17631 17632 17633 - 17634 17635 17636 17637 17638 17639 17640 17669 - 17670 17675 17676 17681 17682 17689 17690 17691 - 17692 17693 17694 17707 17708 17713 17714 17715 - 17716 17727 17728 17733 17734 17739 17740 17745 - 17746 17749 17750 17753 17754 17759 17760 17767 - 17768 17789 17790 17801 17802 17807 17808 17809 - 17810 17811 17812 17813 17814 17815 17816 17821 - 17822 17829 17830 17843 17844 17845 17846 17851 - 17852 17861 17875 17876 17879 17880 17899 17900 - 17097 17907 17908 17911 17912 17913 17914 17915 - 17916 17917 17918 17919 17920 17921 17922 17927 - 17928 17929 17930 17931 17932 17933 17935 17937 - 17938 17939 17940 17941 17943 17945 17947 17949 - 17951 17952 17953 17955 17957 17959 17961 17962 - 17967 17968 17987 17988 17993 17994 18003 18004 - 18005 18006 18007 18008 18009 18010 18011 18012 - 18017 18018 18019 18020 18021 18022 18023 18024 - 18041 18042 18049 18050 18053 18054 18055 18056 - 18069 18070 18079 18080 18163 18164 18165 18166 - 18171 18172 18175 18176 18211 18212 18219 18220 - 18221 18222 18223 18224 18225 18226 18301 18302 - 18389 18390 18391 18392 18393 18394 18397 18398 - 18407 18408 18439 18440 18441 18442 18443 18444 - 18445 18446 18447 18448 18449 18450 18451 18452 - 18457 18458 18459 18460 18471 18472 18479 18480 - 18485 18486 18499 18500 18501 18502 18509 18510 - 18513 18514 18515 18516 18517 18518 18519 18520 - 18521 18523 18524 18525 18527 18528 18531 18537 - 18538 18539 18541 18543 18545 18547 18549 18550 - 18551 18553 18554 18555 18557 18558 18559 18560 - 18561 18562 18563 18564 18565 18566 18567 18569 - 18571 18573 18575 18577 18579 18581 18583 18585 - 18587 18589 18591 18593 18595 18596 18597 18599 - 18601 18602 18603 18605 18606 18607 18609 18611 - 18612 18613 18615 18617 18618 18619 18621 18622 - 18623 18624 18625 18626 18627 18628 18629 18631 - 18632 18633 18634 18635 18636 18637 18639 18641 - 18643 18645 18647 18649 18651 18653 18655 18657 - 18659 18661 18663 18664 18665 18667 18668 18669 - 18670 18671 18673 18674 18675 18676 18677 18679 - 18680 18681 18683 18685 18686 18687 18688 18689 - 18690 18691 18692 18693 18694 18695 18696 18697 - 18698 18699 18700 18701 18702 18703 18704 18705 - 18706 18707 18708 18709 18710 18711 18712 18713 - 18714 18715 18717 18719 18721 18722 18723 18724 - 18725 18727 18729 18731 18733 18735 18737 18739 - 18740 18741 18742 18743 18745 18747 18749 18751 - 18753 18755 18757 18759 18761 18763 18765 18767 - 18769 18771 18773 18775 18777 18779 18781 18783 - 18785 18787 18789 18791 18793 18795 18797 18799 - 18801 18803 18805 18807 18809 18811 18813 18815 - 18817 18819 18821 18823 18825 18827 18829 18831 - 18833 18835 18837 18839 18840 18841 18842 18843 - 18844 18845 18846 18847 18848 18849 18850 18851 - 18852 18853 18855 18857 18859 18861 18863 18865 - 18866 18867 18869 18871 18873 18875 18877 18879 - 18881 18883 18885 18887 18888 18889 18891 18893 - 18895 18897 18899 18901 18903 18905 18907 18909 - 18911 18913 18914 18915 18916 18917 18918 18919 - 18920 18921 18923 18925 18927 18929 18931 18933 - 18935 18937 18939 18941 18943 18945 18947 18948)) + (list 17789 17790 17801 17802 17807 17808 17811 17812 + 17815 17816 17821 17822 17829 17830 17907 17908 + 18023 18024 18049 18050 18055 18056 18459 18460 + 18605 18606 18617 18618 18621 18622 18625 18626 + 18627 18628 18631 18632 18633 18634 18663 18664 + 18669 18670 18673 18674 18679 18680 18685 18686 + 18691 18692 18695 18697 18699 18701 18703 18704 + 18705 18707 18709 18711 18713 18715 18717 18719 + 18721 18723 18725 18727 18729 18731 18733 18735 + 18737 18739 18740 18741 18742 18743 18889 18891 + 18893 18895 18897 18899 18901 18903 18905 18907 + 18909 18911 18913 18914 18915 18916 18917 18919 + 18921 18923 18925 18927 18929 18931 18933 18935 + 18937 18939 18941 18943 18945 18947 18948)) (ert-deftest ucs-normalize-part2 () :tags '(:expensive-test) From d9a1175a611876b5e1625e982720360b5c3a5b6f Mon Sep 17 00:00:00 2001 From: Thomas Hilke Date: Fri, 15 Sep 2023 10:30:25 +0200 Subject: [PATCH 34/36] Close SQL database when corresponding 'sqlite-mode' buffer is killed * lisp/sqlite-mode.el (sqlite-mode-open-file): Close DB when the buffer is killed. (Bug#65998) Copyright-paperwork-exempt: yes --- lisp/sqlite-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 8cb94485369..71c9e57fc12 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -63,6 +63,7 @@ (setq-local sqlite--db (sqlite-open file)) (unless (sqlitep sqlite--db) (error "`sqlite-open' failed to open SQLite file")) + (add-hook 'kill-buffer-hook (lambda () (sqlite-close sqlite--db)) nil t) (sqlite-mode-list-tables)) (defun sqlite-mode-list-tables () From 89fa204b706ada02884a5d35c30efd03275bd747 Mon Sep 17 00:00:00 2001 From: Jens Schmidt Date: Tue, 30 May 2023 23:00:56 +0200 Subject: [PATCH 35/36] Fix loss of encrypted data in plstore.el * lisp/plstore.el (plstore--insert-buffer): Fix loss of encrypted data when a plstore gets opened and saved without being decrypted between these steps. (Bug#63627) --- lisp/plstore.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lisp/plstore.el b/lisp/plstore.el index 7dc991aeec7..758f9fc7292 100644 --- a/lisp/plstore.el +++ b/lisp/plstore.el @@ -570,18 +570,23 @@ SECRET-KEYS is a plist containing secret data." (defvar pp-escape-newlines) (defun plstore--insert-buffer (plstore) - "Insert the file representation of PLSTORE at point. -Assumes that PLSTORE has been decrypted." + "Insert the file representation of PLSTORE at point." (insert ";;; public entries -*- mode: plstore -*- \n" (pp-to-string (plstore--get-alist plstore))) - (if (plstore--get-secret-alist plstore) + (let ((pp-escape-newlines nil) + (cipher nil)) + (cond + ;; Reuse the encrypted data as cipher text if this store has not + ;; been decrypted yet. + ((plstore--get-encrypted-data plstore) + (setq cipher (plstore--get-encrypted-data plstore))) + ;; Encrypt the secret alist to generate the cipher text. + ((plstore--get-secret-alist plstore) (let ((context (epg-make-context 'OpenPGP)) - (pp-escape-newlines nil) (recipients (cond ((listp plstore-encrypt-to) plstore-encrypt-to) - ((stringp plstore-encrypt-to) (list plstore-encrypt-to)))) - cipher) + ((stringp plstore-encrypt-to) (list plstore-encrypt-to))))) (setf (epg-context-armor context) t) (epg-context-set-passphrase-callback context @@ -601,9 +606,10 @@ Assumes that PLSTORE has been decrypted." If no one is selected, symmetric encryption will be performed. " recipients) (if plstore-encrypt-to - (epg-list-keys context recipients))))) - (goto-char (point-max)) - (insert ";;; secret entries\n" (pp-to-string cipher))))) + (epg-list-keys context recipients)))))))) + (when cipher + (goto-char (point-max)) + (insert ";;; secret entries\n" (pp-to-string cipher))))) (defun plstore-save (plstore) "Save PLSTORE to its associated file. From 755ae813a6adf203d4a602a3e7fc0b9ed547be8c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Sep 2023 14:26:46 +0300 Subject: [PATCH 36/36] ; Declare some treesit.c functions in typescript-ts-mode.el. --- lisp/progmodes/typescript-ts-mode.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 7108ff49b28..e708e38195d 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -32,8 +32,11 @@ (eval-when-compile (require 'rx)) (require 'c-ts-common) ; For comment indent and filling. +(declare-function treesit-node-start "treesit.c") +(declare-function treesit-node-end "treesit.c") (declare-function treesit-parser-create "treesit.c") (declare-function treesit-query-capture "treesit.c") +(declare-function treesit-query-compile "treesit.c") (defcustom typescript-ts-mode-indent-offset 2 "Number of spaces for each indentation step in `typescript-ts-mode'."