commit 3dbe0cde0e1befb9c7065bdc43f64fdd0aba37b4 (HEAD, refs/remotes/origin/master) Author: Stefan Kangas Date: Sat Nov 26 09:04:39 2022 +0100 ; * lisp/progmodes/csharp-mode.el: Add Commentary. diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index f76289ac2b..e82e72e8a3 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -24,6 +24,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . +;;; Commentary: + +;; Support for editing C#. + ;;; Code: (require 'compile) commit 0369dcacf30aff6d4f733872058fa2446330fd02 Author: Yuan Fu Date: Fri Nov 25 18:50:26 2022 -0800 Fix tree-sitter assertion error (bug#59574) * src/treesit.c (treesit_sync_visible_region): Initialize visible_beg/end when tree is NULL. diff --git a/src/treesit.c b/src/treesit.c index d18e77a353..c910aea1da 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -782,13 +782,13 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, matches that of the buffer, and update visible_beg/end. That is, the whole purpose of visible_beg/end (and - treesit_record_change and treesit_sync_visible_region) is to - update the tree (by ts_tree_edit). So if the tree is NULL, we - don't update the tree and there is no need to keep tracking of - them. Only when we already have a tree, do we need to keep track - of position changes and update it correctly, so it can be feed into - ts_parser_parse as the old tree, so that tree-sitter only parses - the changed part (aka incremental). + treesit_record_change and treesit_sync_visible_region) is to update + the tree (by ts_tree_edit). So if the tree is NULL, + visible_beg/end are considered uninitialized. Only when we already + have a tree, do we need to keep track of position changes and + update it correctly, so it can be feed into ts_parser_parse as the + old tree, so that tree-sitter only parses the changed part (aka + incremental). In a nutshell, tree-sitter incremental parsing in Emacs looks like: @@ -815,11 +815,17 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, treesit_sync_visible_region (Lisp_Object parser) { TSTree *tree = XTS_PARSER (parser)->tree; + struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer); + /* If we are setting visible_beg/end for the first time, we can skip + the offset acrobatics and updating the tree below. */ if (tree == NULL) - return; + { + XTS_PARSER (parser)->visible_beg = BUF_BEGV_BYTE (buffer); + XTS_PARSER (parser)->visible_end = BUF_ZV_BYTE (buffer); + return; + } - struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer); ptrdiff_t visible_beg = XTS_PARSER (parser)->visible_beg; ptrdiff_t visible_end = XTS_PARSER (parser)->visible_end; eassert (0 <= visible_beg); commit 4ffca85f1eefea5adc96efc276acfae4d737aa17 Author: Yuan Fu Date: Fri Nov 25 15:10:20 2022 -0800 Rename treesit_ensure_position_synced to treesit_sync_visible_region * src/treesit.c: Rename to better convey the purpose of the function. diff --git a/src/treesit.c b/src/treesit.c index 66fd884efc..d18e77a353 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -314,7 +314,7 @@ #define ts_tree_root_node fn_ts_tree_root_node See: https://github.com/tree-sitter/tree-sitter/issues/445 treesit.h has some commentary on the two main data structure for - the parser and node. treesit_ensure_position_synced has some + the parser and node. treesit_sync_visible_region has some commentary on how we make tree-sitter play well with narrowing (the tree-sitter parser only sees the visible region, so we need to translate positions back and forth). Most action happens in @@ -782,7 +782,7 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, matches that of the buffer, and update visible_beg/end. That is, the whole purpose of visible_beg/end (and - treesit_record_change and treesit_ensure_position_synced) is to + treesit_record_change and treesit_sync_visible_region) is to update the tree (by ts_tree_edit). So if the tree is NULL, we don't update the tree and there is no need to keep tracking of them. Only when we already have a tree, do we need to keep track @@ -796,8 +796,8 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, treesit_record_change(tree) | user edits buffer ... / - treesit_ensure_position_synced(tree) \ treesit_ensure_parsed - ts_parser_parse(tree) -> tree / + treesit_sync_visible_region(tree) \ treesit_ensure_parsed + ts_parser_parse(tree) -> tree / treesit_record_change(tree) \ treesit_record_change(tree) | user edits buffer @@ -805,13 +805,14 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, and so on. */ -/* Make sure PARSER's visible_beg and visible_end are in sync with - BUF_BEGV_BYTE and BUG_ZV_BYTE. When calling this function you must - make sure the current buffer's size is not larger than UINT32_MAX. - Basically always call treesit_check_buffer_size before this - function. */ +/* Make sure the tree's visible range is in sync with the buffer's + visible range, and PARSER's visible_beg and visible_end are in sync + with BUF_BEGV_BYTE and BUG_ZV_BYTE. When calling this function you + must make sure the current buffer's size is not larger than + UINT32_MAX. Basically always call treesit_check_buffer_size before + this function. */ static void -treesit_ensure_position_synced (Lisp_Object parser) +treesit_sync_visible_region (Lisp_Object parser) { TSTree *tree = XTS_PARSER (parser)->tree; @@ -924,7 +925,7 @@ treesit_ensure_parsed (Lisp_Object parser) /* Before we parse, catch up with the narrowing situation. */ treesit_check_buffer_size (buffer); - treesit_ensure_position_synced (parser); + treesit_sync_visible_region (parser); TSTree *new_tree = ts_parser_parse (treesit_parser, tree, input); /* This should be very rare (impossible, really): it only happens @@ -1453,7 +1454,7 @@ DEFUN ("treesit-parser-set-included-ranges", treesit_initialize (); /* Before we parse, catch up with narrowing/widening. */ treesit_check_buffer_size (XBUFFER (XTS_PARSER (parser)->buffer)); - treesit_ensure_position_synced (parser); + treesit_sync_visible_region (parser); bool success; if (NILP (ranges)) @@ -1539,7 +1540,7 @@ DEFUN ("treesit-parser-included-ranges", /* Our return value depends on the buffer state (BUF_BEGV_BYTE, etc), so we need to sync up. */ treesit_check_buffer_size (XBUFFER (XTS_PARSER (parser)->buffer)); - treesit_ensure_position_synced (parser); + treesit_sync_visible_region (parser); struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer); return treesit_make_ranges (ranges, len, buffer); commit 245366b18a0675dc56d3236895cf0e099385d720 Author: Yuan Fu Date: Fri Nov 25 15:06:55 2022 -0800 ; Add comments in treesit.c and treesit.h * src/treesit.c * src/treesit.h: Add (and fix) comments. diff --git a/src/treesit.c b/src/treesit.c index 3df53f2179..66fd884efc 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -707,6 +707,8 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, Lisp_Object lisp_parser = XCAR (parser_list); treesit_check_parser (lisp_parser); TSTree *tree = XTS_PARSER (lisp_parser)->tree; + /* See comment (ref:visible-beg-null) if you wonder why we don't + update visible_beg/end when tree is NULL. */ if (tree != NULL) { eassert (start_byte <= old_end_byte); @@ -742,7 +744,7 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, XTS_PARSER (lisp_parser)->timestamp++; /* VISIBLE_BEG/END records tree-sitter's range of view in - the buffer. Ee need to adjust them when tree-sitter's + the buffer. We need to adjust them when tree-sitter's view changes. */ ptrdiff_t visi_beg_delta; if (old_end_byte > new_end_byte) @@ -765,6 +767,44 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, } } +/* Comment (ref:visible-beg-null) So the purpose of visible_beg/end + are to keep track of "which part of the buffer does the tree-sitter + tree sees", in order to update the tree correctly. Visible_beg/end + has two purposes: "clips" buffer changes within them, and translate + position in buffer to position in the tree (buf position - visi_beg + = tree position). + + Conceptually, visible_beg/end marks the visible region of the + buffer when we last reparsed. In between two reparse, we don't + really care if the visible region of the buffer changes. + + Right before we reparse, we make tree-sitter's visible region + matches that of the buffer, and update visible_beg/end. + + That is, the whole purpose of visible_beg/end (and + treesit_record_change and treesit_ensure_position_synced) is to + update the tree (by ts_tree_edit). So if the tree is NULL, we + don't update the tree and there is no need to keep tracking of + them. Only when we already have a tree, do we need to keep track + of position changes and update it correctly, so it can be feed into + ts_parser_parse as the old tree, so that tree-sitter only parses + the changed part (aka incremental). + + In a nutshell, tree-sitter incremental parsing in Emacs looks like: + + treesit_record_change(tree) \ + treesit_record_change(tree) | user edits buffer + ... / + + treesit_ensure_position_synced(tree) \ treesit_ensure_parsed + ts_parser_parse(tree) -> tree / + + treesit_record_change(tree) \ + treesit_record_change(tree) | user edits buffer + ... / + + and so on. */ + /* Make sure PARSER's visible_beg and visible_end are in sync with BUF_BEGV_BYTE and BUG_ZV_BYTE. When calling this function you must make sure the current buffer's size is not larger than UINT32_MAX. @@ -1365,9 +1405,10 @@ treesit_check_range_argument (Lisp_Object ranges) CHECK_LIST_END (tail, ranges); } -/* Generate a list of ranges in Lisp from RANGES. This function - doesn't take ownership of RANGES. BUFFER is used to convert - between tree-sitter buffer offset and buffer position. */ +/* Generate a list of ranges in Lisp from RANGES. Assumes tree-sitter + tree and the buffer has the same visible region (w.r.t narrowing). + This function doesn't take ownership of RANGES. BUFFER is used to + convert between tree-sitter buffer offset and buffer position. */ static Lisp_Object treesit_make_ranges (const TSRange *ranges, uint32_t len, struct buffer *buffer) diff --git a/src/treesit.h b/src/treesit.h index 1473126c5b..6f6423ff47 100644 --- a/src/treesit.h +++ b/src/treesit.h @@ -56,13 +56,12 @@ #define EMACS_TREESIT_H this field to true to force tree-sitter to re-parse. */ bool need_reparse; /* These two positions record the buffer byte position (1-based) of - the "visible region" that tree-sitter sees. Unlike markers, - These two positions do not change as the user inserts and deletes - text around them. Before re-parse, we move these positions to - match BUF_BEGV_BYTE and BUF_ZV_BYTE. Note that we don't need to - synchronize these positions when retrieving them in a function - that involves a node: if the node is not outdated, these - positions are synchronized. */ + the "visible region" that tree-sitter sees. Before re-parse, we + move these positions to match BUF_BEGV_BYTE and BUF_ZV_BYTE. + Note that we don't need to synchronize these positions when + retrieving them in a function that involves a node: if the node + is not outdated, these positions are synchronized. See comment + (ref:visible-beg-null) in treesit.c for more explanation. */ ptrdiff_t visible_beg; ptrdiff_t visible_end; /* This counter is incremented every time a change is made to the commit 73c94d5a9f00a98944516d86e4efcf50e20b2d48 Author: Yuan Fu Date: Fri Nov 25 14:24:27 2022 -0800 ; Fix comment-end in treesit-simple-indent-presets * lisp/treesit.el (treesit-simple-indent-presets): Fix comment-end. diff --git a/lisp/treesit.el b/lisp/treesit.el index 8a8f6f02c7..b7da38becc 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1053,8 +1053,10 @@ treesit-simple-indent-presets (lambda (node &rest _) (string-match-p name (or (treesit-node-field-name node) ""))))) - (cons 'comment-end (lambda (&rest _) - (looking-at-p treesit-comment-end))) + (cons 'comment-end (lambda (_node _parent bol &rest _) + (save-excursion + (goto-char bol) + (looking-at-p treesit-comment-end)))) ;; TODO: Document. (cons 'catch-all (lambda (&rest _) t)) commit e9f86182cebc6ae156289829594de1454eb9122a Author: Yuan Fu Date: Fri Nov 25 14:23:44 2022 -0800 ; * lisp/progmodes/csharp-mode.el: Add author and maintainer. diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index af3a4d86da..f76289ac2b 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -3,7 +3,9 @@ ;; Copyright (C) 2022 Free Software Foundation, Inc. ;; Author : Theodor Thornhill +;; Jostein Kjønigsen ;; Maintainer : Theodor Thornhill +;; Jostein Kjønigsen ;; Created : September 2022 ;; Keywords : c# languages oop commit 154daf8367b56d8c602e6f9a09c43ce0039db4d9 Author: Jim Porter Date: Fri Nov 25 17:42:57 2022 -0800 ; * test/lisp/eshell/esh-var-tests.el: Fix incorrect paren placement. diff --git a/test/lisp/eshell/esh-var-tests.el b/test/lisp/eshell/esh-var-tests.el index 245a8e6a26..96fde026a5 100644 --- a/test/lisp/eshell/esh-var-tests.el +++ b/test/lisp/eshell/esh-var-tests.el @@ -289,7 +289,7 @@ esh-var-test/quoted-interp-var-length-alist (eshell-command-result-equal "echo \"$#eshell-test-value\"" "1") (eshell-command-result-equal "echo \"$#eshell-test-value[foo]\"" - "3")) + "3"))) (ert-deftest esh-var-test/quoted-interp-lisp () "Interpolate Lisp form evaluation inside double-quotes" @@ -316,7 +316,7 @@ esh-var-test/quoted-interp-temp-cmd (let ((temporary-file-directory (file-name-as-directory (make-temp-file "esh-vars-tests" t)))) (unwind-protect - (eshell-command-result-equal "cat \"$\"" "hi")) + (eshell-command-result-equal "cat \"$\"" "hi") (delete-directory temporary-file-directory t)))) (ert-deftest esh-var-test/quoted-interp-concat-cmd () commit 7fc0eae28f03601e25e2a60030ae2dc59085c6d2 Author: Theodor Thornhill Date: Fri Nov 25 21:04:18 2022 +0100 Rename ts-mode to typescript-ts-mode * lisp/progmodes/typescript-ts-mode.el: Rename from 'ts-mode' to 'typescript-ts-mode'. Rename all symbols to match new prefix. * etc/NEWS: Mention the new mode name. Ref: https://lists.gnu.org/r/emacs-devel/2022-11/msg01587.html diff --git a/etc/NEWS b/etc/NEWS index 0ffc849fec..3c9243784d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2969,7 +2969,7 @@ This is a lightweight variant of 'js-mode' that is used by default when visiting JSON files. -** New mode 'ts-mode'. +** New mode 'typescript-ts-mode'. A major mode based on the tree-sitter library for editing programs in the TypeScript language. It includes support for font-locking, indentation, and navigation. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index bdef1c4576..763686bf66 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -1,4 +1,4 @@ -;;; ts-mode.el --- tree sitter support for TypeScript -*- lexical-binding: t; -*- +;;; typescript-ts-mode.el --- tree sitter support for TypeScript -*- lexical-binding: t; -*- ;; Copyright (C) 2022 Free Software Foundation, Inc. @@ -30,14 +30,14 @@ (declare-function treesit-parser-create "treesit.c") -(defcustom ts-mode-indent-offset 2 - "Number of spaces for each indentation step in `ts-mode'." +(defcustom typescript-ts-mode-indent-offset 2 + "Number of spaces for each indentation step in `typescript-ts-mode'." :version "29.1" :type 'integer :safe 'integerp :group 'typescript) -(defvar ts-mode--syntax-table +(defvar typescript-ts-mode--syntax-table (let ((table (make-syntax-table))) ;; Taken from the cc-langs version (modify-syntax-entry ?_ "_" table) @@ -54,9 +54,9 @@ ts-mode--syntax-table (modify-syntax-entry ?` "\"" table) (modify-syntax-entry ?\240 "." table) table) - "Syntax table for `ts-mode'.") + "Syntax table for `typescript-ts-mode'.") -(defvar ts-mode--indent-rules +(defvar typescript-ts-mode--indent-rules `((tsx ((parent-is "program") parent-bol 0) ((node-is "}") parent-bol 0) @@ -65,33 +65,33 @@ ts-mode--indent-rules ((node-is ">") parent-bol 0) ((and (parent-is "comment") comment-end) comment-start -1) ((parent-is "comment") comment-start-skip 0) - ((parent-is "ternary_expression") parent-bol ts-mode-indent-offset) - ((parent-is "member_expression") parent-bol ts-mode-indent-offset) - ((parent-is "named_imports") parent-bol ts-mode-indent-offset) - ((parent-is "statement_block") parent-bol ts-mode-indent-offset) - ((parent-is "type_arguments") parent-bol ts-mode-indent-offset) - ((parent-is "variable_declarator") parent-bol ts-mode-indent-offset) - ((parent-is "arguments") parent-bol ts-mode-indent-offset) - ((parent-is "array") parent-bol ts-mode-indent-offset) - ((parent-is "formal_parameters") parent-bol ts-mode-indent-offset) - ((parent-is "template_substitution") parent-bol ts-mode-indent-offset) - ((parent-is "object_pattern") parent-bol ts-mode-indent-offset) - ((parent-is "object") parent-bol ts-mode-indent-offset) - ((parent-is "object_type") parent-bol ts-mode-indent-offset) - ((parent-is "enum_body") parent-bol ts-mode-indent-offset) - ((parent-is "arrow_function") parent-bol ts-mode-indent-offset) - ((parent-is "parenthesized_expression") parent-bol ts-mode-indent-offset) + ((parent-is "ternary_expression") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "statement_block") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "variable_declarator") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "arguments") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "array") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "formal_parameters") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "template_substitution") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "object_pattern") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "object") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "object_type") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "enum_body") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "parenthesized_expression") parent-bol typescript-ts-mode-indent-offset) ;; TSX - ((parent-is "jsx_opening_element") parent ts-mode-indent-offset) + ((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) ((node-is "jsx_closing_element") parent 0) - ((parent-is "jsx_element") parent ts-mode-indent-offset) + ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) ((node-is "/") parent 0) - ((parent-is "jsx_self_closing_element") parent ts-mode-indent-offset) + ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) (no-node parent-bol 0))) "Tree-sitter indent rules.") -(defvar ts-mode--keywords +(defvar typescript-ts-mode--keywords '("!" "abstract" "as" "async" "await" "break" "case" "catch" "class" "const" "continue" "debugger" "declare" "default" "delete" "do" "else" "enum" @@ -103,14 +103,14 @@ ts-mode--keywords "while" "with" "yield") "TypeScript keywords for tree-sitter font-locking.") -(defvar ts-mode--operators +(defvar typescript-ts-mode--operators '("=" "+=" "-=" "*=" "/=" "%=" "**=" "<<=" ">>=" ">>>=" "&=" "^=" "|=" "&&=" "||=" "??=" "==" "!=" "===" "!==" ">" ">=" "<" "<=" "+" "-" "*" "/" "%" "++" "--" "**" "&" "|" "^" "~" "<<" ">>" ">>>" "&&" "||" "!" "?.") "TypeScript operators for tree-sitter font-locking.") -(defvar ts-mode--font-lock-settings +(defvar typescript-ts-mode--font-lock-settings (treesit-font-lock-rules :language 'tsx :override t @@ -128,7 +128,7 @@ ts-mode--font-lock-settings :language 'tsx :override t :feature 'keyword - `([,@ts-mode--keywords] @font-lock-keyword-face + `([,@typescript-ts-mode--keywords] @font-lock-keyword-face [(this) (super)] @font-lock-keyword-face) :language 'tsx @@ -248,7 +248,7 @@ ts-mode--font-lock-settings :language 'tsx :feature 'operator - `([,@ts-mode--operators] @font-lock-operator-face + `([,@typescript-ts-mode--operators] @font-lock-operator-face (ternary_expression ["?" ":"] @font-lock-operator-face)) :language 'tsx @@ -278,19 +278,19 @@ ts-mode--font-lock-settings "Tree-sitter font-lock settings.") ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.ts\\'" . ts-mode)) +(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.tsx\\'" . ts-mode)) +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode)) ;;;###autoload -(define-derived-mode ts-mode prog-mode "TypeScript" +(define-derived-mode typescript-ts-mode prog-mode "TypeScript" "Major mode for editing TypeScript." :group 'typescript - :syntax-table ts-mode--syntax-table + :syntax-table typescript-ts-mode--syntax-table (cond - ;; `ts-mode' requires tree-sitter to work, so we don't check if + ;; `typescript-ts-mode' requires tree-sitter to work, so we don't check if ;; user enables tree-sitter for it. ((treesit-ready-p 'tsx) ;; Tree-sitter. @@ -308,7 +308,7 @@ ts-mode (append "{}():;," electric-indent-chars)) ;; Indent. - (setq-local treesit-simple-indent-rules ts-mode--indent-rules) + (setq-local treesit-simple-indent-rules typescript-ts-mode--indent-rules) ;; Navigation. (setq-local treesit-defun-type-regexp @@ -318,7 +318,7 @@ ts-mode "lexical_declaration"))) ;; Font-lock. - (setq-local treesit-font-lock-settings ts-mode--font-lock-settings) + (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list '((comment declaration) (constant expression identifier keyword number string) @@ -336,6 +336,6 @@ ts-mode (js-mode) (message "Tree-sitter for TypeScript isn't available, falling back to `js-mode'")))) -(provide 'ts-mode) +(provide 'typescript-ts-mode) -;;; ts-mode.el ends here +;;; typescript-ts-mode.el ends here commit 0a8e724e37c96f7082fe17d7ab50cd86a073ccd8 Author: Theodor Thornhill Date: Sat Nov 26 01:45:56 2022 +0100 Rename ts-mode.el to typescript-ts-mode.el * lisp/progmodes/ts-mode.el: Move from here... * lisp/progmodes/typescript-ts-mode.el: ...to here. diff --git a/lisp/progmodes/ts-mode.el b/lisp/progmodes/typescript-ts-mode.el similarity index 100% rename from lisp/progmodes/ts-mode.el rename to lisp/progmodes/typescript-ts-mode.el commit 123e90f6d349ca8882973db74007cb5d9067305c Author: Po Lu Date: Fri Nov 25 19:35:14 2022 +0800 Fix no-accept-focus handling for embedded frames * src/xterm.c (handle_one_xevent): Don't focus embedded frames on click if they have `no-accept-focus' set. diff --git a/src/xterm.c b/src/xterm.c index 7d855c92cc..ec605f5e91 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -21430,7 +21430,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (!NILP (tab_bar_arg)) inev.ie.arg = tab_bar_arg; } - if (FRAME_X_EMBEDDED_P (f)) + + if (FRAME_X_EMBEDDED_P (f) + && !FRAME_NO_ACCEPT_FOCUS (f)) xembed_send_message (f, event->xbutton.time, XEMBED_REQUEST_FOCUS, 0, 0, 0); } @@ -23198,7 +23200,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (!NILP (tab_bar_arg)) inev.ie.arg = tab_bar_arg; } - if (FRAME_X_EMBEDDED_P (f)) + + if (FRAME_X_EMBEDDED_P (f) + && !FRAME_NO_ACCEPT_FOCUS (f)) xembed_send_message (f, xev->time, XEMBED_REQUEST_FOCUS, 0, 0, 0); } commit 2389158a31b4a126a328146399fe7ef304c97fef Author: Dmitry Gutov Date: Sat Mar 5 04:28:31 2022 +0200 Drop project--value-in-dir Drop the project--value-in-dir mechanics, where the user could edit the value in .dir-locals.el and have it applied instantly without reverting the current buffer. It made working in remote buffers with enable-remote-dir-locals non-nil slower, which doesn't seem worth it for a minor improvement of an infrequent operation. Also less compexity overall. * lisp/progmodes/project.el (project-try-vc, project-files) (project--vc-list-files, project-ignores, project-buffers): Use the user options directly. (project--vc-merge-submodules-p, project--value-in-dir): Delete functions. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 0e08dae154..71061e6139 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -460,7 +460,7 @@ project-try-vc (if (and ;; FIXME: Invalidate the cache when the value ;; of this variable changes. - (project--vc-merge-submodules-p root) + project-vc-merge-submodules (project--submodule-p root)) (let* ((parent (file-name-directory (directory-file-name root)))) @@ -512,7 +512,7 @@ project-external-roots (cl-defmethod project-files ((project (head vc)) &optional dirs) (mapcan (lambda (dir) - (let ((ignores (project--value-in-dir 'project-vc-ignores dir)) + (let ((ignores project-vc-ignores) backend) (if (and (file-equal-p dir (nth 2 project)) (setq backend (cadr project)) @@ -576,7 +576,7 @@ project--vc-list-files (split-string (apply #'vc-git--run-command-string nil "ls-files" args) "\0" t))) - (when (project--vc-merge-submodules-p default-directory) + (when project-vc-merge-submodules ;; Unfortunately, 'ls-files --recurse-submodules' conflicts with '-o'. (let* ((submodules (project--git-submodules)) (sub-files @@ -610,11 +610,6 @@ project--vc-list-files (lambda (s) (concat default-directory s)) (split-string (buffer-string) "\0" t))))))) -(defun project--vc-merge-submodules-p (dir) - (project--value-in-dir - 'project-vc-merge-submodules - dir)) - (defun project--git-submodules () ;; 'git submodule foreach' is much slower. (condition-case nil @@ -655,7 +650,7 @@ project-ignores (condition-case nil (vc-call-backend backend 'ignore-completion-table root) (vc-not-supported () nil))))) - (project--value-in-dir 'project-vc-ignores root) + project-vc-ignores (mapcar (lambda (dir) (concat dir "/")) @@ -686,16 +681,9 @@ project-subtract-directories ;; Sidestep the issue of expanded/abbreviated file names here. (cl-set-difference files dirs :test #'file-in-directory-p)) -(defun project--value-in-dir (var dir) - (with-temp-buffer - (setq default-directory dir) - (let ((enable-local-variables :all)) - (hack-dir-local-variables-non-file-buffer)) - (symbol-value var))) - (cl-defmethod project-buffers ((project (head vc))) (let* ((root (expand-file-name (file-name-as-directory (project-root project)))) - (modules (unless (or (project--vc-merge-submodules-p root) + (modules (unless (or project-vc-merge-submodules (project--submodule-p root)) (mapcar (lambda (m) (format "%s%s/" root m)) commit 698b202ddca835c518c916ffd1f482e2b256edde Author: Jim Porter Date: Fri Nov 25 10:36:20 2022 -0800 ; * lisp/server.el (server-start): Fix a typo in a warning message. diff --git a/lisp/server.el b/lisp/server.el index f7aaf6a6c6..beb46853b7 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -709,7 +709,7 @@ server-start (concat "Unable to start the Emacs server.\n" (cadr err) (substitute-command-keys - "\nTo start the server in this Emacs process, stop the existingserver or call `\\[server-force-delete]' to forcibly disconnect it.")) + "\nTo start the server in this Emacs process, stop the existing server or call `\\[server-force-delete]' to forcibly disconnect it.")) :warning) (setq leave-dead t))) ;; Now any previous server is properly stopped. commit 2557145f10550aa22fc0e5370fc60960c744e0af Author: Stefan Kangas Date: Fri Nov 25 15:01:03 2022 +0100 ; lisp/progmodes/which-func.el: Mark emacs-devel as maintainer. diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index d98ba8da27..14b749296c 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -2,8 +2,8 @@ ;; Copyright (C) 1994-2022 Free Software Foundation, Inc. -;; Author: Alex Rezinsky -;; (doesn't seem to be responsive any more) +;; Author: Alex Rezinsky +;; Maintainer: emacs-devel@gnu.org ;; Keywords: mode-line, imenu, tools ;; This file is part of GNU Emacs. @@ -40,8 +40,8 @@ ;; THANKS TO ;; --------- ;; Per Abrahamsen -;; Some ideas (inserting in mode-line, using of post-command hook -;; and toggling this mode) have been borrowed from his package +;; Some ideas (inserting in mode-line, using of post-command hook +;; and toggling this mode) have been borrowed from his package ;; column.el ;; Peter Eisenhauer ;; Bug fixing in case nested indexes. commit ba6ead4854e9d7f3a8803b27554f01723d704946 Author: Juanma Barranquero Date: Fri Nov 25 14:46:14 2022 +0100 ; * lisp/progmodes/which-func.el: Remove obsolete comment diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 4fe4edc164..d98ba8da27 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -27,16 +27,6 @@ ;; located in mode line. It assumes that you work with the imenu ;; package and `imenu--index-alist' is up to date. -;; KNOWN BUGS -;; ---------- -;; Really this package shows not "function where the current point is -;; located now", but "nearest function which defined above the current -;; point". So if your current point is located after the end of -;; function FOO but before the beginning of function BAR, FOO will be -;; displayed in the mode line. -;; - If two windows display the same buffer, both windows -;; show the same `which-func' information. - ;; TODO LIST ;; --------- ;; 1. Dependence on imenu package should be removed. Separate commit 3d02c8aabfde88219dd8b6053a59de261308bc2f Author: F. Jason Park Date: Thu Nov 24 21:03:03 2022 -0800 Disable auth-source-pass-extra-query-keywords by default * doc/misc/auth.texi: Mention subdomain matching in `auth-source-pass-extra-query-keywords' section. * etc/NEWS: Mention the loss of traditional auth-source-pass features when `auth-source-pass-extra-query-keywords' is enabled. * lisp/auth-source-pass (auth-source-pass-extra-query-keywords): Set default to nil. Mention domain matching in doc string. (auth-source-pass--match-regexp): Allow username to contain "@". * lisp/erc/erc-compat.el: (erc-compat--29-auth-source-pass--retrieve-parsed): Adjust regexp. * test/lisp/auth-source-pass-tests.el (auth-source-pass-extra-query-keywords--suffixed-user): make plain username more email-like. (Bug#58985.) diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi index 872e5f88f5..83728be0a5 100644 --- a/doc/misc/auth.texi +++ b/doc/misc/auth.texi @@ -560,11 +560,12 @@ The Unix password store param was provided. In general, if you prefer idiosyncrasies traditionally exhibited by -this backend, such as prioritizing field count in a filename, try -setting this option to @code{nil}. But, if you experience problems -predicting the outcome of searches relative to other auth-source -backends or encounter code expecting to query multiple backends -uniformly, try flipping it back to @code{t} (the default). +this backend, such as prioritizing field count in a filename or +matching against subdomain labels, keep this option set to @code{nil} +(the default). But, if you experience problems predicting the outcome +of searches relative to other auth-source backends or encounter code +expecting to query multiple backends uniformly, try flipping it to +@code{t}. @end defvar @node Help for developers diff --git a/etc/NEWS b/etc/NEWS index 7b64752f46..0ffc849fec 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1410,7 +1410,8 @@ database stored on disk. *** New user option 'auth-source-pass-extra-query-keywords'. Whether to recognize additional keyword params, like ':max' and ':require', as well as accept lists of query terms paired with -applicable keywords. +applicable keywords. This disables most known behavioral quirks +unique to auth-source-pass, such as wildcard subdomain matching. ** Dired diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el index dc274843e1..74d3808448 100644 --- a/lisp/auth-source-pass.el +++ b/lisp/auth-source-pass.el @@ -55,12 +55,13 @@ auth-source-pass-port-separator :type 'string :version "27.1") -(defcustom auth-source-pass-extra-query-keywords t +(defcustom auth-source-pass-extra-query-keywords nil "Whether to consider additional keywords when performing a query. Specifically, when the value is t, recognize the `:max' and `:require' keywords and accept lists of query parameters for -certain keywords, such as `:host' and `:user'. Also, wrap all -returned secrets in a function and forgo any further results +certain keywords, such as `:host' and `:user'. Beyond that, wrap +all returned secrets in a function and don't bother considering +subdomains when matching hosts. Also, forgo any further results filtering unless given an applicable `:require' argument. When this option is nil, do none of that, and enact the narrowing behavior described toward the bottom of the Info node `(auth) The @@ -110,7 +111,7 @@ auth-source-pass--match-regexp (defun auth-source-pass--match-regexp (s) (rx-to-string ; autoloaded `(: (or bot "/") - (or (: (? (group-n 20 (+ (not (in ?\ ?/ ?@ ,s)))) "@") + (or (: (? (group-n 20 (+ (not (in ?\ ?/ ,s)))) "@") (group-n 10 (+ (not (in ?\ ?/ ?@ ,s)))) (? ,s (group-n 30 (+ (not (in ?\ ?/ ,s)))))) (: (group-n 11 (+ (not (in ?\ ?/ ?@ ,s)))) diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index 66a9a615e3..abbaafcd93 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el @@ -176,7 +176,7 @@ auth-source-backend-parser-functions ;; This hard codes `auth-source-pass-port-separator' to ":" (defun erc-compat--29-auth-source-pass--retrieve-parsed (seen e port-number-p) (when (string-match (rx (or bot "/") - (or (: (? (group-n 20 (+ (not (in " /@")))) "@") + (or (: (? (group-n 20 (+ (not (in " /:")))) "@") (group-n 10 (+ (not (in " /:@")))) (? ":" (group-n 30 (+ (not (in " /:")))))) (: (group-n 11 (+ (not (in " /:@")))) diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el index 6e6671efca..1107e09b51 100644 --- a/test/lisp/auth-source-pass-tests.el +++ b/test/lisp/auth-source-pass-tests.el @@ -697,29 +697,29 @@ auth-source-pass-extra-query-keywords--ambiguous-user-host ;; with slightly more realistic and less legible values. (ert-deftest auth-source-pass-extra-query-keywords--suffixed-user () - (let ((store (sort (copy-sequence '(("x.com:42/bar" (secret . "a")) - ("bar@x.com" (secret . "b")) + (let ((store (sort (copy-sequence '(("x.com:42/b@r" (secret . "a")) + ("b@r@x.com" (secret . "b")) ("x.com" (secret . "?")) - ("bar@y.org" (secret . "c")) + ("b@r@y.org" (secret . "c")) ("fake.com" (secret . "?")) - ("fake.com/bar" (secret . "d")) - ("y.org/bar" (secret . "?")) - ("bar@fake.com" (secret . "e")))) + ("fake.com/b@r" (secret . "d")) + ("y.org/b@r" (secret . "?")) + ("b@r@fake.com" (secret . "e")))) (lambda (&rest _) (zerop (random 2)))))) (auth-source-pass--with-store store (auth-source-pass-enable) (let* ((auth-source-pass-extra-query-keywords t) (results (auth-source-search :host '("x.com" "fake.com" "y.org") - :user "bar" + :user "b@r" :require '(:user) :max 5))) (dolist (result results) (setf (plist-get result :secret) (auth-info-password result))) (should (equal results - '((:host "x.com" :user "bar" :secret "b") - (:host "x.com" :user "bar" :port "42" :secret "a") - (:host "fake.com" :user "bar" :secret "e") - (:host "fake.com" :user "bar" :secret "d") - (:host "y.org" :user "bar" :secret "c")))))))) + '((:host "x.com" :user "b@r" :secret "b") + (:host "x.com" :user "b@r" :port "42" :secret "a") + (:host "fake.com" :user "b@r" :secret "e") + (:host "fake.com" :user "b@r" :secret "d") + (:host "y.org" :user "b@r" :secret "c")))))))) ;; This is a more distilled version of `suffixed-user', above. It ;; better illustrates that search order takes precedence over "/user" commit 94a8a8c4fef074f445d316000070c95f0452586e Author: Eli Zaretskii Date: Fri Nov 25 15:36:18 2022 +0200 ; * lisp/progmodes/python.el (treesit-node-prev-sibling): Declare. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 221e16f8f7..2a7e8a4081 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -279,7 +279,7 @@ outline-heading-end-regexp (declare-function treesit-node-start "treesit.c") (declare-function treesit-node-end "treesit.c") (declare-function treesit-node-parent "treesit.c") - +(declare-function treesit-node-prev-sibling "treesit.c") (autoload 'comint-mode "comint") (autoload 'help-function-arglist "help-fns") commit af545234314601ba3dcd8bf32e0d9b46e1917f79 Author: Eli Zaretskii Date: Fri Nov 25 15:29:10 2022 +0200 ; Fix doc strings in xref.el * lisp/progmodes/xref.el (xref-history-storage) (xref-global-history, xref-window-local-history): Doc fixes. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 071636dd8d..c72041d70f 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -432,18 +432,20 @@ xref-auto-jump-to-first-xref (defcustom xref-history-storage #'xref-global-history "Function that returns xref history. -The following functions are predefined: +The following functions that can be used as this variable's value +are predefined: - `xref-global-history' Return a single, global history used across the entire Emacs - instance. + session. This is the default. - `xref-window-local-history' - Return different xref histories, one per window. Allows you - to navigate code independently in different windows. A new + Return separate xref histories, one per window. Allows + independent navigation of code in each window. A new xref history is created for every new window." :type '(radio - (function-item :tag "Per-window" xref-window-local-history) - (function-item :tag "Global history for Emacs instance" xref-global-history) + (function-item :tag "Per-window history" xref-window-local-history) + (function-item :tag "Global history for Emacs session" + xref-global-history) (function :tag "Other")) :version "29.1" :package-version '(xref . "1.6.0")) @@ -462,7 +464,7 @@ xref--history "(BACKWARD-STACK . FORWARD-STACK) of markers to visited Xref locations.") (defun xref-global-history (&optional new-value) - "Return the xref history global to this Emacs instance. + "Return the xref history that is global for the current Emacs session. Override existing value with NEW-VALUE if NEW-VALUE is set." (if new-value @@ -470,7 +472,7 @@ xref-global-history xref--history)) (defun xref-window-local-history (&optional new-value) - "Return window-local xref history. + "Return window-local xref history for the selected window. Override existing value with NEW-VALUE if NEW-VALUE is set." (let ((w (selected-window))) commit 98c69b255663dd869fa22c7366f254b10ff29cad Author: Eli Zaretskii Date: Fri Nov 25 15:00:07 2022 +0200 ; * src/sqlite.c (Fsqlite_version): Doc fix. diff --git a/src/sqlite.c b/src/sqlite.c index c2f90d6a87..d9b9333fb3 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -768,7 +768,8 @@ DEFUN ("sqlite-finalize", Fsqlite_finalize, Ssqlite_finalize, 1, 1, 0, } DEFUN ("sqlite-version", Fsqlite_version, Ssqlite_version, 0, 0, 0, - doc: /* SQLite library version string. */) + doc: /* Return the version string of the SQLite library. +Signal an error if SQLite support is not available. */) (void) { if (!init_sqlite_functions ()) commit f35dc7058b22a6c7bca23c6696b815f137427fb0 Author: Mattias Engdegård Date: Fri Nov 25 10:42:38 2022 +0100 Add sqlite library version string retrieval function (bug#58766) * src/sqlite.c (sqlite3_libversion, load_dll_functions): Make sqlite3_libversion available. (Fsqlite_version): New. (syms_of_sqlite): Define sqlite-version. * doc/lispref/text.texi (Database): Document. * test/src/sqlite-tests.el (sqlite-returning): `RETURNING` was added in sqlite 3.35; skip the test for older versions. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 793c22949c..ef938e88ec 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -5460,6 +5460,10 @@ Database they have the @file{.so} file-name extension. @end defun +@defun sqlite-version +Return a string denoting the version of the SQLite library in use. +@end defun + @findex sqlite-mode-open-file If you wish to list the contents of an SQLite file, you can use the @code{sqlite-mode-open-file} command. This will pop to a buffer using diff --git a/src/sqlite.c b/src/sqlite.c index ac860f55bc..c2f90d6a87 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -55,6 +55,7 @@ DEF_DLL_FN (SQLITE_API const char*, sqlite3_errmsg, (sqlite3*)); #if SQLITE_VERSION_NUMBER >= 3007015 DEF_DLL_FN (SQLITE_API const char*, sqlite3_errstr, (int)); #endif +DEF_DLL_FN (SQLITE_API const char*, sqlite3_libversion, (void)); DEF_DLL_FN (SQLITE_API int, sqlite3_step, (sqlite3_stmt*)); DEF_DLL_FN (SQLITE_API int, sqlite3_changes, (sqlite3*)); DEF_DLL_FN (SQLITE_API int, sqlite3_column_count, (sqlite3_stmt*)); @@ -96,6 +97,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, # if SQLITE_VERSION_NUMBER >= 3007015 # undef sqlite3_errstr # endif +# undef sqlite3_libversion # undef sqlite3_step # undef sqlite3_changes # undef sqlite3_column_count @@ -124,6 +126,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, # if SQLITE_VERSION_NUMBER >= 3007015 # define sqlite3_errstr fn_sqlite3_errstr # endif +# define sqlite3_libversion fn_sqlite3_libversion # define sqlite3_step fn_sqlite3_step # define sqlite3_changes fn_sqlite3_changes # define sqlite3_column_count fn_sqlite3_column_count @@ -155,6 +158,7 @@ load_dll_functions (HMODULE library) #if SQLITE_VERSION_NUMBER >= 3007015 LOAD_DLL_FN (library, sqlite3_errstr); #endif + LOAD_DLL_FN (library, sqlite3_libversion); LOAD_DLL_FN (library, sqlite3_step); LOAD_DLL_FN (library, sqlite3_changes); LOAD_DLL_FN (library, sqlite3_column_count); @@ -763,6 +767,15 @@ DEFUN ("sqlite-finalize", Fsqlite_finalize, Ssqlite_finalize, 1, 1, 0, return Qt; } +DEFUN ("sqlite-version", Fsqlite_version, Ssqlite_version, 0, 0, 0, + doc: /* SQLite library version string. */) + (void) +{ + if (!init_sqlite_functions ()) + error ("sqlite support is not available"); + return build_string (sqlite3_libversion ()); +} + #endif /* HAVE_SQLITE3 */ DEFUN ("sqlitep", Fsqlitep, Ssqlitep, 1, 1, 0, @@ -814,6 +827,7 @@ syms_of_sqlite (void) defsubr (&Ssqlite_columns); defsubr (&Ssqlite_more_p); defsubr (&Ssqlite_finalize); + defsubr (&Ssqlite_version); DEFSYM (Qset, "set"); DEFSYM (Qfull, "full"); #endif diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el index be4f60ab57..e9ddf9c0be 100644 --- a/test/src/sqlite-tests.el +++ b/test/src/sqlite-tests.el @@ -243,6 +243,7 @@ sqlite-blob (ert-deftest sqlite-returning () (skip-unless (sqlite-available-p)) + (skip-unless (version<= "3.35" (sqlite-version))) (let (db) (progn (setq db (sqlite-open)) commit 8910447308fa97eaa224b76629bd37b706f62fe1 Author: Theodor Thornhill Date: Thu Nov 24 23:12:40 2022 +0100 Fix regex errors in csharp-mode * lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Repetition errors in regex. (csharp-compilation-re-xbuild-warning): Make regex match regex for xbuild-error. diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index af8a4a8106..af3a4d86da 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -482,7 +482,7 @@ csharp-guess-basic-syntax (save-excursion ;; 'new' should be part of the line (goto-char (c-point 'iopl)) - (looking-at ".*\\s *new\\s *.*")) + (looking-at ".*new.*")) ;; Line should not already be terminated (save-excursion (goto-char (c-point 'eopl)) @@ -614,7 +614,7 @@ csharp-compilation-re-xbuild-warning "\\([^(\r\n)]+\\)(\\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)?" ;; handle weird devenv output format with 4 numbers, not 2 by having optional ;; extra capture-groups. - "\\(?:,\\([0-9]+\\)\\)?*): " + "\\(?:,\\([0-9]+\\)\\)*): " "warning [[:alnum:]]+: .+$") "Regexp to match compilation warning from xbuild.") commit 639adf26a1b43445eaf52e4246cf1f5b46b5e12d Author: Alan Mackenzie Date: Fri Nov 25 09:49:02 2022 +0000 CC Mode: Fix the "asymmetry rule" for fontifying a type followed by * This fixes bug #59427. We now handle correctly the case when a parenthesis follows the * which is ambiguously a multiplication or indirection operator. Also, we don't recognise a type thus found as a found type - the evidence is too weak. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Fix CASE 17.5 as above. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 9e09e5150d..11ddb39ed9 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -11077,8 +11077,9 @@ c-forward-decl-or-cast-1 at-decl-start)) (let ((space-before-id (save-excursion - (goto-char name-start) - (or (bolp) (memq (char-before) '(?\ ?\t))))) + (goto-char id-start) ; Position of "*". + (and (> (skip-chars-forward "* \t\n\r") 0) + (memq (char-before) '(?\ ?\t ?\n ?\r))))) (space-after-type (save-excursion (goto-char type-start) @@ -11088,6 +11089,8 @@ c-forward-decl-or-cast-1 (memq (char-after) '(?\ ?\t))))))) (when (not (eq (not space-before-id) (not space-after-type))) + (when (eq at-type 'maybe) + (setq unsafe-maybe t)) (setq maybe-expression t) (throw 'at-decl-or-cast t))))) commit a7f8087d7fc995e41b4cd6143e5833e6e3a9dac4 Author: Stefan Kangas Date: Fri Nov 25 10:12:52 2022 +0100 Remove unused parameter from image_create_pix_container * src/image.c (image_create_pix_container): Remove unused frame parameter. Update callers. diff --git a/src/image.c b/src/image.c index 600c32571e..2436f78ac3 100644 --- a/src/image.c +++ b/src/image.c @@ -193,8 +193,8 @@ #define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG (color) * 0x101) #ifdef USE_CAIRO static Emacs_Pix_Container -image_create_pix_container (struct frame *f, unsigned int width, - unsigned int height, unsigned int depth) +image_create_pix_container (unsigned int width, unsigned int height, + unsigned int depth) { Emacs_Pix_Container pimg; @@ -237,7 +237,7 @@ image_pix_container_create_from_bitmap_data (struct frame *f, unsigned long fg, unsigned long bg) { - Emacs_Pix_Container pimg = image_create_pix_container (f, width, height, 0); + Emacs_Pix_Container pimg = image_create_pix_container (width, height, 0); int bytes_per_line = (width + (CHAR_BIT - 1)) / CHAR_BIT; for (int y = 0; y < height; y++) @@ -3342,7 +3342,7 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int width, int height, int d eassert (input_blocked_p ()); /* Allocate a pixmap of the same size. */ - *pixmap = image_create_pix_container (f, width, height, depth); + *pixmap = image_create_pix_container (width, height, depth); if (*pixmap == NO_PIXMAP) { *pimg = NULL;