From: Vincenzo Pupillo <v.pupillo@gmail.com>
To: 71574@debbugs.gnu.org
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 [thread overview]
Message-ID: <26459508.1r3eYUQgxm@fedora> (raw)
[-- Attachment #1: Type: text/plain, Size: 299 bytes --]
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
[-- Attachment #2: 0001-Fix-wrong-type-argument-in-php-ts-mode-webserver-rea.patch --]
[-- Type: text/x-patch, Size: 2401 bytes --]
From 4a22bae2bd7515801037f3ab55f1a514a7e82aef Mon Sep 17 00:00:00 2001
From: Vincenzo Pupillo <v.pupillo@gmail.com>
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
next reply other threads:[~2024-06-15 17:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-15 17:53 Vincenzo Pupillo [this message]
2024-06-15 18:55 ` bug#71574: 30.0.50; [PATCH] Fix wrong-type-argument in php-ts-mode--webserver-read-args Eli Zaretskii
2024-06-15 19:56 ` Vincenzo Pupillo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26459508.1r3eYUQgxm@fedora \
--to=v.pupillo@gmail.com \
--cc=71574@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.