From 23c06c7c3080d83ae0eee70c70fb50587339a63e Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 10 Dec 2023 11:16:58 -0500 Subject: [PATCH 01/16] Update to Org 9.6.13 --- etc/refcards/orgcard.tex | 2 +- lisp/org/ob-plantuml.el | 2 +- lisp/org/org-element.el | 8 ++++++-- lisp/org/org-macs.el | 13 +++++++++---- lisp/org/org-persist.el | 15 ++++++++++++--- lisp/org/org-version.el | 4 ++-- lisp/org/org.el | 8 ++++---- lisp/org/ox-beamer.el | 2 +- 8 files changed, 36 insertions(+), 18 deletions(-) diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index 4b73a544e80..11e046fc0dd 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{9.6.11} +\def\orgversionnumber{9.6.13} \def\versionyear{2023} % latest update \input emacsver.tex diff --git a/lisp/org/ob-plantuml.el b/lisp/org/ob-plantuml.el index 3202c6e415d..febdb3964c6 100644 --- a/lisp/org/ob-plantuml.el +++ b/lisp/org/ob-plantuml.el @@ -57,7 +57,7 @@ The JAR can be configured via `org-plantuml-jar-path'. `plantuml' means to use the PlantUML executable. The executable can be configured via `org-plantuml-executable-path'. -You can also configure extra arguments via `org-plantuml-executable-args'." +You can also configure extra arguments via `org-plantuml-args'." :group 'org-babel :package-version '(Org . "9.4") :type 'symbol diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index e6bff9120c4..44694d73084 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -5906,7 +5906,7 @@ If this warning appears regularly, please report the warning text to Org mode ma (org-element-property :begin element) (org-element-property :org-element--cache-sync-key element)) (org-element-cache-reset) - (throw 'quit nil)) + (throw 'org-element--cache-quit nil)) (or (avl-tree-delete org-element--cache element) (progn ;; This should not happen, but if it is, would be better to know @@ -5919,7 +5919,7 @@ If this warning appears regularly, please report the warning text to Org mode ma (org-element-property :begin element) (org-element-property :org-element--cache-sync-key element)) (org-element-cache-reset) - (throw 'quit nil))))) + (throw 'org-element--cache-quit nil))))) ;;;; Synchronization @@ -6382,6 +6382,10 @@ completing the request." ;; We altered the tree structure. The tree ;; traversal needs to be restarted. (setf (org-element--request-key request) key) + ;; Make sure that we restart tree traversal + ;; past already shifted elements (before the + ;; removed DATA). + (setq start key) (setf (org-element--request-parent request) parent) ;; Restart tree traversal. (setq node (org-element--cache-root) diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index 4efa8ba6800..6ed901b7397 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -1119,7 +1119,12 @@ Return width in pixels when PIXELS is non-nil." (setq pixel-width (if (get-buffer-window (current-buffer)) (car (window-text-pixel-size - nil (line-beginning-position) (point-max))) + ;; FIXME: 10000 because + ;; `most-positive-fixnum' ain't working + ;; (tests failing) and this call will be + ;; removed after we drop Emacs 28 support + ;; anyway. + nil (line-beginning-position) (point-max) 10000)) (let ((dedicatedp (window-dedicated-p)) (oldbuffer (window-buffer))) (unwind-protect @@ -1128,7 +1133,7 @@ Return width in pixels when PIXELS is non-nil." (set-window-dedicated-p nil nil) (set-window-buffer nil (current-buffer)) (car (window-text-pixel-size - nil (line-beginning-position) (point-max)))) + nil (line-beginning-position) (point-max) 10000))) (set-window-buffer nil oldbuffer) (set-window-dedicated-p nil dedicatedp))))) (unless pixels @@ -1137,7 +1142,7 @@ Return width in pixels when PIXELS is non-nil." (setq symbol-width (if (get-buffer-window (current-buffer)) (car (window-text-pixel-size - nil (line-beginning-position) (point-max))) + nil (line-beginning-position) (point-max) 10000)) (let ((dedicatedp (window-dedicated-p)) (oldbuffer (window-buffer))) (unwind-protect @@ -1146,7 +1151,7 @@ Return width in pixels when PIXELS is non-nil." (set-window-dedicated-p nil nil) (set-window-buffer nil (current-buffer)) (car (window-text-pixel-size - nil (line-beginning-position) (point-max)))) + nil (line-beginning-position) (point-max) 10000))) (set-window-buffer nil oldbuffer) (set-window-dedicated-p nil dedicatedp))))))) (if pixels diff --git a/lisp/org/org-persist.el b/lisp/org/org-persist.el index dc9fe3a7103..59ef2ac27a0 100644 --- a/lisp/org/org-persist.el +++ b/lisp/org/org-persist.el @@ -481,9 +481,14 @@ MISC, if non-nil will be appended to the collection. It must be a plist." (unless (stringp associated) (setq associated (cadr associated))) (let* ((rtn `(:file ,associated)) - (inode (and (fboundp 'file-attribute-inode-number) - (file-attribute-inode-number - (file-attributes associated))))) + (inode (and + ;; Do not store :inode for remote files - it may + ;; be time-consuming on slow connections or even + ;; fail completely when ssh connection is closed. + (not (file-remote-p associated)) + (fboundp 'file-attribute-inode-number) + (file-attribute-inode-number + (file-attributes associated))))) (when inode (plist-put rtn :inode inode)) rtn)) ((or (pred bufferp) `(:buffer ,_)) @@ -501,6 +506,10 @@ MISC, if non-nil will be appended to the collection. It must be a plist." (or (buffer-base-buffer associated) associated))) (setq inode (when (and file + ;; Do not store :inode for remote files - it may + ;; be time-consuming on slow connections or even + ;; fail completely when ssh connection is closed. + (not (file-remote-p file)) (fboundp 'file-attribute-inode-number)) (file-attribute-inode-number (file-attributes file)))) diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index e5b0fbcf2a9..8eebdbe09b2 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -5,13 +5,13 @@ (defun org-release () "The release version of Org. Inserted by installing Org mode or when a release is made." - (let ((org-release "9.6.11")) + (let ((org-release "9.6.13")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.6.11")) + (let ((org-git-version "release_9.6.13")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 2f4cfe16866..b94dcd07b9a 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -9,7 +9,7 @@ ;; URL: https://orgmode.org ;; Package-Requires: ((emacs "26.1")) -;; Version: 9.6.11 +;; Version: 9.6.13 ;; This file is part of GNU Emacs. ;; @@ -19986,7 +19986,7 @@ With argument N not nil or 1, move forward N - 1 lines first." (if (eq special 'reversed) (when (and (= origin bol) (eq last-command this-command)) (goto-char refpos)) - (when (or (> origin refpos) (= origin bol)) + (when (or (> origin refpos) (<= origin bol)) (goto-char refpos))))) ((and (looking-at org-list-full-item-re) (memq (org-element-type (save-match-data (org-element-at-point))) @@ -20001,7 +20001,7 @@ With argument N not nil or 1, move forward N - 1 lines first." (if (eq special 'reversed) (when (and (= (point) origin) (eq last-command this-command)) (goto-char after-bullet)) - (when (or (> origin after-bullet) (= (point) origin)) + (when (or (> origin after-bullet) (>= (point) origin)) (goto-char after-bullet))))) ;; No special context. Point is already at beginning of line. (t nil)))) @@ -20056,7 +20056,7 @@ With argument N not nil or 1, move forward N - 1 lines first." (goto-char tags) (end-of-line))) (t - (if (or (< origin tags) (= origin (line-end-position))) + (if (or (< origin tags) (>= origin (line-end-position))) (goto-char tags) (end-of-line)))))) ((bound-and-true-p visual-line-mode) diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el index 689bf1559b4..fe1f2ffa572 100644 --- a/lisp/org/ox-beamer.el +++ b/lisp/org/ox-beamer.el @@ -930,7 +930,7 @@ holding export options." '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend)) 'prepend)) -(defface org-beamer-tag '((t (:box (:line-width 1 :color grey40)))) +(defface org-beamer-tag '((t (:box (:line-width 1 :color "grey40")))) "The special face for beamer tags." :group 'org-export-beamer) From eace9e1122601bdc2f7f03228816198ce726f8fc Mon Sep 17 00:00:00 2001 From: Maciej Kalandyk Date: Mon, 11 Dec 2023 01:15:34 +0200 Subject: [PATCH 02/16] python-ts-mode: Highlight default parameters * lisp/progmodes/python.el (python--treesit-settings): Highlight default parameters (bug#67703). --- lisp/progmodes/python.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a7944576196..7c5c20608bd 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1114,7 +1114,8 @@ fontified." name: (identifier) @font-lock-function-name-face) (class_definition name: (identifier) @font-lock-type-face) - (parameters (identifier) @font-lock-variable-name-face)) + (parameters (identifier) @font-lock-variable-name-face) + (parameters (default_parameter name: (identifier) @font-lock-variable-name-face))) :feature 'function :language 'python From 9874561f39e62c1c9fada6c2e013f93d9ea65729 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 10 Dec 2023 16:23:44 -0800 Subject: [PATCH 03/16] Fix treesit-node-field-name and friends (bug#66674) So turns out ts_node_field_name_for_child takes a named node index, but we were passing it normal index that counts both named and anonymous nodes. That's what makes the field name all wrong in treesit explorer. * doc/lispref/parsing.texi: (Accessing Node Information): Update docstring. * lisp/treesit.el (treesit-node-index): Add some unrelated comment. (treesit-node-field-name): Get named node index rather than all node index. * src/treesit.c (Ftreesit_node_field_name_for_child): Update docstring, use ts_node_named_child_count. --- doc/lispref/parsing.texi | 4 ++-- lisp/treesit.el | 3 ++- src/treesit.c | 7 +++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 353585f79c7..34eb2826a21 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -1015,8 +1015,8 @@ This function returns the field name of the @var{n}'th child of @var{node}. It returns @code{nil} if there is no @var{n}'th child, or the @var{n}'th child doesn't have a field name. -Note that @var{n} counts both named and anonymous children, and -@var{n} can be negative, e.g., @minus{}1 represents the last child. +Note that @var{n} counts named nodes only, and @var{n} can be +negative, e.g., @minus{}1 represents the last child. @end defun @defun treesit-node-child-count node &optional named diff --git a/lisp/treesit.el b/lisp/treesit.el index 962a6fc3cf8..9dc5d4970b6 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -360,6 +360,7 @@ If NAMED is non-nil, collect named child only." "Return the index of NODE in its parent. If NAMED is non-nil, count named child only." (let ((count 0)) + ;; TODO: Use next-sibling as it's more efficient. (while (setq node (treesit-node-prev-sibling node named)) (cl-incf count)) count)) @@ -367,7 +368,7 @@ If NAMED is non-nil, count named child only." (defun treesit-node-field-name (node) "Return the field name of NODE as a child of its parent." (when-let ((parent (treesit-node-parent node)) - (idx (treesit-node-index node))) + (idx (treesit-node-index node t))) (treesit-node-field-name-for-child parent idx))) ;;; Query API supplement diff --git a/src/treesit.c b/src/treesit.c index 8419452d54a..45de82ec096 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -2015,9 +2015,8 @@ DEFUN ("treesit-node-field-name-for-child", Return nil if there's no Nth child, or if it has no field. If NODE is nil, return nil. -N counts all children, i.e., named ones and anonymous ones. - -N could be negative, e.g., -1 represents the last child. */) +Note that N counts named nodes only. Also, N could be negative, e.g., +-1 represents the last child. */) (Lisp_Object node, Lisp_Object n) { if (NILP (node)) @@ -2031,7 +2030,7 @@ N could be negative, e.g., -1 represents the last child. */) /* Process negative index. */ if (idx < 0) - idx = ts_node_child_count (treesit_node) + idx; + idx = ts_node_named_child_count (treesit_node) + idx; if (idx < 0) return Qnil; if (idx > UINT32_MAX) From d2c4b926ac20de6f7d9f3576b22272bc560bd0f7 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 10 Dec 2023 17:40:39 -0800 Subject: [PATCH 04/16] Fix treesit-default-defun-skipper (bug#66711) * lisp/treesit.el: (treesit-default-defun-skipper): Add bol to the rx pattern. --- lisp/treesit.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 9dc5d4970b6..8a07f5023a9 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1962,7 +1962,7 @@ the current line if the beginning of the defun is indented." (forward-line 1)) ;; Moving backward, but there are some whitespace (and only ;; whitespace) between point and BOL: go back to BOL. - ((looking-back (rx (+ (or " " "\t"))) + ((looking-back (rx bol (+ (or " " "\t"))) (line-beginning-position)) (beginning-of-line)))) From e23068cb9a1692fc3c50b0b386237a56cae201f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Augustin=20Ch=C3=A9neau?= Date: Wed, 20 Sep 2023 12:23:06 +0200 Subject: [PATCH 05/16] Add missing indent rules in c-ts-mode (bug#66152) Example: static myttype * variable_name; * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add rules. --- lisp/progmodes/c-ts-mode.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index e708420148a..5606996eee2 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -436,6 +436,8 @@ MODE is either `c' or `cpp'." ((parent-is "preproc") c-ts-mode--anchor-prev-sibling 0) ((parent-is "function_definition") parent-bol 0) + ((parent-is "pointer_declarator") parent-bol 0) + ((parent-is "declaration") parent-bol 0) ((parent-is "conditional_expression") first-sibling 0) ((parent-is "assignment_expression") parent-bol c-ts-mode-indent-offset) ((parent-is "concatenated_string") first-sibling 0) From 7f1bd69cd19504f2bd47e13c530a55ffca08e27d Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sun, 10 Dec 2023 18:24:27 -0800 Subject: [PATCH 06/16] Fix c-ts-mode bracketless indentation for BSD style (bug#66152) * lisp/progmodes/c-ts-mode.el: (c-ts-mode--indent-styles): Make sure the BSD rules only apply to opening bracket (compound_statement), then bracketless statements will fallback to common rules. * test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: Copy the bracketless test from indent.erts to here. --- lisp/progmodes/c-ts-mode.el | 14 ++++---- .../c-ts-mode-resources/indent-bsd.erts | 34 +++++++++++++++++++ 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 5606996eee2..ca831a9c5f9 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -515,13 +515,13 @@ MODE is either `c' or `cpp'." ((node-is "labeled_statement") parent-bol c-ts-mode-indent-offset) ((parent-is "labeled_statement") parent-bol c-ts-mode-indent-offset) ((parent-is "compound_statement") parent-bol c-ts-mode-indent-offset) - ((parent-is "if_statement") parent-bol 0) - ((parent-is "else_clause") parent-bol 0) - ((parent-is "for_statement") parent-bol 0) - ((parent-is "while_statement") parent-bol 0) - ((parent-is "switch_statement") parent-bol 0) - ((parent-is "case_statement") parent-bol 0) - ((parent-is "do_statement") parent-bol 0) + ((match "compound_statement" "if_statement") standalone-parent 0) + ((match "compound_statement" "else_clause") standalone-parent 0) + ((match "compound_statement" "for_statement") standalone-parent 0) + ((match "compound_statement" "while_statement") standalone-parent 0) + ((match "compound_statement" "switch_statement") standalone-parent 0) + ((match "compound_statement" "case_statement") standalone-parent 0) + ((match "compound_statement" "do_statement") standalone-parent 0) ,@common)))) (defun c-ts-mode--top-level-label-matcher (node parent &rest _) diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts index 74e34fe821b..fa65ba83a69 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts @@ -91,3 +91,37 @@ main (int argc, } } =-=-= + +Name: Bracketless Simple Statement (bug#66152) + +=-= +for (int i = 0; i < 5; i++) +continue; + +while (true) +return 1; + +do +i++; +while (true) + +if (true) +break; +else +break; +=-= +for (int i = 0; i < 5; i++) + continue; + +while (true) + return 1; + +do + i++; +while (true) + +if (true) + break; +else + break; +=-=-= From c165247c3009adec912abdf74d6d7d73c8c76c33 Mon Sep 17 00:00:00 2001 From: Noah Peart Date: Sun, 10 Dec 2023 14:58:31 -0800 Subject: [PATCH 07/16] Add indentation rules for bracketless statements in js-ts-mode * lisp/progmodes/js.el (js--treesit-indent-rules): Add indentation rules to handle bracketless statements (bug#67758). * test/lisp/progmodes/js-tests.el (js-ts-mode-test-indentation): New test for js-ts-mode indentation. * test/lisp/progmodes/js-resources/js-ts-indents.erts: New file with indentation tests for js-ts-mode. --- lisp/progmodes/js.el | 5 +++ .../progmodes/js-resources/js-ts-indents.erts | 44 +++++++++++++++++++ test/lisp/progmodes/js-tests.el | 6 +++ 3 files changed, 55 insertions(+) create mode 100644 test/lisp/progmodes/js-resources/js-ts-indents.erts diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 71aa5cbea68..aaf5779699b 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3472,6 +3472,11 @@ Check if a node type is available, then return the right indent rules." ((parent-is "class_body") parent-bol js-indent-level) ((parent-is ,switch-case) parent-bol js-indent-level) ((parent-is "statement_block") parent-bol js-indent-level) + ((match "while" "do_statement") parent-bol 0) + ((match "else" "if_statement") parent-bol 0) + ((parent-is ,(rx (or (seq (or "if" "for" "for_in" "while" "do") "_statement") + "else_clause"))) + parent-bol js-indent-level) ;; JSX ,@(js-jsx--treesit-indent-compatibility-bb1f97b) diff --git a/test/lisp/progmodes/js-resources/js-ts-indents.erts b/test/lisp/progmodes/js-resources/js-ts-indents.erts new file mode 100644 index 00000000000..2e34b23acef --- /dev/null +++ b/test/lisp/progmodes/js-resources/js-ts-indents.erts @@ -0,0 +1,44 @@ +Code: + (lambda () + (setq indent-tabs-mode nil) + (setq js-indent-level 2) + (js-ts-mode) + (indent-region (point-min) (point-max))) + +Name: Basic indentation + +=-= +const foo = () => { + console.log("bar"); + if (x) { + return y; + } else if (y) { + return u; + } + return baz.x() + ? true + : false; +} +=-=-= + +Name: Statement indentation without braces + +=-= +function bracketless_statements(x) { + if (x == 0) + console.log("if_statement"); + else if (x == 1) + console.log("if_statement"); + else + console.log("else_clause"); + for (let i = 0; i < 1; i++) + console.log("for_statement"); + for (let _ of [true]) + console.log("for_in_statement"); + while (x-- > 0) + console.log("while_statement"); + do + console.log("do_statement"); + while (false) +}; +=-=-= diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index 5db92b08f8a..827d7bb8a99 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el @@ -288,6 +288,12 @@ function bar() { ;; end-of-defun should move point to eob. (should (eobp)))) +;;;; Tree-sitter tests. + +(ert-deftest js-ts-mode-test-indentation () + (skip-unless (treesit-ready-p 'javascript)) + (ert-test-erts-file (ert-resource-file "js-ts-indents.erts"))) + (provide 'js-tests) ;;; js-tests.el ends here From 400ef15bdc373b05e877cf0914f0fd5eda56cf1d Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 13 Dec 2023 00:00:38 +0200 Subject: [PATCH 08/16] js-ts-mode: Fix font-lock rules conflict * lisp/progmodes/js.el (js--treesit-font-lock-settings): Move 'property' to after 'jsx'. Stop using predicate (bug#67684). (js--treesit-property-not-function-p): Delete. --- lisp/progmodes/js.el | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index aaf5779699b..c8d507c784b 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3580,16 +3580,6 @@ Check if a node type is available, then return the right indent rules." ;; full namespace import (* as alias) (import_clause (namespace_import (identifier) @font-lock-variable-name-face))) - :language 'javascript - :feature 'property - '(((property_identifier) @font-lock-property-use-face - (:pred js--treesit-property-not-function-p - @font-lock-property-use-face)) - - (pair value: (identifier) @font-lock-variable-use-face) - - ((shorthand_property_identifier) @font-lock-property-use-face)) - :language 'javascript :feature 'assignment '((assignment_expression @@ -3610,6 +3600,12 @@ Check if a node type is available, then return the right indent rules." (jsx_self_closing_element name: (_) @font-lock-function-call-face) (jsx_attribute (property_identifier) @font-lock-constant-face)) + :language 'javascript + :feature 'property + '(((property_identifier) @font-lock-property-use-face) + (pair value: (identifier) @font-lock-variable-use-face) + ((shorthand_property_identifier) @font-lock-property-use-face)) + :language 'javascript :feature 'number '((number) @font-lock-number-face @@ -3661,14 +3657,6 @@ OVERRIDE is the override flag described in (setq font-beg (treesit-node-end child) child (treesit-node-next-sibling child))))) -(defun js--treesit-property-not-function-p (node) - "Check that NODE, a property_identifier, is not used as a function." - (not (equal (treesit-node-type - (treesit-node-parent ; Maybe call_expression. - (treesit-node-parent ; Maybe member_expression. - node))) - "call_expression"))) - (defvar js--treesit-lhs-identifier-query (when (treesit-available-p) (treesit-query-compile 'javascript '((identifier) @id From ed8a8a5ba1607a37f0ed9cc11a77221d66946efb Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Thu, 14 Dec 2023 18:28:53 -0600 Subject: [PATCH 09/16] Fix symbol name in Multisession Variables examples * doc/lispref/variables.texi (Multisession Variables): Fix symbol name. (Bug#67823) --- doc/lispref/variables.texi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 5de5ac6efa7..b4c6d8ac5c3 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -2971,7 +2971,7 @@ meant to be used, here's a small example: @lisp @group -(define-multisession-variable foo-var 0) +(define-multisession-variable foo 0) (defun my-adder (num) (interactive "nAdd number: ") (setf (multisession-value foo) @@ -2981,7 +2981,7 @@ meant to be used, here's a small example: @end lisp @noindent -This defines the variable @code{foo-var} and binds it to a special +This defines the variable @code{foo} and binds it to a special multisession object which is initialized with the value @samp{0} (if the variable doesn't already exist from a previous session). The @code{my-adder} command queries the user for a number, adds this to @@ -3004,7 +3004,7 @@ specified by @var{package-symbol}. The combination of @var{package-symbol} isn't given, this will default to the first ``segment'' of the @var{name} symbol's name, which is the part of its name up to and excluding the first @samp{-}. For instance, if -@var{name} is @code{foo-var} and @var{package-symbol} isn't given, +@var{name} is @code{foo} and @var{package-symbol} isn't given, @var{package-symbol} will default to @code{foo}. @cindex synchronized multisession variables @@ -3012,7 +3012,7 @@ name up to and excluding the first @samp{-}. For instance, if Multisession variables can be @dfn{synchronized} if @var{bool} is non-@code{nil}. This means that if there're two concurrent Emacs instances running, and the other Emacs changes the multisession -variable @code{foo-var}, the current Emacs instance will retrieve that +variable @code{foo}, the current Emacs instance will retrieve that modified data when accessing the value. If @var{synchronized} is @code{nil} or missing, this won't happen, and the values in all Emacs sessions using the variable will be independent of each other. From 6b6e770a1f55da0580706c7ec21a409437d19ab4 Mon Sep 17 00:00:00 2001 From: Niall Dooley Date: Fri, 24 Nov 2023 16:52:36 +0100 Subject: [PATCH 10/16] Eglot: Add ruff-lsp as an alternative Python server ruff-lsp [1] is an LSP server for Ruff [2], [3], a fast Python linter and code formatter. It supports surfacing Ruff diagnostics and providing Code Actions to fix them, but is intended to be used alongside another Python LSP in order to support features like navigation and autocompletion. [1]: https://github.com/astral-sh/ruff-lsp [2]: https://github.com/astral-sh/ruff [3]: https://docs.astral.sh/ruff/ * lisp/progmodes/eglot.el (eglot-server-programs): Add ruff-lsp. Copyright-paperwork-exempt: yes --- lisp/progmodes/eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 80f98d7553d..967d86955a4 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -188,7 +188,7 @@ chosen (interactively or automatically)." (vimrc-mode . ("vim-language-server" "--stdio")) ((python-mode python-ts-mode) . ,(eglot-alternatives - '("pylsp" "pyls" ("pyright-langserver" "--stdio") "jedi-language-server"))) + '("pylsp" "pyls" ("pyright-langserver" "--stdio") "jedi-language-server" "ruff-lsp"))) ((js-json-mode json-mode json-ts-mode) . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") ("vscode-json-languageserver" "--stdio") From 5be94e2bce53f9826b64d3566a0d5524aeccbccd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2023 13:25:58 +0200 Subject: [PATCH 11/16] Fix opening directory trees from Filesets menu In bug#976, the code was fixed, but the cautious condition in the original author's code, which catered to invoking 'filelists-open' from the menu-bar menu, was omitted, which made that invocation, which did work before, broken. * lisp/filesets.el (filesets-get-filelist): Fix opening directory trees from the Filesets menu-bar menu. (Bug#67658) --- lisp/filesets.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/filesets.el b/lisp/filesets.el index 1b7e6ffa81f..d00a29c2ebf 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -1653,7 +1653,17 @@ Assume MODE (see `filesets-entry-mode'), if provided." (filesets-entry-get-master entry))))) (cons entry (filesets-ingroup-cache-get entry)))) (:tree - (let* ((dirpatt (filesets-entry-get-tree entry)) + ;; Warning: ENTRY here could be of at least two + ;; differente forms, either + ;; (NAME (:tree DIRECTORY PATTERN)) + ;; or + ;; (DIRECTORY PATTERN) + ;; The latter happens when opening a tree fileset + ;; from the Filesets menu. We need to support both + ;; of these forms! + (let* ((dirpatt (if (consp (nth 1 entry)) + (filesets-entry-get-tree entry) + entry)) (dir (nth 0 dirpatt)) (patt (nth 1 dirpatt)) (depth (or (filesets-entry-get-tree-max-level entry) From c3331cb3659ffca0b04e0b789e9826b53777a70a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2023 14:44:32 +0200 Subject: [PATCH 12/16] Fix pasting into terminal-mode on term.el * lisp/term.el (term--xterm-paste): Read pasted text from the input event. Suggested by Jared Finder . (Bug#49253) --- lisp/term.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/term.el b/lisp/term.el index 68b1136a0b4..b9f739dc8f1 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1392,8 +1392,13 @@ Entry to this mode runs the hooks on `term-mode-hook'." (defun term--xterm-paste () "Insert the text pasted in an XTerm bracketed paste operation." - (interactive) - (term-send-raw-string (xterm--pasted-text))) + (interactive "e") + (unless (eq (car-safe event) 'xterm-paste) + (error "term--xterm-paste must be found to xterm-paste event")) + (let ((str (nth 1 event))) + (unless (stringp str) + (error "term--xterm-paste provided event does not contain paste text")) + (term-send-raw-string str))) (declare-function xterm--pasted-text "term/xterm" ()) From efcbf0b5abfed8bbf767209a913b5e25270596a4 Mon Sep 17 00:00:00 2001 From: Jeremy Bryant Date: Sun, 3 Dec 2023 21:32:01 +0000 Subject: [PATCH 13/16] Add use cases of (fn) documentation facility. * doc/lispref/functions.texi (Function Documentation): Add examples. (Bug#67499) Co-authored-by: Eli Zaretskii --- doc/lispref/functions.texi | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index e646e7c8b0a..34a568b728e 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -533,6 +533,39 @@ Instead, use the @code{advertised-calling-convention} declaration compiler emit a warning message when it compiles Lisp programs which use the deprecated calling convention. +@ifnottex +The @code{(fn)} feature is typically used in the following situations: + +@itemize @minus +@item To spell out arguments and their purposes in a macro or a function. Example: + +@example +(defmacro lambda (&rest cdr) + "@dots{} +\(fn ARGS [DOCSTRING] [INTERACTIVE] BODY)"@dots{}) +@end example + +@item To provide a more detailed description and names of arguments. Example: + +@example +(defmacro macroexp--accumulate (var+list &rest body) + "@dots{} +\(fn (VAR LIST) BODY@dots{})" + (declare (indent 1)) + (let ((var (car var+list)) + (list (cadr var+list)) +@dots{}))) +@end example + +@item To better explain the purpose of a @code{defalias}. Example: + +@example +(defalias 'abbrev-get 'get + "@dots{} +\(fn ABBREV PROP)") +@end example +@end ifnottex + @cindex computed documentation string @kindex :documentation Documentation strings are usually static, but occasionally it can be From 791cc5065da2bfac47f8c7485bc870880548eb9d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2023 15:33:02 +0200 Subject: [PATCH 14/16] Fix shaping of Sinhala text * lisp/language/sinhala.el (composition-function-table): Allow U+200D U+0DCA as well as U+0DCA U+200D between consonants. Suggested by Richard Wordingham . (Bug#67828) --- lisp/language/sinhala.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/language/sinhala.el b/lisp/language/sinhala.el index bf320506001..a5c379b3aae 100644 --- a/lisp/language/sinhala.el +++ b/lisp/language/sinhala.el @@ -36,11 +36,11 @@ composition-function-table '(#xD80 . #xDFF) (list (vector - ;; C:consonant, H:HALANT, J:ZWJ, v:vowel sign, + ;; C:consonant, H:HALANTA, J:ZWJ, v:vowel sign, ;; V:independent vowel, a:ANUSVARA .. VISARGA (concat - ;; C(HJC)*v*H?a?, or - "[\u0D9A-\u0DC6]\\(?:\u0DCA\u200D[\u0D9A-\u0DC6]\\)*[\u0DCF-\u0DDF\u0DF2-\u0DF3]*\u0DCA?[\u0D82-\u0D83]?\\|" + ;; C(HJ|JH)C)*v*H?a?, or + "[\u0D9A-\u0DC6]\\(?:\\(\u0DCA\u200D\\|\u200D\u0DCA\\)[\u0D9A-\u0DC6]\\)*[\u0DCF-\u0DDF\u0DF2-\u0DF3]*\u0DCA?[\u0D82-\u0D83]?\\|" ;; Va?, or "[\u0D85-\u0D96][\u0D82-\u0D83]?\\|" ;; any other singleton characters From 0d9e2e448d9ef3efae3111503a0947fa0159e03c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2023 16:06:29 +0200 Subject: [PATCH 15/16] ; * doc/lispref/functions.texi (Function Documentation): Fix @itemize. --- doc/lispref/functions.texi | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 34a568b728e..3ef7fd5ac6a 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -564,6 +564,7 @@ The @code{(fn)} feature is typically used in the following situations: "@dots{} \(fn ABBREV PROP)") @end example +@end itemize @end ifnottex @cindex computed documentation string From bf4ccb0be076d8b65498c56dedf0eee17cb3c24c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2023 16:08:52 +0200 Subject: [PATCH 16/16] ; * lisp/term.el (term--xterm-paste): Fix last change. --- lisp/term.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/term.el b/lisp/term.el index b9f739dc8f1..2c7c1adaa77 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1390,7 +1390,7 @@ Entry to this mode runs the hooks on `term-mode-hook'." (interactive) (term-send-raw-string (current-kill 0))) -(defun term--xterm-paste () +(defun term--xterm-paste (event) "Insert the text pasted in an XTerm bracketed paste operation." (interactive "e") (unless (eq (car-safe event) 'xterm-paste)