From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vincenzo Pupillo Newsgroups: gmane.emacs.bugs Subject: bug#71380: 30.0.50; Submitting php-ts-mode, new major mode for php Date: Fri, 07 Jun 2024 15:25:16 +0200 Message-ID: <2068418.YKUYFuaPT4@3-191.divsi.unimi.it> References: <3686989.dWV9SEqChM@3-191.divsi.unimi.it> <2169161.yiUUSuA9gR@3-191.divsi.unimi.it> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27382"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71380@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 07 15:34:11 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 1sFZjP-0006zb-6n for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 Jun 2024 15:34:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFZj5-0006Xo-Rm; Fri, 07 Jun 2024 09:33:51 -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 1sFZj2-0006XI-0a for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 09:33: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 1sFZj1-0004As-6S for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 09:33:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFZjG-0006ta-Az for bug-gnu-emacs@gnu.org; Fri, 07 Jun 2024 09:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Jun 2024 13:34:02 +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.171776719526380 (code B ref 71380); Fri, 07 Jun 2024 13:34:02 +0000 Original-Received: (at 71380) by debbugs.gnu.org; 7 Jun 2024 13:33:15 +0000 Original-Received: from localhost ([127.0.0.1]:57297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFZiU-0006rL-G9 for submit@debbugs.gnu.org; Fri, 07 Jun 2024 09:33:15 -0400 Original-Received: from mail-wr1-f43.google.com ([209.85.221.43]:46403) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFZiS-0006r0-0b for 71380@debbugs.gnu.org; Fri, 07 Jun 2024 09:33:12 -0400 Original-Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-35dcff36522so2044298f8f.1 for <71380@debbugs.gnu.org>; Fri, 07 Jun 2024 06:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717767111; x=1718371911; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RE49eK+N7kPD1BZWKVrWaeS9zifa309en7QLZ7Dz2mA=; b=OMnoJhT2z30jhcJB0KIiBUoddMNb5VV51HlkS9x6Db3t/G6UO8/uSZqGJJcMV0DiuK /FVaNF15qvkVenJEfBESPi4epC53AExAk8ItwFkxX3nksUsyd7xOBFY+9yuNrcjsZV6n PS8bu+KAptouppr9vzVmhkvnwN/BPE4566/eSegO/JidPURRKFhbvDzzarWwk6YNTVrv KpGe3xLEv/z3Zlzonvl7BTIUGqtc7EpCrVUc90weAvan7sRQvGV2d8JgzlGn1Q6CoxDt FhCPJ1oh+JMCMSnuPMoNdqYVQmL5+a8Nef+18p5n1uHmmhsp9FDFDv3q22LIDKn7ONdK uwfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717767111; x=1718371911; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RE49eK+N7kPD1BZWKVrWaeS9zifa309en7QLZ7Dz2mA=; b=pO2KJStz4ykETyN+QNDyCoXLldw9WFP/OYgpBf0kvfZGE7/XnrsQVT34rN2Q5D0TDw yUy5yOwhHDuSUC2VkoUQc1iucxX9K8rD1jM0ge5vSjrWHkMFDprEpJ7C+Ieyo6MCD3WY lxURKS13XiV8Rpqc/Wkdh6oY7kqaF4PwAYirftmSuqeVpQ4od4yjWfpwvb3tv+/sI3R4 cRJW9Ms/DTBQOVkTp4fr8em5b2K9rKO+iky+E3y09ZLCKDIaz8nZRcnWi1yTKqtgoSzq +5TszyjqkTIvjxwyQVrrN4nNtvAFaPaUyoAUsHXDkpG9zLiD5acnx4x95dwldZ6OFfFr 3s+A== X-Gm-Message-State: AOJu0YxyxbRHGAQOieigyIVJpJdp4j2qt+nKVnoDWvL8rxQjDq445KYW q7ov0BktUA1ls1FQkYAhZ5r7SBnYKB1401Qpw7PuHdqxRAxal9M4CwyLNPag X-Google-Smtp-Source: AGHT+IGLLFCMiqITGK7y4nYb9JrY3qo2DUla65Ob6xDE2i7gN159M6wLykcnXQvg9EvRvPmH8g6oWQ== X-Received: by 2002:a17:906:c44f:b0:a6e:b5ef:f731 with SMTP id a640c23a62f3a-a6eb5effb57mr62744466b.64.1717766717011; Fri, 07 Jun 2024 06:25:17 -0700 (PDT) Original-Received: from 3-191.divsi.unimi.it (3-191.divsi.unimi.it. [159.149.3.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6c8058272bsm249384866b.18.2024.06.07.06.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 06:25:16 -0700 (PDT) In-Reply-To: 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:286768 Archived-At: In data venerd=C3=AC 7 giugno 2024 14:53:04 CEST, Stefan Monnier ha scritto: > >> (dolist (buffer (buffer-list)) > >> (with-current-buffer buffer > >> (when (derived-mode-p 'php-ts-mode) > >> (php-ts-mode-set-style val)))) > >>=20 > >> ? > > Yes is better. The code above is a copy of c-ts-mode--indent-style-sett= er.=20 > > It seemed too complicated to me too, but since it had been used there=20 > > I thought there was some reason. >=20 > Aha! Thanks, I guess we should check the > `c-ts-mode--indent-style-setter` situation, as well, then. >=20 > >> > +(defvar php-ts-mode--syntax-table > >> > + (let ((table (make-syntax-table))) > >> > + ;; Taken from the cc-langs version > >>=20 > >> Does this mean it comes from "the cc-mode-based `php-mode.el`" or from > >> `cc-langs.el` (and if so, which part, exactly)? > >>=20 > >> > +;; taken from c-ts-mode > >> [...] > >> > +;; taken from c-ts-mode > >>=20 > >> Are these literal copies? > >> Maybe we should consolidate the code with that of `c-ts-mode` to avoid > >> the code duplication? > >>=20 > > 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. >=20 > Hmm... that makes the comment hard to understand. >=20 Yes. Perhaps it would be better to remove it. > >> > + (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 na= me? > > Sorry. I didn't understand. Could you please clarify? >=20 > You have: >=20 > (setq mode-name (concat "PHP" (string-trim-right comment-start))) >=20 > 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? >=20 >=20 c-ts-mode-set-modeline does the same, which is why I did it too.=20 > Stefan >=20 >=20 Thanks Vincenzo