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#71574: 30.0.50; [PATCH] Fix wrong-type-argument in php-ts-mode--webserver-read-args Date: Sat, 15 Jun 2024 19:53:18 +0200 Message-ID: <26459508.1r3eYUQgxm@fedora> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2279625.vFx2qVVIhK" Content-Transfer-Encoding: 7Bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22192"; mail-complaints-to="usenet@ciao.gmane.io" To: 71574@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 15 19:54:20 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 1sIXbX-0005eh-QL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 15 Jun 2024 19:54:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sIXbH-0006NP-VI; Sat, 15 Jun 2024 13:54:03 -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 1sIXbF-0006Mt-Bp for bug-gnu-emacs@gnu.org; Sat, 15 Jun 2024 13:54:01 -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 1sIXbF-00057b-3i for bug-gnu-emacs@gnu.org; Sat, 15 Jun 2024 13:54:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sIXbF-0005SW-OX for bug-gnu-emacs@gnu.org; Sat, 15 Jun 2024 13:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vincenzo Pupillo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Jun 2024 17:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71574 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171847400720897 (code B ref -1); Sat, 15 Jun 2024 17:54:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Jun 2024 17:53:27 +0000 Original-Received: from localhost ([127.0.0.1]:36679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sIXag-0005Qu-V5 for submit@debbugs.gnu.org; Sat, 15 Jun 2024 13:53:27 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sIXaf-0005Ql-Fd for submit@debbugs.gnu.org; Sat, 15 Jun 2024 13:53:26 -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 1sIXae-0006H2-8z for bug-gnu-emacs@gnu.org; Sat, 15 Jun 2024 13:53:24 -0400 Original-Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sIXac-00053p-JI for bug-gnu-emacs@gnu.org; Sat, 15 Jun 2024 13:53:24 -0400 Original-Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-35f090093d8so2541776f8f.0 for ; Sat, 15 Jun 2024 10:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718474000; x=1719078800; 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=TvoCHsXk3V61aANiiqyIwohmZkc3whZslKOncnyI9Ak=; b=YhHKMepW+QVdGlHzZWh65mMkdswOBuutuCNzX07CU/Ssr0Uu5HsyoK52unyzLCHVB0 1hoIiv61WtNe/oeHTWQQhf8HNLl6dkYIkWzvT0sghIilKvljL5j7xqYbDiGcv53TzvO6 Ysujb98/CudnR/jknscdr+TIaqyU/bGg4hj9pCiRzVlX1VX1CLG1mkQZ0U+4fPU1KWHX bzCgmp67ZGd4aRQP47Hp1l5idTLeJ8yn9NsG+Mu/Cvwa8nBRbW97XvLSUm9KuNynsYk+ kPC9v2+0ESkwi0XTwl+64uFyPoMtEJqFSXp09iWyKbvAwOw9Pc5S6MrjfoWq3G4miN0u bnmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718474000; x=1719078800; 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=TvoCHsXk3V61aANiiqyIwohmZkc3whZslKOncnyI9Ak=; b=r+/wbshaorTAA3jmAHFvSmo8ChU+628gqxJuzQHJ6uSJtN1VtkwDY2VdbGwp4yC1hP LFqwsUUsb4c7s1Ktoah/exr0sux2sAzEx/yDHtRTsu+qAYO2M1UikDoqca2By+rBIeHb kdSMkIVnBp/UU6S2LV4mnJa1SDdjjuppzP0V7N7vUQHkrlskn7KyHF/+ykSPrMyY4jRL Ig4u4bLPMzdBDuudYxXSAR7A/vMtrzLHQsvJQmKtZe02ODdgS+PmEPUd8a4m+aKGY1Re oJONSiWTF5RhGoyvMl1xLt28lLKLVrc8Z6FHVWZymuzQOCbQJF7oamXXCuN94blxS0kc JgfQ== X-Gm-Message-State: AOJu0Yxl8aJNlI+GFtGvTY42FxuvZevW7gO9C4u7sDw34ne2aqx/R/fR VLaEX7hrWiCpX5EITNsGTd6hjXcByI0PTbWgvuP8m6Rk3X1S8uK1JR0WuDNl X-Google-Smtp-Source: AGHT+IF1TKlT62/SwwCuRmDiLUY7k/AXL458XZarclMQnw6p1wi0pa7oPzIA8SXS0EMglW8jhaYkXw== X-Received: by 2002:a5d:6da6:0:b0:360:83cd:ea2d with SMTP id ffacd0b85a97d-36083cded29mr4639732f8f.24.1718474000280; Sat, 15 Jun 2024 10:53:20 -0700 (PDT) Original-Received: from fedora.localnet (2-230-139-124.ip202.fastwebnet.it. [2.230.139.124]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3607510315csm7646284f8f.90.2024.06.15.10.53.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 10:53:19 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=v.pupillo@gmail.com; helo=mail-wr1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:287303 Archived-At: This is a multi-part message in MIME format. --nextPart2279625.vFx2qVVIhK Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Ciao, php-ts-mode-run-php-webserver throws an error if the current buffer is not associated with a file. This is due to php-ts-mode--webserver-read-args. php- ts-mode--webserver-read-args now uses default-directory if buffer-file-name returns nil. The included patch fixes this. Thanks. Vincenzo --nextPart2279625.vFx2qVVIhK Content-Disposition: attachment; filename="0001-Fix-wrong-type-argument-in-php-ts-mode-webserver-rea.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-Fix-wrong-type-argument-in-php-ts-mode-webserver-rea.patch" >From 4a22bae2bd7515801037f3ab55f1a514a7e82aef Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Sat, 15 Jun 2024 18:57:29 +0200 Subject: [PATCH] Fix wrong-type-argument in php-ts-mode--webserver-read-args Prevents php-ts-mode--webserver-read-args from throwing an error if the current buffer is not associated with a file. * lisp/progmodes/php-ts-mode.el (php-ts-mode--webserver-read-args): Use default-directory if the current buffer is not associated with a file. * lisp/progmodes/php-ts-mode.el (php-ts-mode-run-php-webserver): Fix doc string. --- lisp/progmodes/php-ts-mode.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index fc029a17120..1a8a0a44468 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -1464,7 +1464,7 @@ php-ts-mode-run-php-webserver (derived-mode-add-parents 'php-ts-mode '(php-mode)) (defun php-ts-mode--webserver-read-args (&optional type) - "Helper for php-ts-mode-run-php-webserver. + "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." (let ((ask-port (lambda () @@ -1474,11 +1474,15 @@ php-ts-mode--webserver-read-args (ask-document-root (lambda () (expand-file-name (read-directory-name "Document root: " - (file-name-directory (buffer-file-name)))))) + (file-name-directory + (or (buffer-file-name) + default-directory)))))) (ask-router-script (lambda () (expand-file-name (read-file-name "Router script: " - (file-name-directory (buffer-file-name))))))) + (file-name-directory + (or (buffer-file-name) + default-directory))))))) (cl-case type (port (funcall ask-port)) (hostname (funcall ask-hostname)) -- 2.45.2 --nextPart2279625.vFx2qVVIhK--