From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71380: 30.0.50; Submitting php-ts-mode, new major mode for php Date: Fri, 07 Jun 2024 08:53:04 -0400 Message-ID: References: <3686989.dWV9SEqChM@3-191.divsi.unimi.it> <2169161.yiUUSuA9gR@3-191.divsi.unimi.it> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11775"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 71380@debbugs.gnu.org To: Vincenzo Pupillo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 07 15:02:17 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sFZEW-0002oj-Dq for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Jun 2024 15:02:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFZE6-0007zG-Iu; Fri, 07 Jun 2024 09:01:50 -0400 Original-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 1sFZE3-0007z4-CU for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 09:01:48 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sFZE3-0005Iz-4H for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 09:01:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFZEH-0005LU-Sl for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 09:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Jun 2024 13:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71380 X-GNU-PR-Package: emacs Original-Received: via spool by 71380-submit@debbugs.gnu.org id=B71380.171776531120514 (code B ref 71380); Fri, 07 Jun 2024 13:02:01 +0000 Original-Received: (at 71380) by debbugs.gnu.org; 7 Jun 2024 13:01:51 +0000 Original-Received: from localhost ([127.0.0.1]:55414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFZE6-0005Km-VT for submit@debbugs.gnu.org; Fri, 07 Jun 2024 09:01:51 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53220) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFZE3-0005KH-34 for 71380@debbugs.gnu.org; Fri, 07 Jun 2024 09:01:48 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AE2AE100043; Fri, 7 Jun 2024 08:53:10 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1717764785; bh=/CodmWGmoxiwXjTYjv+T2yQHl+5Gh+EEzJIaw3CW0ao=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=DBbdDF1Z25Rvj/qRiYTjSPcnnKecyIez0bEWctYUsVl6TKs2tQcLGPRekfc5sRZ+u 8KFqxFqsTU3IYFzqsv8JzajmJwcIZjSij6C+uxI+G8sypfbro0bDh42QawyXu12WMF d8/qKOq1lLq9XgFU+byb74JYXhHyqE4tBjYErNPcweB7TQUQ5W3QPq67QG3tQfrKx6 +1RFpKmmmUFM1ctNnek3smxfAWu6d/EPWkUuD5UrY+gknWTWWJZxKNklWL8Xecqpdu HpDKsvTC4q8M/GouE9KKGKnene2o0UZy3EjLY+OAmhzLPtPfDzfD9IZAJ24DzgId/c 5o3W1Hn8jklVA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3908D10002E; Fri, 7 Jun 2024 08:53:05 -0400 (EDT) Original-Received: from pastel (unknown [24.140.236.196]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1191A12026C; Fri, 7 Jun 2024 08:53:05 -0400 (EDT) In-Reply-To: <2169161.yiUUSuA9gR@3-191.divsi.unimi.it> (Vincenzo Pupillo's message of "Fri, 07 Jun 2024 11:04:00 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:286766 Archived-At: >> (dolist (buffer (buffer-list)) >> (with-current-buffer buffer >> (when (derived-mode-p 'php-ts-mode) >> (php-ts-mode-set-style val)))) >> >> ? > Yes is better. The code above is a copy of c-ts-mode--indent-style-setter. > It seemed too complicated to me too, but since it had been used there > I thought there was some reason. Aha! Thanks, I guess we should check the `c-ts-mode--indent-style-setter` situation, as well, then. >> > +(defvar php-ts-mode--syntax-table >> > + (let ((table (make-syntax-table))) >> > + ;; Taken from the cc-langs version >> >> Does this mean it comes from "the cc-mode-based `php-mode.el`" or from >> `cc-langs.el` (and if so, which part, exactly)? >> >> > +;; taken from c-ts-mode >> [...] >> > +;; taken from c-ts-mode >> >> Are these literal copies? >> Maybe we should consolidate the code with that of `c-ts-mode` to avoid >> the code duplication? >> > Yes, the first part is a literal copy of c-ts-mode--syntax-table. > java-ts-mode does exactly the same thing, so I thought it best > to avoid depending on c-ts-mode--syntax-table. Hmm... that makes the comment hard to understand. >> > + (cond >> > + ((equal comment-start "/*") (setq-local comment-end "*/")) >> > + ((equal comment-start "//") (setq-local comment-end "")) >> > + ((equal comment-start "#") (setq-local comment-end "")) >> > + ((equal comment-start "/**") (setq-local comment-end "*/"))) >> > + (setq mode-name (concat "PHP" (string-trim-right comment-start))) >> > + (force-mode-line-update)) >> Is `comment-start` important enough to merit being part of the mode name? > Sorry. I didn't understand. Could you please clarify? You have: (setq mode-name (concat "PHP" (string-trim-right comment-start))) which means the mode-line will display `comment-start` (along with the usual other things). Is it really a good idea, given how the mode-line is already often "too full"? Which other major mode does that? What's special about `comment-start` to make it deserve this honor? Stefan