From 7dabfe9465c623043e4ea1abe618a6169c155d04 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 10 Nov 2024 10:56:40 +0200 Subject: [PATCH 01/11] Fix movement to the left in picture-mode * lisp/textmodes/picture.el (picture-insert): Measure width by counting columns on display, not by using 'string-width', because the latter is inaccurate when TABs are involved. (Bug#74255) --- lisp/textmodes/picture.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index adb06cb6a29..08bb12cd80c 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -264,9 +264,14 @@ Use \"\\[command-apropos] picture-movement\" to see commands which control motio (move-to-column picture-desired-column t)) (let ((col (+ picture-desired-column width))) (or (eolp) - (let ((pos (point))) - (move-to-column col t) - (let ((old-width (string-width (buffer-substring pos (point))))) + (let ((pos (point)) + (col0 (current-column)) + col1) + (setq col1 (move-to-column col t)) + ;; We count columns, not width, because move-to-column + ;; could insert TABs, which width depends on horizontal + ;; position. + (let ((old-width (- (max col0 col1) (min col0 col1)))) (delete-region pos (point)) (when (> old-width width) (insert-char ? (- old-width width)) From 3954e8d9bbed902e750c9e0647c6527ae32523b9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 10 Nov 2024 11:48:34 +0200 Subject: [PATCH 02/11] Fix picture-mode with full-width characters * lisp/textmodes/picture.el (picture-insert): Don't rely on 'move-to-column' to move to the column that is its argument: this might be false when full-width characters are involved. --- lisp/textmodes/picture.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 08bb12cd80c..1435ea2c4e2 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -257,12 +257,14 @@ Use \"\\[command-apropos] picture-movement\" to see commands which control motio (> width 1) (< (abs picture-horizontal-step) 2)) (* picture-horizontal-step 2) - picture-horizontal-step))) + picture-horizontal-step)) + actual-col) (while (> arg 0) (setq arg (1- arg)) (if (/= picture-desired-column (current-column)) - (move-to-column picture-desired-column t)) - (let ((col (+ picture-desired-column width))) + (setq actual-col (move-to-column picture-desired-column t)) + (setq actual-col picture-desired-column)) + (let ((col (+ actual-col width))) (or (eolp) (let ((pos (point)) (col0 (current-column)) From c96e57609076c4d5627e698a6f12a731a77c365e Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 10 Nov 2024 12:35:15 +0100 Subject: [PATCH 03/11] Precise password cache in Tramp * doc/misc/tramp.texi (Password handling): Describe auth-source-cache-expiry and auth-source-do-cache instead of password-cache-expiry and password-cache. (Bug#74105) * lisp/net/tramp.el (tramp-read-passwd): Check for `auth-sources' being non-nil. --- doc/misc/tramp.texi | 18 +++++++++++------- lisp/net/tramp.el | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 9895b3c6fce..0d7f9c11a6b 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2194,14 +2194,18 @@ like this: @value{tramp} can cache passwords as entered and reuse when needed for the same user or host name independent of the access method. -@vindex password-cache-expiry -@code{password-cache-expiry} sets the duration (in seconds) the -passwords are remembered. Passwords are never saved permanently nor -can they extend beyond the lifetime of the current Emacs session. Set -@code{password-cache-expiry} to @code{nil} to disable expiration. +@vindex auth-source-cache-expiry +@code{auth-source-cache-expiry}@footnote{It overrides +@code{password-cache-expiry}.} sets the duration (in seconds) the +passwords are remembered. Set @code{auth-source-cache-expiry} to +@code{nil} to disable expiration. -@vindex password-cache -Set @code{password-cache} to @code{nil} to disable password caching. +Cached passwords are never saved permanently nor can they extend +beyond the lifetime of the current Emacs session unless you confirm +this interactively. + +@vindex auth-source-do-cache +Set @code{auth-source-do-cache} to @code{nil} to disable password caching. @node Connection caching diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 22b3ef84626..8e98f805234 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -6819,7 +6819,8 @@ Consults the auth-source package." (setq tramp-password-save-function nil) ;; See if auth-sources contains something useful. (ignore-errors - (and (tramp-get-connection-property vec "first-password-request") + (and auth-sources + (tramp-get-connection-property vec "first-password-request") ;; Try with Tramp's current method. If there is no ;; user name, `:create' triggers to ask for. We ;; suppress it. From 90c97d3fac989f3048fda4a30a626bec2c3301c5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 10 Nov 2024 20:49:45 +0200 Subject: [PATCH 04/11] Fix handling of permanent-local variables in 'kill-all-local-variables' The original implementation went too far and caused unexpected results. * src/buffer.c (reset_buffer_local_variables): Second argument is now 'int', and can be 0, 1, or 2. (Fkill_all_local_variables): Call 'reset_buffer_local_variables' with 2nd argument 2 if KILL-PERMANENT is non-nil. (Bug#74091) --- src/buffer.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 744b0ef5548..995984e3e72 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -113,7 +113,7 @@ static int last_per_buffer_idx; static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, bool after, Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3); -static void reset_buffer_local_variables (struct buffer *, bool); +static void reset_buffer_local_variables (struct buffer *, int); /* Alist of all buffer names vs the buffers. This used to be a Lisp-visible variable, but is no longer, to prevent lossage @@ -1112,10 +1112,11 @@ reset_buffer (register struct buffer *b) Instead, use Fkill_all_local_variables. If PERMANENT_TOO, reset permanent buffer-local variables. - If not, preserve those. */ + If not, preserve those. PERMANENT_TOO = 2 means ignore + the permanent-local property of non-builtin variables. */ static void -reset_buffer_local_variables (struct buffer *b, bool permanent_too) +reset_buffer_local_variables (struct buffer *b, int permanent_too) { int offset, i; @@ -1141,7 +1142,7 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too) bset_invisibility_spec (b, Qt); /* Reset all (or most) per-buffer variables to their defaults. */ - if (permanent_too) + if (permanent_too == 1) bset_local_var_alist (b, Qnil); else { @@ -1170,7 +1171,7 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too) swap_in_global_binding (XSYMBOL (sym)); } - if (!NILP (prop)) + if (!NILP (prop) && !permanent_too) { /* If permanent-local, keep it. */ last = tmp; @@ -3001,7 +3002,7 @@ the normal hook `change-major-mode-hook'. */) /* Actually eliminate all local bindings of this buffer. */ - reset_buffer_local_variables (current_buffer, !NILP (kill_permanent)); + reset_buffer_local_variables (current_buffer, !NILP (kill_permanent) ? 2 : 0); /* Force mode-line redisplay. Useful here because all major mode commands call this function. */ From 3496234c8ed10a14f740199722ec727bd43c82d3 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Nov 2024 16:50:36 -0500 Subject: [PATCH 05/11] lisp/files.el (require-with-check): Fix bug#74091. --- lisp/files.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index c3fce9f15f9..898f9d23cf8 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1280,7 +1280,7 @@ NOERROR is equal to `reload'), or otherwise emit a warning." (let* ((fn (locate-file (or filename (symbol-name feature)) load-path (get-load-suffixes) nil )) ;; load-prefer-newer - ;; We used to look for `fn' in `load-history' with `assoc' + ;; We used to look for `fn' in `load-history' with `assoc' ;; which works in most cases, but in some cases (e.g. when ;; `load-prefer-newer' is set) `locate-file' can return a ;; different file than the file that `require' would load, @@ -1288,10 +1288,11 @@ NOERROR is equal to `reload'), or otherwise emit a warning." ;; we did load "it". (bug#74040) ;; So use a "permissive" search which doesn't pay attention to ;; differences between file extensions. - (prefix (if (string-match - (concat (regexp-opt (get-load-suffixes)) "\\'") fn) - (concat (substring fn 0 (match-beginning 0)) ".") - fn)) + (prefix (when fn + (if (string-match + (concat (regexp-opt (get-load-suffixes)) "\\'") fn) + (concat (substring fn 0 (match-beginning 0)) ".") + fn))) (lh load-history)) (while (and lh (let ((file (car-safe (car lh)))) (not (and file (string-prefix-p prefix file))))) From 8afcfed825ae60c8947c41d84b431b21f32b2714 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 13 Nov 2024 11:39:05 -0500 Subject: [PATCH 06/11] * lisp/files.el (require-with-check): Fix last fix (bug#74289) --- lisp/files.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 898f9d23cf8..63a08ce5b22 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1275,7 +1275,7 @@ NOERROR is equal to `reload'), or otherwise emit a warning." (res (require feature filename (if (eq noerror 'reload) nil noerror)))) ;; If the `feature' was not yet provided, `require' just loaded the right ;; file, so we're done. - (when (eq lh load-history) + (when (and res (eq lh load-history)) ;; If `require' did nothing, we need to make sure that was warranted. (let* ((fn (locate-file (or filename (symbol-name feature)) load-path (get-load-suffixes) nil @@ -1288,11 +1288,10 @@ NOERROR is equal to `reload'), or otherwise emit a warning." ;; we did load "it". (bug#74040) ;; So use a "permissive" search which doesn't pay attention to ;; differences between file extensions. - (prefix (when fn - (if (string-match - (concat (regexp-opt (get-load-suffixes)) "\\'") fn) - (concat (substring fn 0 (match-beginning 0)) ".") - fn))) + (prefix (if (string-match + (concat (regexp-opt (get-load-suffixes)) "\\'") fn) + (concat (substring fn 0 (match-beginning 0)) ".") + fn)) (lh load-history)) (while (and lh (let ((file (car-safe (car lh)))) (not (and file (string-prefix-p prefix file))))) From 6bc44ccf287a398d47563ddf60d13784cd64720f Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Mon, 11 Nov 2024 19:45:10 +0100 Subject: [PATCH 07/11] Update 'xref-num-matches-found' when reverting *xref* buffer * lisp/progmodes/xref.el (xref--insert-xrefs): Update 'xref-num-matches-found' here... (xref--show-xref-buffer): ...instead of here (bug#74313). --- lisp/progmodes/xref.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 5ecb8664da0..125616398f0 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1140,6 +1140,7 @@ XREF-ALIST is of the form ((GROUP . (XREF ...)) ...), where GROUP is a string for decoration purposes and XREF is an `xref-item' object." (require 'compile) ; For the compilation faces. + (setq xref-num-matches-found 0) (cl-loop for (group . xrefs) in xref-alist for max-line = (cl-loop for xref in xrefs maximize (xref-location-line @@ -1159,6 +1160,7 @@ GROUP is a string for decoration purposes and XREF is an (xref--insert-propertized '(face xref-file-header xref-group t) group "\n") (dolist (xref xrefs) + (cl-incf xref-num-matches-found) (pcase-let (((cl-struct xref-item summary location) xref)) (let* ((line (xref-location-line location)) (prefix @@ -1248,7 +1250,6 @@ Return an alist of the form ((GROUP . (XREF ...)) ...)." (xref--ensure-default-directory dd (current-buffer)) (xref--xref-buffer-mode) (xref--show-common-initialize xref-alist fetcher alist) - (setq xref-num-matches-found (length xrefs)) (setq mode-line-process (list xref-mode-line-matches)) (pop-to-buffer (current-buffer)) (setq buf (current-buffer))) From d592832504554c6ee30bea263e55dc84feaec18d Mon Sep 17 00:00:00 2001 From: john muhl Date: Sun, 10 Nov 2024 11:26:33 -0600 Subject: [PATCH 08/11] Improve comment indenting in 'lua-ts-mode' * lisp/progmodes/lua-ts-mode.el (lua-ts--simple-indent-rules): Align single line comments with the surrounding context. (lua-ts--comment-first-sibling-matcher): Check that comment is the first sibling. (lua-ts--multi-line-comment-start): New function. * test/lisp/progmodes/lua-ts-mode-resources/indent.erts: Add tests. (Bug#74298) --- lisp/progmodes/lua-ts-mode.el | 17 ++++++-- .../lua-ts-mode-resources/indent.erts | 42 +++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 4ea453c9b65..836a62b2dac 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -289,7 +289,8 @@ values of OVERRIDE." (defvar lua-ts--simple-indent-rules `((lua - ((or (node-is "comment") + ((or (and (node-is "comment") (parent-is "chunk")) + lua-ts--multi-line-comment-start (parent-is "comment_content") (parent-is "string_content") (node-is "]]")) @@ -473,9 +474,10 @@ values of OVERRIDE." (= 1 (length (cadr sparse-tree))))) (defun lua-ts--comment-first-sibling-matcher (node &rest _) - "Matches if NODE if it's previous sibling is a comment." + "Matches NODE if its previous sibling is a comment." (let ((sibling (treesit-node-prev-sibling node))) - (equal "comment" (treesit-node-type sibling)))) + (and (= 0 (treesit-node-index sibling t)) + (equal "comment" (treesit-node-type sibling))))) (defun lua-ts--top-level-function-call-matcher (node &rest _) "Matches if NODE is within a top-level function call." @@ -508,6 +510,15 @@ values of OVERRIDE." (line-beginning-position)) (point)))) +(defun lua-ts--multi-line-comment-start (node &rest _) + "Matches if NODE is the beginning of a multi-line comment." + (and node + (equal "comment" (treesit-node-type node)) + (save-excursion + (goto-char (treesit-node-start node)) + (forward-char 2) ; Skip the -- part. + (looking-at "\\[\\[")))) + (defvar lua-ts--syntax-table (let ((table (make-syntax-table))) (modify-syntax-entry ?+ "." table) diff --git a/test/lisp/progmodes/lua-ts-mode-resources/indent.erts b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts index ba7bad1b452..b0ece4cc261 100644 --- a/test/lisp/progmodes/lua-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts @@ -360,6 +360,10 @@ multi-line ]] return true end + + --[[ +Long comment. + ]] =-= --[[ Multi-line @@ -373,6 +377,44 @@ multi-line ]] return true end + + --[[ +Long comment. + ]] +=-=-= + +Name: Comment Indent + +=-= +local fn1 = function (a, b) +-- comment +return a + b +end + +local tb1 = { + first = 1, +-- comment + second = 2, +} + +local tb9 = { one = 1, +-- comment + two = 2 } +=-= +local fn1 = function (a, b) + -- comment + return a + b +end + +local tb1 = { + first = 1, + -- comment + second = 2, +} + +local tb9 = { one = 1, + -- comment + two = 2 } =-=-= Name: Argument Indent From a0613372a7bbc19f87f19c49153eca262eb750c1 Mon Sep 17 00:00:00 2001 From: Andrew De Angelis Date: Sun, 10 Nov 2024 10:13:17 -0500 Subject: [PATCH 09/11] ; Update the xwidgets-on-NS text due to fixing bug#60703 * etc/TODO: Update the xwidgets-on-NS text (bug#74295). --- etc/TODO | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/etc/TODO b/etc/TODO index 21c85216964..b60e1198a0a 100644 --- a/etc/TODO +++ b/etc/TODO @@ -943,13 +943,13 @@ This sections contains features found in other official Emacs ports. Emacs 25 has support for xwidgets, a system to include WebKit widgets into an Emacs buffer. -They work on NS, but not very well. For example, trying to display a -xwidget in the "killed" state will make Emacs crash. This is because -the NS code has not been updated to keep with recent changes to the -X11 and GTK code. +They work on NS, but not very well. This is because the NS code has +not been updated to keep with recent changes to the X11 and GTK code. -Many features such as xwidget-webkit-edit-mode do not work correctly -on NS either. +Many features do not work correctly on NS, such as: + - xwidget-webkit-edit-mode + - xwidget-webkit-isearch-mode + - xwidget-webkit-browse-history. **** Respect 'frame-inhibit-implied-resize' When the variable 'frame-inhibit-implied-resize' is non-nil, frames From 27aacbd172f3b94926073250ef81a226616d1e45 Mon Sep 17 00:00:00 2001 From: john muhl Date: Sat, 9 Nov 2024 11:01:45 -0600 Subject: [PATCH 10/11] Fix some 'lua-ts-mode' options (Bug#74235) * lisp/progmodes/lua-ts-mode.el (lua-ts-luacheck-program): (lua-ts-inferior-program): Switch to 'file' type and remove 'nil' as a choice. (lua-ts-inferior-lua): Ensure 'lua-ts-inferior-program' is set. --- lisp/progmodes/lua-ts-mode.el | 84 ++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 836a62b2dac..e5a2fafd279 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -72,7 +72,7 @@ (defcustom lua-ts-luacheck-program "luacheck" "Location of the Luacheck program." - :type '(choice (const :tag "None" nil) string) + :type 'file :version "30.1") (defcustom lua-ts-inferior-buffer "*Lua*" @@ -83,7 +83,7 @@ (defcustom lua-ts-inferior-program "lua" "Program to run in the inferior Lua process." - :type '(choice (const :tag "None" nil) string) + :type 'file :version "30.1") (defcustom lua-ts-inferior-options '("-i") @@ -643,47 +643,49 @@ Calls REPORT-FN directly." (defun lua-ts-inferior-lua () "Run a Lua interpreter in an inferior process." (interactive) - (unless (comint-check-proc lua-ts-inferior-buffer) - (apply #'make-comint-in-buffer - (string-replace "*" "" lua-ts-inferior-buffer) - lua-ts-inferior-buffer - lua-ts-inferior-program - lua-ts-inferior-startfile - lua-ts-inferior-options) - (when lua-ts-inferior-history + (if (not lua-ts-inferior-program) + (user-error "You must set `lua-ts-inferior-program' to use this command") + (unless (comint-check-proc lua-ts-inferior-buffer) + (apply #'make-comint-in-buffer + (string-replace "*" "" lua-ts-inferior-buffer) + lua-ts-inferior-buffer + lua-ts-inferior-program + lua-ts-inferior-startfile + lua-ts-inferior-options) + (when lua-ts-inferior-history (set-process-sentinel (get-buffer-process lua-ts-inferior-buffer) 'lua-ts-inferior--write-history)) - (with-current-buffer lua-ts-inferior-buffer - (setq-local comint-input-ignoredups t - comint-input-ring-file-name lua-ts-inferior-history - comint-prompt-read-only t - comint-prompt-regexp (rx-to-string `(: bol - ,lua-ts-inferior-prompt - (1+ space)))) - (comint-read-input-ring t) - (add-hook 'comint-preoutput-filter-functions - (lambda (string) - (if (equal string (concat lua-ts-inferior-prompt-continue " ")) - string - (concat - ;; Filter out the extra prompt characters that - ;; accumulate in the output when sending regions - ;; to the inferior process. - (replace-regexp-in-string (rx-to-string - `(: bol - (* ,lua-ts-inferior-prompt - (? ,lua-ts-inferior-prompt) - (1+ space)) - (group (* nonl)))) - "\\1" string) - ;; Re-add the prompt for the next line. - lua-ts-inferior-prompt " "))) - nil t))) - (select-window (display-buffer lua-ts-inferior-buffer - '((display-buffer-reuse-window - display-buffer-pop-up-window) - (reusable-frames . t)))) - (get-buffer-process (current-buffer))) + (with-current-buffer lua-ts-inferior-buffer + (setq-local comint-input-ignoredups t + comint-input-ring-file-name lua-ts-inferior-history + comint-prompt-read-only t + comint-prompt-regexp (rx-to-string `(: bol + ,lua-ts-inferior-prompt + (1+ space)))) + (comint-read-input-ring t) + (add-hook 'comint-preoutput-filter-functions + (lambda (string) + (if (equal string (concat lua-ts-inferior-prompt-continue " ")) + string + (concat + ;; Filter out the extra prompt characters that + ;; accumulate in the output when sending regions + ;; to the inferior process. + (replace-regexp-in-string + (rx-to-string `(: bol + (* ,lua-ts-inferior-prompt + (? ,lua-ts-inferior-prompt) + (1+ space)) + (group (* nonl)))) + "\\1" string) + ;; Re-add the prompt for the next line. + lua-ts-inferior-prompt " "))) + nil t))) + (select-window (display-buffer lua-ts-inferior-buffer + '((display-buffer-reuse-window + display-buffer-pop-up-window) + (reusable-frames . t)))) + (get-buffer-process (current-buffer)))) (defun lua-ts-send-buffer () "Send current buffer to the inferior Lua process." From f69f54c454eb3c0f8ff8c55cfd2b7832ea1709cf Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Thu, 7 Nov 2024 12:55:50 +0100 Subject: [PATCH 11/11] Improve font-locking and indentation in 'php-ts-mode' * lisp/progmodes/php-ts-mode.el (php-ts-mode--language-source-alist): Updated to latest version of PHP grammar. (php-ts-mode--indent-styles): 'namespace_use_declaration' is now correctly indented. (php-ts-mode--operators): Support of the "argument unpacking operator". (php-ts-mode--font-lock-settings): 'nullsafe_member_call_expression' is now highlighted correctly. (php-ts-mode--comment-indent-new-line): Delete trailing whitespace before inserting newline (see bug#73900 for more information). Bug#74239 --- lisp/progmodes/php-ts-mode.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index 14a487d3f7a..d8a3f60508b 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -84,7 +84,7 @@ ;;; Install treesitter language parsers (defvar php-ts-mode--language-source-alist - '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.4" "php/src")) + '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.23.5" "php/src")) (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc")) (html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.23.0")) (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.23.0")) @@ -640,6 +640,7 @@ characters of the current line." ((query "(class_interface_clause (qualified_name) @indent)") parent-bol php-ts-mode-indent-offset) ((parent-is "class_declaration") parent-bol 0) + ((parent-is "namespace_use_declaration") parent-bol php-ts-mode-indent-offset) ((parent-is "namespace_use_group") parent-bol php-ts-mode-indent-offset) ((parent-is "function_definition") parent-bol 0) ((parent-is "member_call_expression") first-sibling php-ts-mode-indent-offset) @@ -781,7 +782,7 @@ characters of the current line." '("--" "**=" "*=" "/=" "%=" "+=" "-=" ".=" "<<=" ">>=" "&=" "^=" "|=" "??" "??=" "||" "&&" "|" "^" "&" "==" "!=" "<>" "===" "!==" "<" ">" "<=" ">=" "<=>" "<<" ">>" "+" "-" "." "*" "**" "/" "%" - "->" "?->") + "->" "?->" "...") "PHP operators for tree-sitter font-locking.") (defconst php-ts-mode--predefined-constant @@ -993,7 +994,7 @@ characters of the current line." (member_call_expression name: (_) @font-lock-function-call-face) (nullsafe_member_call_expression - name: (_) @font-lock-constant-face)) + name: (_) @font-lock-function-call-face)) :language 'php :feature 'argument @@ -1266,8 +1267,14 @@ less common PHP-style # comment. SOFT works the same as in (line-end-position) t nil)) (let ((offset (- (match-beginning 0) (line-beginning-position))) - (comment-prefix (match-string 0))) - (if soft (insert-and-inherit ?\n) (newline 1)) + (comment-prefix (match-string 0)) + (insert-line-break + (lambda () + (delete-horizontal-space) + (if soft + (insert-and-inherit ?\n) + (newline 1))))) + (funcall insert-line-break) (delete-region (line-beginning-position) (point)) (insert (make-string offset ?\s)