From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 02 09:40:09 2024 Received: (at submit) by debbugs.gnu.org; 2 Sep 2024 13:40:09 +0000 Received: from localhost ([127.0.0.1]:48728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sl7Ht-000554-2S for submit@debbugs.gnu.org; Mon, 02 Sep 2024 09:40:09 -0400 Received: from lists.gnu.org ([209.51.188.17]:41682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sl78r-0004fT-2Z for submit@debbugs.gnu.org; Mon, 02 Sep 2024 09:30:50 -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 1sl77r-0004lR-He for bug-gnu-emacs@gnu.org; Mon, 02 Sep 2024 09:29:47 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sl77c-0007Na-Ax for bug-gnu-emacs@gnu.org; Mon, 02 Sep 2024 09:29:47 -0400 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2f4f24263acso63345601fa.0 for ; Mon, 02 Sep 2024 06:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725283765; x=1725888565; 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=wJxog3eEWZk1k9EePpncv1xsCxU3zpH73Lea8z3A1CE=; b=EMz8LmCpT66Yu15bs0E57haGRdpgOVvFb3gr17NMD9HVBO8Ej3NycRkpdvEaWt8pRO SC2N0PFg0rebTbZayO+k3M4YxGeLLEjj5fq/AueFREaLmlUVAG5b2pikgPdnMt9K2Whe KFxRllLFQXjR1LHTrEFuFtVIy5mABTtj357Q9Bm5KsGa01Mu7cdUUjk+jerGdkwf6zEK qt+4OpwlQG+1Uk1sw/LOeWpJS6GfV1d9JkG7iTZd/9DdY9eb6uNJl0Dr8y7DkdUJIb+/ A3j+oAwiQbVS7pk5rQ9IGt3oZ3cgG0seDOvqjawIjq9PTVrhRSLZqVTuuGqsWSGq1bCc 3dPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725283765; x=1725888565; 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=wJxog3eEWZk1k9EePpncv1xsCxU3zpH73Lea8z3A1CE=; b=h+irF7EZt4t1nAxlPJnXKd1bi9vxS2YMfNIfWLEJXgqLWoJpl+L7qjedjftPcCPwsR 1mFWzdmtIDkuhTASIfH6WSo7LaHChMS9QgcfleRbNRSt5ynZOu0KWkYE6Pl7BNike954 BhA3qbQ20iY/gMPZAUMPZSgYcAFNw60bNKyRZ8Oy8GdXaMG35K0KRCUX9MduK+CR10gD 4VTIyumZZTOZnWKYKR/kBxHsiAF4nBhxJOceGwNM5TcOVIDHm7Ac1c1sqUAvfNW0j6Jv mwudC3ap6uiKzOlZNqnktqEJ+88r1FodBeLVmgws6+26i+uaT1w74hmc8gMyOEHoD7Pr oKbw== X-Gm-Message-State: AOJu0YwqpfGREJEo9OwxwH6f4qckUk3I9nQrGb6XqJqJIr32PrkNhm9V YKWL9bz2lyXHAEOGOMn+v53A3xKijZgChkotkvN76VgLYJe92yb78+rrbg== X-Google-Smtp-Source: AGHT+IFApJM5XUXN8yJ4KSZQmHYpmPHEr81Z0TSJ9vnz+fYPi9oihXtepSebyGg4zxWoDd2bwVmwiA== X-Received: by 2002:a2e:be03:0:b0:2f4:f253:ec7 with SMTP id 38308e7fff4ca-2f6104270b5mr130397211fa.0.1725283764398; Mon, 02 Sep 2024 06:29:24 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8989022ac4sm560460366b.59.2024.09.02.06.29.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 06:29:24 -0700 (PDT) From: Vincenzo Pupillo To: Bug Emacs Subject: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver Date: Mon, 02 Sep 2024 15:29:23 +0200 Message-ID: <5614567.rdbgypaU67@fedora> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3491391.LZWGnKmheA" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=v.pupillo@gmail.com; helo=mail-lj1-x230.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --nextPart3491391.LZWGnKmheA Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Ciao, this patch adds a new CONFIG attribute to 'php-ts-mode-run-php-webserver' that allows you to specify an alternative php.ini file to the default (or whatever is specified in 'php-ts-mode-php-config'). Thanks. Vincenzo. --nextPart3491391.LZWGnKmheA Content-Disposition: attachment; filename="0001-Support-for-custom-php.ini-for-the-built-in-PHP-web-.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Support-for-custom-php.ini-for-the-built-in-PHP-web-.patch" >From 8b688884219e081a086559728251172d710b51e2 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 2 Sep 2024 14:11:01 +0200 Subject: [PATCH] Support for custom php.ini for the built-in PHP web server. A new CONFIG attribute, which defaults to 'php-ts-mode-php-config', allows an alternative php.ini file to be specified for the built-in web server. The 'php-ts-mode-run-php-webserver' function, when called interactively with a prefix argument, also requires this new attribute. * lisp/progmodes/php-ts-mode.el (php-ts-mode-run-php-webserver): New CONFIG attribute. Update docstring. * lisp/progmodes/php-ts-mode.el (php-ts-mode--webserver-read-args): Support the new TYPE. Update docstring. --- lisp/progmodes/php-ts-mode.el | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index 3f89de14075..34304049c5c 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -1469,8 +1469,12 @@ php-ts-mode ;;;###autoload -(defun php-ts-mode-run-php-webserver (&optional port hostname document-root - router-script num-of-workers) +(defun php-ts-mode-run-php-webserver (&optional port + hostname + document-root + router-script + config + num-of-workers) "Run PHP built-in web server. PORT: Port number of built-in web server, default `php-ts-mode-ws-port'. @@ -1482,12 +1486,14 @@ php-ts-mode-run-php-webserver Prompt for the document-root if the default value is nil. ROUTER-SCRIPT: Path of the router PHP script, see `https://www.php.net/manual/en/features.commandline.webserver.php' +CONFIG: Alternative php.ini config, default `php-ts-mode-php-config'. NUM-OF-WORKERS: Before run the web server set the PHP_CLI_SERVER_WORKERS env variable useful for testing code against multiple simultaneous requests. + Interactively, when invoked with prefix argument, always prompt -for PORT, HOSTNAME, DOCUMENT-ROOT and ROUTER-SCRIPT." +for PORT, HOSTNAME, DOCUMENT-ROOT, ROUTER-SCRIPT and CONFIG." (interactive (when current-prefix-arg (php-ts-mode--webserver-read-args))) (let* ((port (or @@ -1502,6 +1508,9 @@ php-ts-mode-run-php-webserver document-root php-ts-mode-ws-document-root (php-ts-mode--webserver-read-args 'document-root))) + (config (or config + (when php-ts-mode-php-config + (expand-file-name php-ts-mode-php-config)))) (host (format "%s:%d" hostname port)) (name (format "PHP web server on: %s" host)) (buf-name (format "*%s*" name)) @@ -1509,6 +1518,8 @@ php-ts-mode-run-php-webserver nil (list "-S" host "-t" document-root + (when config + (format "-c %s" config)) router-script))) (process-environment (cons (cond @@ -1529,8 +1540,8 @@ php-ts-mode-run-php-webserver (defun php-ts-mode--webserver-read-args (&optional type) "Helper for `php-ts-mode-run-php-webserver'. -The optional TYPE can be the symbol \"port\", \"hostname\", \"document-root\" or -\"router-script\", otherwise it requires all of them." +The optional TYPE can be the symbol \"port\", \"hostname\", \"document-root\", +\"router-script\" or \"config\", otherwise it requires all of them." (let ((ask-port (lambda () (read-number "Port: " 3000))) (ask-hostname (lambda () @@ -1546,17 +1557,25 @@ php-ts-mode--webserver-read-args (read-file-name "Router script: " (file-name-directory (or (buffer-file-name) - default-directory))))))) + default-directory)))))) + (ask-config (lambda() + (expand-file-name + (read-file-name "Alternative php.ini: " + (file-name-directory + (or (buffer-file-name) + default-directory))))))) (cl-case type (port (funcall ask-port)) (hostname (funcall ask-hostname)) (document-root (funcall ask-document-root)) (router-script (funcall ask-router-script)) + (config (funcall ask-config)) (t (list (funcall ask-port) (funcall ask-hostname) (funcall ask-document-root) - (funcall ask-router-script)))))) + (funcall ask-router-script) + (funcall ask-config)))))) (define-derived-mode inferior-php-ts-mode comint-mode "Inferior PHP" "Major mode for PHP inferior process." -- 2.46.0 --nextPart3491391.LZWGnKmheA-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 02 10:25:30 2024 Received: (at 72966) by debbugs.gnu.org; 2 Sep 2024 14:25:30 +0000 Received: from localhost ([127.0.0.1]:49839 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sl7zm-0007Q9-4c for submit@debbugs.gnu.org; Mon, 02 Sep 2024 10:25:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sl7zk-0007Pv-9U for 72966@debbugs.gnu.org; Mon, 02 Sep 2024 10:25:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sl7yf-0004v3-RF; Mon, 02 Sep 2024 10:24:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=OQdVTAMfG6mS96gf15U9lLolbJEsaALY5FCZdD8jaJY=; b=eEeym14eDI2u Mezgqdpc2XAjYJxZpDh8/VAsMjBVsZN7erUmTHgwQkaF0oFGRQ0VM5lzZghEGzFDEyuvfnk78sD1m QXRZPdN3nZqQEMyyxlnCH0m6Vt+IXHOfJY7LfrXHvivQEpQ+7EDiarphjfyq4TzvWuzM2GNQeofhY WOfbUJeLocOVnv1T0cB0kLAaDWgdVoDvvSee/dCAL8oje0NgGMQSMiWzlnvI4hQFxeha/KKIWtYa6 gY47dGTr1I5BIi23pQhxXLxLem3iZ3+xC8q5VCaV7gUU8RB4dRqNAt78Pdv1Vlpq57gAG1D5sDqEN 9VOj/Lcn8ozNwKSUgP+gtg==; Date: Mon, 02 Sep 2024 17:23:53 +0300 Message-Id: <86bk16877q.fsf@gnu.org> From: Eli Zaretskii To: Vincenzo Pupillo In-Reply-To: <5614567.rdbgypaU67@fedora> (message from Vincenzo Pupillo on Mon, 02 Sep 2024 15:29:23 +0200) Subject: Re: bug#72966: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver References: <5614567.rdbgypaU67@fedora> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 72966 Cc: 72966@debbugs.gnu.org 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" X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo > Date: Mon, 02 Sep 2024 15:29:23 +0200 > > Ciao, > this patch adds a new CONFIG attribute to 'php-ts-mode-run-php-webserver' that > allows you to specify an alternative php.ini file to the default (or whatever > is specified in 'php-ts-mode-php-config'). Thanks. > -(defun php-ts-mode-run-php-webserver (&optional port hostname document-root > - router-script num-of-workers) > +(defun php-ts-mode-run-php-webserver (&optional port > + hostname > + document-root > + router-script > + config > + num-of-workers) > "Run PHP built-in web server. This changes a public API in backward-incompatible way, something we don't do, because it could break someone's code out there. (It is true that php-ts-mode was introduced in Emacs 30, but that version is already in pretest and will be released soon, so I don't think we can change this there, either.) So please find a backward-compatible way of adding this feature, perhaps add the new CONFIG argument as the last one? Also, I think this needs a NEWS entry describing the change in behavior. From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 02 10:55:10 2024 Received: (at 72966) by debbugs.gnu.org; 2 Sep 2024 14:55:10 +0000 Received: from localhost ([127.0.0.1]:49907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sl8ST-0000OW-Nv for submit@debbugs.gnu.org; Mon, 02 Sep 2024 10:55:10 -0400 Received: from mail-ej1-f44.google.com ([209.85.218.44]:49322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sl8Rs-0000MZ-Tk for 72966@debbugs.gnu.org; Mon, 02 Sep 2024 10:54:34 -0400 Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a8a1acb51a7so32641366b.2 for <72966@debbugs.gnu.org>; Mon, 02 Sep 2024 07:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725288746; x=1725893546; 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=S8jQDE5PFzh05XBpRw/jsuNVUsJv6XPURWmc7xYn9oU=; b=eKSl55+t7AK0n3YDlpNqZjNinKa0ZvWF1jOslt2Ei1fo64Am/mXejI6zFxy7QmfcCf VphFoNm5pcdyXD62fzN63acMJXxTGUniCoT4iLQdmdis/KpSYKF8ECXQDcjDglLE6z0Y Zm9CLgS60M71xwKOaUXo/lNGQxzlrovEhGB8qelZfcrZTiwz3t5gvTEiOi+8TQSshQwq qnO1RWJbbAb0J9R/foVraIVbz/JuHe+W/0n4g7Ae8nif6S/jbee5hE9tMO4bmWyiFLsi GiMACljwWhc1RIXgWVq6a//k8q/B/iY/NlaJf3ncJOr5a4iFcboF7Om6RKqGOLW31Nae iLDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725288746; x=1725893546; 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=S8jQDE5PFzh05XBpRw/jsuNVUsJv6XPURWmc7xYn9oU=; b=aWkcQlw3zimDPDxihO6iI4YyAnwN03jdg1OTOVkw7PJwiADC2VvQ0ucGcOTNNhl4NO VjEPp/2MuwdoZ9FjP1peFXpQ137nbchvx5+KndYebVe0FGtihkO63H84R1i1QeQauE3f dqm9SlP/iU5fd6xBuYtGbdMonOn964Tl+moLJK5JVj6zEsR86556leA6Tek2roFJb68J cJavZmqc2ELLKkdR+7Ew+ehZnKNK50+abbu7o/+mWEKm9ZT2QQWPSDQ0G5+aGxNNe2oJ m2T5wmS+rkE+raUULhMpACzSh3lh3kbEYBIBUtwy3I2kQhAqxkUBUg9woRsZTTQy/Okl 7opQ== X-Gm-Message-State: AOJu0YwLedsHqWEAQSWpghx9zaqAZ3EHzfZzoCHKgT34oAgxseh9bbSV 1NGpd8Rafxa9Z9Q/54Tru35gxD/mP5y/WJk90yf/C/uEGMSvmnW39v4rFA== X-Google-Smtp-Source: AGHT+IFFFq4iKzp8jGVOVXE+g/6ASqYJzHethSnNFz1hkJVNPqQ8cr9vtivT3VA00zzhj3Ypw5inLw== X-Received: by 2002:a17:907:948f:b0:a86:a417:72d2 with SMTP id a640c23a62f3a-a8a1d32689cmr25171966b.35.1725288745626; Mon, 02 Sep 2024 07:52:25 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a898909253asm570726966b.93.2024.09.02.07.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 07:52:25 -0700 (PDT) From: Vincenzo Pupillo To: Eli Zaretskii Subject: Re: bug#72966: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver Date: Mon, 02 Sep 2024 16:52:24 +0200 Message-ID: <4744299.vXUDI8C0e8@fedora> In-Reply-To: <86bk16877q.fsf@gnu.org> References: <5614567.rdbgypaU67@fedora> <86bk16877q.fsf@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72966 Cc: 72966@debbugs.gnu.org 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" X-Spam-Score: -1.0 (-) Ok, thanks.=20 I will fix ASAP. Vincenzo. In data luned=C3=AC 2 settembre 2024 16:23:53 CEST, Eli Zaretskii ha scritt= o: > > From: Vincenzo Pupillo > > Date: Mon, 02 Sep 2024 15:29:23 +0200 > >=20 > > Ciao, > > this patch adds a new CONFIG attribute to 'php-ts-mode-run-php-webserve= r' > > that allows you to specify an alternative php.ini file to the default (= or > > whatever is specified in 'php-ts-mode-php-config'). >=20 > Thanks. >=20 > > -(defun php-ts-mode-run-php-webserver (&optional port hostname > > document-root - =20 > > router-script num-of-workers) +(defun php-ts-mode-run-php-webserver > > (&optional port > > + hostname > > + document-root > > + router-script > > + config > > + num-of-workers) > >=20 > > "Run PHP built-in web server. >=20 > This changes a public API in backward-incompatible way, something we > don't do, because it could break someone's code out there. (It is > true that php-ts-mode was introduced in Emacs 30, but that version is > already in pretest and will be released soon, so I don't think we can > change this there, either.) >=20 > So please find a backward-compatible way of adding this feature, > perhaps add the new CONFIG argument as the last one? >=20 > Also, I think this needs a NEWS entry describing the change in > behavior. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 05 15:18:45 2024 Received: (at 72966) by debbugs.gnu.org; 5 Sep 2024 19:18:45 +0000 Received: from localhost ([127.0.0.1]:38255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smI0C-0002LR-DW for submit@debbugs.gnu.org; Thu, 05 Sep 2024 15:18:45 -0400 Received: from mail-ed1-f49.google.com ([209.85.208.49]:59559) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1smI0A-0002Kv-D8 for 72966@debbugs.gnu.org; Thu, 05 Sep 2024 15:18:43 -0400 Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5c26852af8fso1267888a12.2 for <72966@debbugs.gnu.org>; Thu, 05 Sep 2024 12:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725563791; x=1726168591; 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=atq38V6QPZL1Xr80KPq1mUSULmVfWEOlvs/Kb7/hk34=; b=V9nKZwIWyorbc5MQ+e2YeSssUbcNsky6o4q89OYHbAKHeZaP8gnhWARjokN0KYywez lhsqs9nmOuwdNBZTS1GinXOKpHlahv1rx69Y9UuM/DPxN4YCwNWRWGcQhy8V8vs1dRTh 2JhHWpIR/eJ6hO0SWuPvUOx3nowTHjNeRAKusSKAogj0QTUu0n6oWBTJ61oT3ICUHv3i lTPC3MJNSrd+y9UIdNYOU+AIri9Wh31wgJRgBzgcMBCa+eskwp/njrICvFyBgfVevmB/ cTThECMz/FmvYUh/1rposLRHXZtyOXW4PLoe1Ed7YHJ3kOvdm7zj3Ha9K5VsXhuXgP6B 3Q7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725563791; x=1726168591; 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=atq38V6QPZL1Xr80KPq1mUSULmVfWEOlvs/Kb7/hk34=; b=fgg8wsydHeRpWTu7euCYwDq7171odl0GigYoh3lV0sz8pNkhAml3+k70xp8sgVK8eH nQbN8ze61OgM6kj1CgLA1ia0kBiks9fwaSUBKUUE2YtufKdZ2Tf+UfMZ4FoX0cFjRIGf elQArau7kHHyNLCJXp1yT46o0yPzxZkvsDKBNnLZtnOrq8OewbVTMKd2P8CSAGDoHPZU b0dOaR2NXyqawlbuy2YjtoQvEQQDg/xiAbfYXJCzioWZ6pl/+MqJ+qpE0dcQa/POdO+5 GUwpYo91s9xZTpJdg3gefjJW9HYvJLnRZmUKV3+270rGna5qv+ylraH7vVJdwnImAIWf JM6A== X-Gm-Message-State: AOJu0YyXb/dJNvRTfs5b2hrbHEOEJ76uiX6IefCIHzvXRFygtaRiwZxd br1c8ACgdCQM/Cp7iV1NiiD+nbTPEudtG1Prr79NSASZIOLWdH6A2wapQw== X-Google-Smtp-Source: AGHT+IHUYo0UYxB6SuvQW9VPEPyiMzZqMWSYry2vJfZCwPtOD8Q2KsG587zDnOiGTkhrn05lsohaAw== X-Received: by 2002:a17:907:60d0:b0:a86:acbe:8d61 with SMTP id a640c23a62f3a-a897fa71c13mr1829108266b.53.1725563790565; Thu, 05 Sep 2024 12:16:30 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a62083f1asm172150566b.94.2024.09.05.12.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 12:16:30 -0700 (PDT) From: Vincenzo Pupillo To: Eli Zaretskii Subject: Re: bug#72966: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver Date: Thu, 05 Sep 2024 21:16:29 +0200 Message-ID: <26551738.1r3eYUQgxm@fedora> In-Reply-To: <86bk16877q.fsf@gnu.org> References: <5614567.rdbgypaU67@fedora> <86bk16877q.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2272098.vFx2qVVIhK" Content-Transfer-Encoding: 7Bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72966 Cc: 72966@debbugs.gnu.org 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" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --nextPart2272098.vFx2qVVIhK Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Hi Eli, I followed your suggestion and moved the CONFIG argument. I also ad= ded=20 a new entry to the NEWS file. Thanks. Vincenzo In data luned=C3=AC 2 settembre 2024 16:23:53 CEST, Eli Zaretskii ha scritt= o: > > From: Vincenzo Pupillo > > Date: Mon, 02 Sep 2024 15:29:23 +0200 > >=20 > > Ciao, > > this patch adds a new CONFIG attribute to 'php-ts-mode-run-php-webserve= r' > > that allows you to specify an alternative php.ini file to the default (= or > > whatever is specified in 'php-ts-mode-php-config'). >=20 > Thanks. >=20 > > -(defun php-ts-mode-run-php-webserver (&optional port hostname > > document-root - =20 > > router-script num-of-workers) +(defun php-ts-mode-run-php-webserver > > (&optional port > > + hostname > > + document-root > > + router-script > > + config > > + num-of-workers) > >=20 > > "Run PHP built-in web server. >=20 > This changes a public API in backward-incompatible way, something we > don't do, because it could break someone's code out there. (It is > true that php-ts-mode was introduced in Emacs 30, but that version is > already in pretest and will be released soon, so I don't think we can > change this there, either.) >=20 > So please find a backward-compatible way of adding this feature, > perhaps add the new CONFIG argument as the last one? >=20 > Also, I think this needs a NEWS entry describing the change in > behavior. --nextPart2272098.vFx2qVVIhK Content-Disposition: attachment; filename="0001-Support-for-custom-php.ini-for-the-built-in-PHP-web-.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Support-for-custom-php.ini-for-the-built-in-PHP-web-.patch" >From ae9182be63bfa8625c8c8486c1856dced4fb9152 Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Mon, 2 Sep 2024 14:11:01 +0200 Subject: [PATCH] Support for custom php.ini for the built-in PHP web server. A new CONFIG attribute, which defaults to 'php-ts-mode-php-config', allows an alternative php.ini file to be specified for the built-in web server. The 'php-ts-mode-run-php-webserver' function, when called interactively with a prefix argument, also requires this new attribute. * etc/NEWS: Described the new CONFIG attribute and the different behavior of 'php-ts-mode-run-php-webserver'. * lisp/progmodes/php-ts-mode.el (php-ts-mode--parent-html-bol): Fix docstring. * lisp/progmodes/php-ts-mode.el (php-ts-mode-run-php-webserver): New CONFIG attribute. Update docstring. * lisp/progmodes/php-ts-mode.el (php-ts-mode--webserver-read-args): Support the new TYPE. Update docstring. --- etc/NEWS | 10 +++++ lisp/progmodes/php-ts-mode.el | 75 +++++++++++++++++++++++++++-------- 2 files changed, 69 insertions(+), 16 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index f2c999a3955..0539bf47479 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1965,6 +1965,16 @@ the 'widget-inactive' face). If non-nil, moving point forward or backward between widgets by typing 'TAB' or 'S-TAB' skips over inactive widgets. The default value is nil. +** PHP-ts mode + +--- +*** 'php-ts-mode-run-php-webserver' now accepts a custom php.ini. +A new attribute, CONFIG, allows you to specify an custom php.ini. +By default it retains the previous behavior: prompt for HOSTNAME +and PORT only if their respective values are nil. +Interactively, when invoked with prefix argument, always prompt for +PORT, HOSTNAME, DOCUMENT-ROOT, ROUTER-SCRIPT, NUM-OF-WORKERS and CONFIG. + ** Ruby mode --- diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index 3f89de14075..f8d240b746b 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -490,7 +490,7 @@ php-ts-mode--parent-html-bol (treesit-node-start parent))))) (defun php-ts-mode--parent-html-heuristic (node parent _bol &rest _) - "Returns position based on html indentation. + "Return position based on html indentation. Returns 0 if the NODE is after the , otherwise returns the indentation point of the last word before the NODE, plus the @@ -1469,8 +1469,12 @@ php-ts-mode ;;;###autoload -(defun php-ts-mode-run-php-webserver (&optional port hostname document-root - router-script num-of-workers) +(defun php-ts-mode-run-php-webserver (&optional port + hostname + document-root + router-script + num-of-workers + config) "Run PHP built-in web server. PORT: Port number of built-in web server, default `php-ts-mode-ws-port'. @@ -1484,10 +1488,12 @@ php-ts-mode-run-php-webserver see `https://www.php.net/manual/en/features.commandline.webserver.php' NUM-OF-WORKERS: Before run the web server set the PHP_CLI_SERVER_WORKERS env variable useful for testing code against -multiple simultaneous requests. +multiple simultaneous requests +CONFIG: Alternative php.ini config, default `php-ts-mode-php-config'. -Interactively, when invoked with prefix argument, always prompt -for PORT, HOSTNAME, DOCUMENT-ROOT and ROUTER-SCRIPT." +Interactively, when invoked with prefix argument, always prompt for +PORT, HOSTNAME, DOCUMENT-ROOT, ROUTER-SCRIPT, NUM-OF-WORKERS and +CONFIG." (interactive (when current-prefix-arg (php-ts-mode--webserver-read-args))) (let* ((port (or @@ -1502,6 +1508,9 @@ php-ts-mode-run-php-webserver document-root php-ts-mode-ws-document-root (php-ts-mode--webserver-read-args 'document-root))) + (config (or config + (when php-ts-mode-php-config + (expand-file-name php-ts-mode-php-config)))) (host (format "%s:%d" hostname port)) (name (format "PHP web server on: %s" host)) (buf-name (format "*%s*" name)) @@ -1509,12 +1518,18 @@ php-ts-mode-run-php-webserver nil (list "-S" host "-t" document-root + (when config + (format "-c %s" config)) router-script))) (process-environment - (cons (cond - (num-of-workers (format "PHP_CLI_SERVER_WORKERS=%d" num-of-workers)) - (php-ts-mode-ws-workers (format "PHP_CLI_SERVER_WORKERS=%d" php-ts-mode-ws-workers))) - process-environment))) + (nconc (cond + (num-of-workers + (list + (format "PHP_CLI_SERVER_WORKERS=%d" num-of-workers))) + (php-ts-mode-ws-workers + (list + (format "PHP_CLI_SERVER_WORKERS=%d" php-ts-mode-ws-workers)))) + process-environment))) (if (get-buffer buf-name) (message "Switch to already running web server into buffer %s" buf-name) (message "Run PHP built-in web server with args %s into buffer %s" @@ -1529,12 +1544,17 @@ php-ts-mode-run-php-webserver (defun php-ts-mode--webserver-read-args (&optional type) "Helper for `php-ts-mode-run-php-webserver'. -The optional TYPE can be the symbol \"port\", \"hostname\", \"document-root\" or -\"router-script\", otherwise it requires all of them." +The optional TYPE can be the symbol \"port\", \"hostname\", \"document-root\", +\"router-script\", \"num-workers\" or \"config\", otherwise it requires all of them." (let ((ask-port (lambda () - (read-number "Port: " 3000))) + (read-number "Port: " (or + php-ts-mode-ws-port + 3000)))) (ask-hostname (lambda () - (read-string "Hostname: " "localhost"))) + (read-string "Hostname: " + (or + php-ts-mode-ws-hostname + "localhost")))) (ask-document-root (lambda () (expand-file-name (read-directory-name "Document root: " @@ -1546,17 +1566,40 @@ php-ts-mode--webserver-read-args (read-file-name "Router script: " (file-name-directory (or (buffer-file-name) - default-directory))))))) + default-directory)))))) + (ask-num-workers (lambda () + (let ((num-workers + (read-number + "Number of workers (less then 2 means no workers): " + (or php-ts-mode-ws-workers 0)))) + ;; num-workers must be >= 2 or nil + ;; otherwise PHP's built-in web server will not start. + (if (> num-workers 1) + num-workers + nil)))) + (ask-config (lambda() + (let ((file-name (expand-file-name + (read-file-name "Alternative php.ini: " + (file-name-directory + (or (buffer-file-name) + default-directory)))))) + (if (string= "" (file-name-directory file-name)) + nil + file-name))))) (cl-case type (port (funcall ask-port)) (hostname (funcall ask-hostname)) (document-root (funcall ask-document-root)) (router-script (funcall ask-router-script)) + (num-of-workers (funcall ask-num-workers)) + (config (funcall ask-config)) (t (list (funcall ask-port) (funcall ask-hostname) (funcall ask-document-root) - (funcall ask-router-script)))))) + (funcall ask-router-script) + (funcall ask-num-workers) + (funcall ask-config)))))) (define-derived-mode inferior-php-ts-mode comint-mode "Inferior PHP" "Major mode for PHP inferior process." -- 2.46.0 --nextPart2272098.vFx2qVVIhK-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 08 02:48:23 2024 Received: (at 72966-done) by debbugs.gnu.org; 8 Sep 2024 06:48:23 +0000 Received: from localhost ([127.0.0.1]:57891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snBih-0000ss-DP for submit@debbugs.gnu.org; Sun, 08 Sep 2024 02:48:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40402) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snBie-0000se-IH for 72966-done@debbugs.gnu.org; Sun, 08 Sep 2024 02:48:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1snBiW-0005rE-6g; Sun, 08 Sep 2024 02:48:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=YF5zJgkijV1Z2FqxGoCNFZh/2joqHH1NT3I6vBd0iOM=; b=lRkV+sQ5fg2Y +37KFiE8JPrRsRtGR7xMUPPd9X8P4cmfWyQgzwe/ketqTz5lmBF8g/O0QUOqsumhMGI1F8b3eBspw OxtXD//1ZF4snkChrEj/pf3PgbNqLekGokNowEkKZxJ5ZN0+F2YTF+ncP0kTlKeHgjVAF9eF47kGJ cQyT6db4RPJ160SsfJl8JAfg4Vi9cp/PvTtvwwboLxzWBts95NJeueIRTw7r16vAz7ZvhYm6XDb6Z 7zKXUJG9nG4tQ92HQ+tw8jeJav2i7MLj3clF5ioW1qnvQKA0r/t96I/2sJFhUEoOptYXDDaEIVon/ fknIYgIKaU8GndbemdR0wQ==; Date: Sun, 08 Sep 2024 09:48:09 +0300 Message-Id: <86o74ywsie.fsf@gnu.org> From: Eli Zaretskii To: Vincenzo Pupillo In-Reply-To: <26551738.1r3eYUQgxm@fedora> (message from Vincenzo Pupillo on Thu, 05 Sep 2024 21:16:29 +0200) Subject: Re: bug#72966: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver References: <5614567.rdbgypaU67@fedora> <86bk16877q.fsf@gnu.org> <26551738.1r3eYUQgxm@fedora> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 72966-done Cc: 72966-done@debbugs.gnu.org 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" X-Spam-Score: -3.3 (---) > From: Vincenzo Pupillo > Cc: 72966@debbugs.gnu.org > Date: Thu, 05 Sep 2024 21:16:29 +0200 > > Hi Eli, I followed your suggestion and moved the CONFIG argument. I also added > a new entry to the NEWS file. Thanks, installed on the master branch, and closing the bug. Please in the future try to adhere to our conventions of leaving two spaces between sentences (I fixed that in this patch). From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 08 06:54:11 2024 Received: (at 72966-done) by debbugs.gnu.org; 8 Sep 2024 10:54:11 +0000 Received: from localhost ([127.0.0.1]:58019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snFYZ-0004v4-DH for submit@debbugs.gnu.org; Sun, 08 Sep 2024 06:54:11 -0400 Received: from mail-ej1-f43.google.com ([209.85.218.43]:47400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1snFYX-0004uq-5S for 72966-done@debbugs.gnu.org; Sun, 08 Sep 2024 06:54:09 -0400 Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a8a6d1766a7so359967766b.3 for <72966-done@debbugs.gnu.org>; Sun, 08 Sep 2024 03:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725792781; x=1726397581; 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=fauCP0uju9x0eOJ+2/4dT4j1VFSWMejV3OoLOcyknD0=; b=Wb0QyL4L0SEvI+pqKkW1Euhc4bbwUWy2rhv0KPNlFyz/TymoRjoZlqjjkK4l/acu4/ CroQwoiFEBYN0O46GsLoRIiyFNokzuOu1OpbcR+bS09VvQ0VpmI16oa/YgbjdHohOGuQ 9s6zzxoVKBSJR6X52ehTyM1usX0j9721xGv4u+c58vCb0IJdaiSgAHVNQ78g6uDjAsfY l27Rs/N+WlcYeIWxF+bLPAL1ztP7YRtIViAfqUY9RwyZsFpMTmPoPIY8oTdADhWPnk3V 5BqpFFpAwmfdB4qMAhM63X9BMEE8dkLLA3yS29pXBqKGTAfCip4LIPkMaqirFzwoHJnp RSWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725792781; x=1726397581; 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=fauCP0uju9x0eOJ+2/4dT4j1VFSWMejV3OoLOcyknD0=; b=sDn8NhN8XdDj2zYppc+rSt8QmjSRQkUn7WCBgifl/YYhs2XPc58g52HWfcLNylnmJM YY2GrpoxE3I5FG1YdcYmAecHiuSpnoSCdlNqztJ+u00BgmS8csiKFKXt94ydBTVfGKkw 9mZQquHTLy2ZtUm/komdhJGkJj+KUGfpCBZ0s+PFmC7Iji9FdUMuvmZKmMlYyUJQL4v2 ChPntqnggSHjjHCs2gubkqjhKZ0vyqpT7HgbyRa8oeB2oETmmakuIgILMjEHpJrEO2iV Sn2wGuhOt5LiaNGOWS7ICmKa8gzh/cCREnt5pAqN2LpwNiAceCAlnhwS55Li5eX/8eyn jZxQ== X-Gm-Message-State: AOJu0YzO49lpc4Z9USbT+o6oFqOTqZtsYobjPn0c3KYmaiDEPh46P0Ab gHlSrQNV8h/eNrF+VGMsVLxYb2oQqIR5x0O6nuvWDgHTUPLa7FCL X-Google-Smtp-Source: AGHT+IE4EzW2V/TxhAd0669L4cy76crtmVMcUqlwWQHQir+OvZR2+Rs2+rY8FuyskV42+OZl812Xlg== X-Received: by 2002:a17:906:6a15:b0:a86:a4b1:d2b8 with SMTP id a640c23a62f3a-a8a885bdfa9mr496725166b.4.1725792780858; Sun, 08 Sep 2024 03:53:00 -0700 (PDT) Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25950cc6sm185497066b.54.2024.09.08.03.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Sep 2024 03:53:00 -0700 (PDT) From: Vincenzo Pupillo To: Eli Zaretskii Subject: Re: bug#72966: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver Date: Sun, 08 Sep 2024 12:52:59 +0200 Message-ID: <4760260.vXUDI8C0e8@fedora> In-Reply-To: <86o74ywsie.fsf@gnu.org> References: <5614567.rdbgypaU67@fedora> <26551738.1r3eYUQgxm@fedora> <86o74ywsie.fsf@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 72966-done Cc: 72966-done@debbugs.gnu.org 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" X-Spam-Score: -1.0 (-) In data domenica 8 settembre 2024 08:48:09 CEST, Eli Zaretskii ha scritto: > > From: Vincenzo Pupillo > > Cc: 72966@debbugs.gnu.org > > Date: Thu, 05 Sep 2024 21:16:29 +0200 > > > > Hi Eli, I followed your suggestion and moved the CONFIG argument. I also > > added a new entry to the NEWS file. > > Thanks, installed on the master branch, and closing the bug. > > Please in the future try to adhere to our conventions of leaving two > spaces between sentences (I fixed that in this patch). Thank you Eli. Vincenzo. From unknown Fri Aug 15 14:48:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 06 Oct 2024 11:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator