unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71574: 30.0.50; [PATCH] Fix wrong-type-argument in php-ts-mode--webserver-read-args
@ 2024-06-15 17:53 Vincenzo Pupillo
  2024-06-15 18:55 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Vincenzo Pupillo @ 2024-06-15 17:53 UTC (permalink / raw)
  To: 71574

[-- 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#71574: 30.0.50; [PATCH] Fix wrong-type-argument in php-ts-mode--webserver-read-args
  2024-06-15 17:53 bug#71574: 30.0.50; [PATCH] Fix wrong-type-argument in php-ts-mode--webserver-read-args Vincenzo Pupillo
@ 2024-06-15 18:55 ` Eli Zaretskii
  2024-06-15 19:56   ` Vincenzo Pupillo
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2024-06-15 18:55 UTC (permalink / raw)
  To: Vincenzo Pupillo; +Cc: 71574-done

> From: Vincenzo Pupillo <v.pupillo@gmail.com>
> Date: Sat, 15 Jun 2024 19:53:18 +0200
> 
> 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, installed (but please note the minor changes I made in your
commit log message, and try to follow this style in the future).

I'm closing this bug.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#71574: 30.0.50; [PATCH] Fix wrong-type-argument in php-ts-mode--webserver-read-args
  2024-06-15 18:55 ` Eli Zaretskii
@ 2024-06-15 19:56   ` Vincenzo Pupillo
  0 siblings, 0 replies; 3+ messages in thread
From: Vincenzo Pupillo @ 2024-06-15 19:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 71574-done

In data sabato 15 giugno 2024 20:55:50 CEST, Eli Zaretskii ha scritto:
> > From: Vincenzo Pupillo <v.pupillo@gmail.com>
> > Date: Sat, 15 Jun 2024 19:53:18 +0200
> > 
> > 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, installed (but please note the minor changes I made in your
> commit log message, and try to follow this style in the future).
Ok, thank you!

> 
> I'm closing this bug.
Vincenzo








^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-15 19:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-15 17:53 bug#71574: 30.0.50; [PATCH] Fix wrong-type-argument in php-ts-mode--webserver-read-args Vincenzo Pupillo
2024-06-15 18:55 ` Eli Zaretskii
2024-06-15 19:56   ` Vincenzo Pupillo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).