GNU bug report logs - #76955
30.1; php-ts-mode-php-executable default path may not match remote path

Previous Next

Package: emacs;

Reported by: Morgan Willcock <morgan <at> ice9.digital>

Date: Tue, 11 Mar 2025 20:11:02 UTC

Severity: normal

Found in version 30.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Vincenzo Pupillo <v.pupillo <at> gmail.com>
To: Morgan Willcock <morgan <at> ice9.digital>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 76955 <at> debbugs.gnu.org
Subject: bug#76955: 30.1; php-ts-mode-php-executable default path may not match remote path
Date: Tue, 18 Mar 2025 21:25:02 +0100
In data martedì 18 marzo 2025 13:46:05 Ora standard dell’Europa centrale, Eli 
Zaretskii ha scritto:
> > From: Morgan Willcock <morgan <at> ice9.digital>
> > Cc: Eli Zaretskii <eliz <at> gnu.org>,  76955 <at> debbugs.gnu.org
> > Date: Mon, 17 Mar 2025 22:30:03 +0000
> > 
> > Vincenzo Pupillo <v.pupillo <at> gmail.com> writes:
> > > Ciao Eli, this is the new patch.
> > 
> > Hi Vincenzo,
> > 
> > The php binaries which I use are installed with pkgsrc, which supports
> > installing multiple versions of PHP, installed as bin/php${PHP_VERSION}.
> > One of those versions would be available as bin/php.
> > 
> > If I have two remote versions installed, and one of them is found by
> > executable-find searching for "php", I cannot see how I would select the
> > other version once the patch is applied.
> 
> How do you do this with the current version of php-ts-mode?
> 
> > Shouldn't the search name "php" be configurable to allow the name to be
> > 
> > overridden?  Something like this:
> >   (executable-find php-program t)
> > 
> > where php-program defaults to being "php".
> 
> It's possible to add this, but it would be a separate feature.

My proposal is this:

(defvar-local php-ts-mode-alternative-php-program-name nil
  "An alternative to the usual `php' program name.
In non-nil, `php-ts-mode--executable' try to find this executable.")

(defun php-ts-mode--executable ()
  "Return the absolute filename of the `php' executable.
If the `default-directory' is remote, search on a remote host, otherwise
return `php-ts-mode-php-default-executable'.  If
`php-ts-mode-alternative-php-program-name' is non-nil, finds this program
instead of the usual `php'."
  (let ((php-prog
         (if (file-remote-p default-directory)
             (executable-find
              (or php-ts-mode-alternative-php-program-name "php") t)
           (if php-ts-mode-alternative-php-program-name
               (executable-find
                php-ts-mode-alternative-php-program-name)
             php-ts-mode-php-default-executable))))
    php-prog))

WDYT?

Vincenzo








This bug report was last modified 112 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.