From 44af1696e8c8dbe1a5e897cd275ce96ca825e14b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 15 Jun 2024 16:20:01 +0300 Subject: [PATCH] Fix problem with recently-added defcustom's * lisp/progmodes/php-ts-mode.el (php-ts-mode-php-config) (php-ts-mode-ws-port, php-ts-mode-ws-document-root) (php-ts-mode-ws-workers): Fix :type and :safe attributes. (Bug#71566) (cherry picked from commit 9e8c0ec9918af12aafa1063ad3bc3f9f1d180e6f) --- lisp/progmodes/php-ts-mode.el | 12 ++++++------ lisp/subr.el | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index 6a576d9c7c5..fc029a17120 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -130,7 +130,7 @@ If nil the default one is used to run the embedded webserver or inferior PHP process." :tag "PHP Init file" :version "30.1" - :type 'file) + :type '(choice (const :tag "Default init file" nil) file)) (defcustom php-ts-mode-ws-hostname "localhost" "The hostname that will be served by the PHP built-in webserver. @@ -146,23 +146,23 @@ See `https://www.php.net/manual/en/features.commandline.webserver.php'." If nil `php-ts-mode-run-php-webserver' will ask you for the port number." :tag "PHP built-in web server port" :version "30.1" - :type 'integer - :safe 'integerp) + :type '(choice (const :tag "Ask which port to use" nil) integer) + :safe 'integer-or-null-p) (defcustom php-ts-mode-ws-document-root nil "The root of the documents that the PHP built-in webserver will serve. If nil `php-ts-mode-run-php-webserver' will ask you for the document root." :tag "PHP built-in web server document root" :version "30.1" - :type 'directory) + :type '(choice (const :tag "Ask for document root" nil) directory)) (defcustom php-ts-mode-ws-workers nil "The number of workers the PHP built-in webserver will fork. Useful for testing code against multiple simultaneous requests." :tag "PHP built-in number of workers" :version "30.1" - :type 'integer - :safe 'integerp) + :type '(choice (const :tag "No workers" nil) integer) + :safe 'integer-or-null-p) (defcustom php-ts-mode-inferior-php-buffer "*PHP*" "Name of the inferior PHP buffer." diff --git a/lisp/subr.el b/lisp/subr.el index cc1e9702edc..514418112a6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4464,6 +4464,12 @@ or byte-code." (or (and (subrp object) (not (eq 'unevalled (cdr (subr-arity object))))) (byte-code-function-p object))) +(defun integer-or-null-p (object) + "Return non-nil if OBJECT is either an integer or nil. +Otherwise, return nil." + (declare (pure t) (side-effect-free error-free)) + (or (integerp object) (null object))) + (defun field-at-pos (pos) "Return the field at position POS, taking stickiness etc into account." (declare (important-return-value t)) -- 2.39.2