From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 11 11:36:28 2025 Received: (at submit) by debbugs.gnu.org; 11 Jul 2025 15:36:28 +0000 Received: from localhost ([127.0.0.1]:38661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uaFnY-00058Z-4z for submit@debbugs.gnu.org; Fri, 11 Jul 2025 11:36:28 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43008) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uaFnW-00056n-1N for submit@debbugs.gnu.org; Fri, 11 Jul 2025 11:36:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uaFmv-0006aJ-DU for bug-gnu-emacs@gnu.org; Fri, 11 Jul 2025 11:35:54 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uaFmq-0007Ny-04 for bug-gnu-emacs@gnu.org; Fri, 11 Jul 2025 11:35:49 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3a6d1369d4eso1355736f8f.2 for ; Fri, 11 Jul 2025 08:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752248141; x=1752852941; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=MamqfcbMQx0xcSYRJa+ce+jhiX9JJ2RgAE+p+CGU8Ig=; b=TbU7mPCdWDpKqOEu9ihYfz7cC5NCUxjrypqxy1JNTvMf6oJ3W00tXls4s8wLsdtSyX v5rsUTsTarpszXWo1Uw23+Yc8ozVrhMV1eGKXftfQszRaXw7ReSS6TqASLViRHJ642yC wB5rRF8gWuSIqfY+3tJeNk9JtTU2/9y9ttZNL/chNhA94jtzAvCv+JpQ62GvfmzO4dLG EUYqDuNL1vYB8nRAzAiHhuZ7DuRsN6WmUF71YQmSuxB/hksaXys9L2ltIeoJBAC2nlrF okok4U7VBFfulOSEOagmYMA8m7zq66cMRw+zmmXjmdGxmOgdiDle5Hpdj+UYtE8+OG5c VGEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752248141; x=1752852941; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MamqfcbMQx0xcSYRJa+ce+jhiX9JJ2RgAE+p+CGU8Ig=; b=gmdLrq8WeK1fi1R/UXcEsR1/FzlUgKuietT1TcimTpL0W3B2b7U1xf0pe1acjkRx0O zipT6aRYqaPzaNBX7g8jSeCyYCQFVXOJ8xxNUsP/6C+8xJvQmlPtrZ/3EhICPkvOIxu+ aF6qE9OvB1Dn6+qoI/MSTIvudAbWwjPPOgETZezcqY1WnLK9yFT+93yShAbxr2mlo1jP ssavaxMkFpTppQBE7WInWczb2A1c6ZxgdPVzIvmC7oykDcChZFoeNf96xNXKuD1yUA0J pp5cYPmi12YQbu/xzz5F+3qL2A0iFWifyXykhV+3f2eJ7SPQZzWpBZ/gcBIs9JhNW51H hYyw== X-Gm-Message-State: AOJu0YzS/1G9T0SQDUI0+IVQU5eyzDTbfY/+WZmiMa0LVAn+g8IgPYr1 cDTys132WYzve4eHTJ4dPB3cNln91W9+SyiLXwkmLmEhCgrtymqWlUAHSwJ1h4nX X-Gm-Gg: ASbGncuG4ZzZ0ah0kDMZybfuJ0y2JhUgIJij5syVJ/LhEDr/y9+R51F0R+FTIh3Dh9C Nq/j9G+RC2r9jycOeJTGVYZqtnesC66IhYt/aR65MWRXawRMNkjKmYO22C3ip/seW4j2hph00zw Bq6KeyNZv3VWy43bigPUkeag12yWLKBDx8tdtY7WMEAfnZ7SMBdTKu1cGBqs7YlTVwlgJHrG7G0 4gJsm9qQJMRUzLn+fjTl7q+CdAxM8y+1Ob8kFl++hlcCK9Q7vwUcHPZkdRy80iGFWhVHC1MiVwO AzJMcLEz96ryqX2tLxAXzzjiL/E7mIFopysrM/cB7mPQyO8Rdgzdj5eTcCLTwgg1R/covh7JpQ4 AzLj3RoCkw0xDXers50QcaIEiHwdZx9LjT2nwVyf7Qt/DLCmneeQ= X-Google-Smtp-Source: AGHT+IFGg8PsRMbaLQ6He/OS+6jRZMRemAeM94lVAOO07NVamwIJ8N0X5ms7CEgMUnQEVwdvJqOpQA== X-Received: by 2002:a5d:6f1d:0:b0:3a5:2d42:aa25 with SMTP id ffacd0b85a97d-3b5f3591712mr2569471f8f.50.1752248140670; Fri, 11 Jul 2025 08:35:40 -0700 (PDT) Received: from 3-191.divsi.unimi.it (3-191.divsi.unimi.it. [159.149.3.191]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b5e8dc21fdsm4756973f8f.33.2025.07.11.08.35.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jul 2025 08:35:40 -0700 (PDT) From: Vincenzo Pupillo To: bug-gnu-emacs@gnu.org Subject: 31.0.50; [PATCH] php-ts-mode: `php-ts-mode' depends on `mhtml-ts-mode' instead of JS,CSS and HTML. Date: Fri, 11 Jul 2025 17:35:38 +0200 Message-ID: <2555753.XAFRqVoOGU@3-191.divsi.unimi.it> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3633016.dWV9SEqChM" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=v.pupillo@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" This is a multi-part message in MIME format. --nextPart3633016.dWV9SEqChM Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Ciao, this patch replaces the dependency on {js,css,html}-ts-mode with the=20 dependency on =E2=80=98mhtml-ts-mode=E2=80=99.=20 Code maintenance should now be easier.=20 Additional benefits are: 1. Imenu now exposes symbols for all of all languages, 2. navigation now works correctly for all languages, 3. outline works for all languages. Additional new features are: 1. indentation of PHP in mixed buffers with HTML now works much better and= =20 allows three different behaviors, an option allows you to choose the behavi= or. 2. a new feature shows where PHP ini files are both locally and remotely, i= f=20 the buffer is associated with a remote PHP file. The patch is a little long, but I hope it's okay. Thank you. Vincenzo --nextPart3633016.dWV9SEqChM Content-Disposition: attachment; filename="0001-php-ts-mode-depends-on-mhtml-ts-mode-instead-of-JS-C.patch" Content-Transfer-Encoding: quoted-printable Content-Type: text/x-patch; charset="UTF-8"; name="0001-php-ts-mode-depends-on-mhtml-ts-mode-instead-of-JS-C.patch" =46rom 2b2f3c022f2096b112fc4a600f24200eed0ab1e0 Mon Sep 17 00:00:00 2001 =46rom: Vincenzo Pupillo Date: Thu, 10 Jul 2025 17:20:34 +0200 Subject: [PATCH] `php-ts-mode' depends on `mhtml-ts-mode' instead of JS,CSS and HTML. MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit The direct dependence on js-ts-mode, css-ts-mode and html-ts-mode has now been replaced by =E2=80=98mhtml-ts-mode=E2=80=99. Additional benefits are: 1. Imenu now exposes symbols for all of all languages, 2. navigation now works correctly for all languages, 3. outline works for all languages. Additional new features are: 1. indentation of PHP in mixed buffers with HTML now works much better and allows three different behaviors, an option allows you to choose the behavior. 2. a new feature shows where PHP ini files are both locally and remotely, if the buffer is associated with a remote PHP file. * etc/NEWS: Mention new command and options. * lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode--range-settings): New variable that store range settings. (mhtml-ts-mode--treesit-aggregated-outline-predicate): New variable that store outline predicates. (mhtml-ts-mode): Use those two new variables. * lisp/progmodes/php-ts-mode.el Update doc string. Removed old dependecies. (php-ts-mode--language-source-alist): Updated parsers version. (php-ts-mode-install-parsers): Removed old dependencies, now relies on (mhtml-ts-mode-install-parsers). Update doc string. (php-ts-mode-js-css-indent-offset): Update doc string. (php-ts-mode-css-fontify-colors): Removed option, now relies on 'php-ts-mode-css-fontify-colors'. (php-ts-mode-html-indent-offset): New user option. (php-ts-mode-html-relative-indent): New user option. (php-ts-mode-php-default-executable): Assume \"php\" instead of \"/usr/bin/php\" if 'executable-find' fails. (php-ts-mode-php-config): Fix tag. (php-ts-mode-find-sibling-rules): New user option with the rules for finding siblings of a file. (php-ts-mode-phpdoc-highlight-errors): New user option, if non-nil highlight unkown PHPDOC nodes. (php-ts-mode--indent-style-setter): Indentation fix. (php-ts-mode-indent-style): Indentation fix. (php-ts-mode-flymake-php): Indentation fix. (php-ts-mode--executable): Indentation fix. (php-ts-mode-show-ini): New command that show the locations of PHP ini files. (php-ts-mode--get-indent-style): Indentation fix. (php-ts-mode--set-indent-property): Indentation fix. (php-ts-mode-set-style): Indentation fix. (php-ts-mode--get-parser-ranges): Indentation fix. (php-ts-mode--possibly-braceless-keyword-re): Removed no longer used constant. (php-ts-mode--open-statement-group-heuristic): Removed no longer used function. (php-ts-mode--else-heuristic): Indentation fix. (php-ts-mode--first-sibling): Indentation fix. (php-ts-mode--js-css-tag-bol): Function removed, now using 'mhtml-ts-mode--js-css-tag-bol'. (php-ts-mode--parent-html-bol): Removed no longer used function. (php-ts-mode--parent-html-heuristic): Now more reliably handles the mixed indentation of PHP and HTML. The new option 'php-ts-mode-html-relative-indent' changes the behavior of the function. When 'php-ts-mode-html-relative-indent' is 't' the new option 'php-ts-mode-html-indent-offset' controls the offset of PHP code relative to HTML tags. (php-ts-mode--array-element-heuristic): Indentation fix. (php-ts-mode--anchor-prev-sibling): Indentation fix.. (php-ts-mode--indent-styles): The indentation rules for =E2=80=98program=E2= =80=99 and =E2=80=98text_interpolation=E2=80=99 are now common to all indentation styl= es, thanks to the new version of =E2=80=98php-ts-mode-arent-html-heuristic=E2=80=99. New rules for 'namespace_use_clause', 'use_declaration', 'use_list', 'attribute_group' and 'string_content'. (php-ts-mode--prettify-symbols-alist): New variable to support 'prettify-symbols-alist'. (php-ts-mode--test-visibility-modifier-operation-clause-p): Rename ... (php-ts-mode--test-visibility-modifier-operation-p): ... to this more correct name. (php-ts-mode--test-property-hook-clause-p): Rename ... (php-ts-mode--test-property-hook-p): ... to this more correct name. (php-ts-mode--test-relative-name-p): New function to test if 'relative_name' is supported by the PHP parser. (php-ts-mode--font-lock-settings): Use the new function for highlight 'relative_name'. Highlight 'error_suppression_expression'. Refactoring using the renamed functions. Indentation fix. (php-ts-mode--custom-html-font-lock-settings): Replace the rules with 'mhtml-ts-mode--treesit-font-lock-settings'. Fix docs string. (php-ts-mode--phpdoc-font-lock-settings): Added support for "array" and "list" array_type. New =E2=80=9Cphpdoc-error=E2=80=9D feature to highlight = unknown nodes via new =E2=80=98php-ts-mode--phpdoc-fontify-error=E2=80=99 function. (php-ts-mode--colorize-css-value): Removed function no longer used, now highlighting is handled directly by 'mhtml-ts-mode'. (php-ts-mode--phpdoc-fontify-error): New function used by 'php-ts-mode--phpdoc-font-lock-settings'. (php-ts-mode--parent-object): Indentation fix. (php-ts-mode--defun-name-separator): Indentation fix. (php-ts-mode--defun-object-name): Indentation fix. (php-ts-mode--defun-name): The function now also returns the defun name of 'mhtml-ts-mode'. (php-ts-mode--treesit-defun-type-regexp): New regexp for 'treesit-defun-type-regexp' support. (php-ts-mode--indent-defun): Indentation fix. (php-ts-mode--defun-valid-p): Fix indentation (php-ts-mode--comment-indent-new-line): Indentation fix. (php-ts-mode--comment-current-plist): New local variable that stores the st= ate of the PHP comment style. (php-ts-mode--comment-setup): The function now handles changing, for different languages, comment styles, using =E2=80=9Cphp-ts-mode--comment-current-plist=E2=80=9D to store and retrieve = the comment style for the PHP language. (php-ts-mode-comment-setup): Now store the PHP comment style in 'php-ts-mode--comment-current-plist'. (php-ts-mode-menu): Indentation fix. (php-ts-mode): Replace dependency from JS, CSS and HTML width 'mhtml-ts-mode'. Navigation, Imenu and Outline now support PHP, HTML, Javascript and CSS. Added support for 'prettify-symbol-mode'. Added support for 'electric-layout-rules'. (php-ts-mode-run-php-webserver) (php-ts-mode--webserver-read-args) (php-ts-mode--webserver-read-args) (inferior-php-ts-mode) (run-php) (inferior-php-ts-mode-startup) (php-ts-mode-inferior--write-history) (php-ts-mode-send-region): Indentation fix. =2D-- etc/NEWS | 28 + lisp/progmodes/php-ts-mode.el | 1614 ++++++++++++++++--------------- lisp/textmodes/mhtml-ts-mode.el | 78 +- 3 files changed, 914 insertions(+), 806 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index f4e64c0851f..3279387a4b1 100644 =2D-- a/etc/NEWS +++ b/etc/NEWS @@ -855,6 +855,34 @@ the built-in Web server. Interactively, when invoked = with a prefix argument, 'php-ts-mode-run-php-webserver' prompts for the config file as well as for other connection parameters. =20 +--- +*** The option 'php-ts-mode-css-fontify-colors' has been removed. +'mhtml-ts-mode-css-fontify-colors' replace this option. + +--- +*** New user option 'php-ts-mode-html-relative-indent'. +In buffers containing both PHP and HTML, this option allows you to +define how the PHP code should be indented relative to the position of +the HTML tags. + +--- +*** New user option 'php-ts-mode-html-indent-offset'. +Offset of PHP code block relative to HTML tags. + +--- +*** New user option 'php-ts-mode-find-sibling-rules'. +Rules for finding siblings of a PHP files. + +--- +*** New user option 'php-ts-mode-phpdoc-highlight-errors'. +When not null, it highlights unknown PHPDOC tags using +=E2=80=98font-lock-warning-face=E2=80=99 so that the user can identify the= m more easily. + +--- +*** New command 'php-ts-mode-show-ini' to show where are located the ini f= iles. +Show the location of the PHP ini files, if the buffer is associated to a r= emote +PHP file show the remote PHP ini files. + ** Rust-ts mode =20 --- diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index a01e4d66fba..04b59f062f3 100644 =2D-- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -25,12 +25,12 @@ ;;; Tree-sitter language versions ;; ;; php-ts-mode has been tested with the following grammars and version: =2D;; - tree-sitter-phpdoc: v0.1.5 +;; - tree-sitter-phpdoc: v0.1.6 ;; - tree-sitter-css: v0.23.1-1-g6a442a3 ;; - tree-sitter-jsdoc: v0.23.2 ;; - tree-sitter-javascript: v0.23.1-2-g108b2d4 ;; - tree-sitter-html: v0.23.2-1-gd9219ad =2D;; - tree-sitter-php: v0.23.11 +;; - tree-sitter-php: v0.23.12 ;; ;; We try our best to make builtin modes work with latest grammar ;; versions, so a more recent grammar has a good chance to work too. @@ -42,7 +42,7 @@ ;; for editing PHP files with embedded HTML, JavaScript, CSS and phpdoc. ;; Tree Sitter is used to parse each of these languages. ;; =2D;; Please note that this package requires `html-ts-mode', which +;; Please note that this package requires `mhtml-ts-mode', which ;; registers itself as the major mode for editing HTML. ;; ;; This package is compatible and has been tested with the following @@ -69,9 +69,7 @@ =20 (require 'treesit) (require 'c-ts-common) ;; For comment indent and filling. =2D(require 'html-ts-mode) ;; for embed html =2D(require 'css-mode) ;; for embed css into html =2D(require 'js) ;; for embed javascript into html +(require 'mhtml-ts-mode) ;; For embed html, css and js. (require 'comint) (treesit-declare-unavailable-functions) =20 @@ -83,10 +81,10 @@ ;;; Install treesitter language parsers (defvar php-ts-mode--language-source-alist '((php "https://github.com/tree-sitter/tree-sitter-php" =2D :commit "43aad2b9a98aa8e603ea0cf5bb630728a5591ad8" =2D :source-dir "php/src") + :commit "f7cf7348737d8cff1b13407a0bfedce02ee7b046" + :source-dir "php/src") (phpdoc "https://github.com/claytonrcarter/tree-sitter-phpdoc" =2D :commit "fe3202e468bc17332bec8969f2b50ff1f1da3a46")) + :commit "03bb10330704b0b371b044e937d5cc7cd40b4999")) "Treesitter language parsers required by `php-ts-mode'. You can customize `treesit-language-source-alist' if you want to stick to a specific commit and/or use different parsers.") @@ -97,9 +95,10 @@ php-ts-mode--language-source-alist (defun php-ts-mode-install-parsers () "Install all the required treesitter parsers. `treesit-language-source-alist' defines which parsers to install. =2DIt's pre-filled by loading \"html-ts-mode\", \"css-mode\", \"js\"." +It's pre-filled by loading \"mhtml-ts-mode\"." (interactive) =2D (dolist (lang '(php phpdoc html css javascript jsdoc)) + (mhtml-ts-mode-install-parsers) + (dolist (lang '(php phpdoc)) (treesit-install-language-grammar lang))) =20 ;;; Custom variables @@ -118,25 +117,58 @@ php-ts-mode-indent-offset =20 (defcustom php-ts-mode-js-css-indent-offset 2 "JavaScript and CSS indent spaces related to the