pkg update and first config fix

org-brain not working, add org-roam
This commit is contained in:
2022-12-19 23:02:34 +01:00
parent 02b3e07185
commit 82f05baffe
885 changed files with 356098 additions and 36993 deletions

View File

@@ -1,13 +1,13 @@
;;; php-align.el --- Alignment configuration for PHP -*- lexical-binding: t; -*-
;; Copyright (C) 2011 tetsujin (Yusuke Segawa)
;; Copyright (C) 2020 Friends of Emacs-PHP development
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Author: tetsujin (Yusuke Segawa) <tetsujin85 (at) gmail.com>
;; Maintainer: USAMI Kenta <tadsan@zonu.me>
;; Keywords: php languages convenience align
;; Homepage: https://github.com/emacs-php/php-mode
;; Version: 1.24.0
;; Version: 1.24.2
;; License: GPL-3.0-or-later
;; This program is free software; you can redistribute it and/or modify

View File

@@ -0,0 +1,124 @@
;;; php-complete.el --- PHP auto-compiletion functions -*- lexical-binding: t; -*-
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Copyright (C) 2021, 2022 Free Software Foundation, Inc.
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 18 Sep 2022
;; Version: 1.24.2
;; Keywords: languages, php
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Provide auto-compiletion functions.
;; These functions are copied function from GNU ELPA.
;;
;; - cape--table-with-properties (cape.el)
;; - cape--bounds (cape.el)
;; - cape--interactive (cape.el)
;;; Code:
(eval-when-compile
(require 'cl-lib))
(require 'php)
(require 'php-defs)
;;;###autoload
(defgroup php-complete nil
"Auto completion for PHP edition."
:tag "PHP Completion"
:group 'php-mode)
;;;###autoload
(defcustom php-complete-function-modules '(bcmath core gmp libxml intl mbstring pcntl posix sodium xml xmlwriter)
"Module names for function names completion."
:tag "PHP Complete Function Modules"
:type (eval-when-compile `(set ,@(mapcar (lambda (elm) (list 'const (car elm)))
php-defs-functions-alist)))
:safe (lambda (value) (and (listp value) (cl-loop for v in values
always (assq v php-defs-functions-alist))))
:group 'php-complete)
;;; Cape functions:
;; These functions are copied from cape.el package. https://github.com/minad/cape
;; Thanks to original author Daniel Mendler (@minad)
(cl-defun php-complete--cape-table-with-properties (table &key category (sort t) &allow-other-keys)
"Create completion TABLE with properties.
CATEGORY is the optional completion category.
SORT should be nil to disable sorting."
(if (or (not table) (and (not category) sort))
table
(let ((metadata `(metadata
,@(and category `((category . ,category)))
,@(and (not sort) '((display-sort-function . identity)
(cycle-sort-function . identity))))))
(lambda (str pred action)
(if (eq action 'metadata)
metadata
(complete-with-action action table str pred))))))
(defun php-complete--cape-bounds (thing)
"Return bounds of THING."
(or (bounds-of-thing-at-point thing) (cons (point) (point))))
(defun php-complete--cape-interactive (capf)
"Complete with CAPF."
(let ((completion-at-point-functions (list capf)))
(or (completion-at-point) (user-error "%s: No completions" capf))))
;;; Variables:
(defvar php-complete--functions-cache (make-hash-table :test #'equal))
;;; Data source functions:
(defun php-complete--functions ()
"Return PHP function names."
(let* ((modules (sort php-complete-function-modules #'string<))
(functions (gethash modules php-complete--functions-cache)))
(unless functions
(setq functions (sort (cl-loop for module in modules
append (assq module php-defs-functions-alist))
#'string<))
(puthash modules functions php-complete--functions-cache))
functions))
;;; Compiletion function:
;;;###autoload
(defun php-complete-complete-function (&optional interactive)
"Complete PHP keyword at point.
If INTERACTIVE is nil the function acts like a capf."
(interactive (list t))
(if interactive
(php-complete--cape-interactive #'php-complete-complete-function)
(let ((bounds (php-complete--cape-bounds 'symbol))
(tokens (nreverse (php-leading-tokens 2))))
`(,(car bounds) ,(cdr bounds)
,(php-complete--cape-table-with-properties
(unless (or (member (nth 0 tokens) '("->" "::"))
(string-prefix-p "$" (nth 1 tokens)))
(php-complete--functions))
:category 'cape-keyword)
:annotation-function (lambda (_) " PHP functions")
:company-kind (lambda (_) 'keyword)
:exclusive 'no))))
(provide 'php-complete)
;;; php-complete.el ends here

3892
lisp/php-mode/php-defs.el Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
;;; php-face.el --- Face definitions for PHP script -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Friends of Emacs-PHP development
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 5 May 2019
;; Version: 1.24.0
;; Version: 1.24.2
;; Keywords: faces, php
;; Homepage: https://github.com/emacs-php/php-mode
;; License: GPL-3.0-or-later
@@ -175,7 +175,10 @@
:group 'php-faces
:tag "PHP php Tag")
(defface php-doc-annotation-tag '((t . (:inherit font-lock-constant-face)))
(defface php-doc-annotation-tag (eval-when-compile
(if (eval-when-compile (boundp 'font-lock-doc-markup-face))
'((t . (:inherit font-lock-doc-markup-face)))
'((t . (:inherit font-lock-constant-face)))))
"Face used to highlight annotation tags in doc-comment."
:group 'php-faces
:tag "PHPDoc Annotation Tag")

View File

@@ -0,0 +1,140 @@
;;; php-flymake.el --- Flymake backend for PHP -*- lexical-binding: t; -*-
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 5 Mar 2022
;; Version: 1.24.2
;; Keywords: tools, languages, php
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Flymake backend for PHP.
;;; Code:
(require 'flymake)
(require 'cl-lib)
(eval-when-compile
(require 'pcase)
(require 'rx))
(defgroup php-flymake nil
"Flymake backend for PHP."
:tag "PHP Flymake"
:group 'php)
(defcustom php-flymake-executable-command-args nil
"List of command and arguments for `php -l'."
:group 'php-flymake
:type '(repeat string)
:safe (lambda (v) (and (listp v) (cl-every v #'stringp))))
(defconst php-flymake--diaggnostics-pattern
(eval-when-compile
(rx bol (? "PHP ")
(group (or "Parse" "Fatal")) ;; 1: type, not used
" error:" (+ (syntax whitespace))
(group (+? any)) ;; 2: msg
" in " (group (+? any)) ;; 3: file, not used
" on line " (group (+ num)) ;; 4: line
eol)))
(defvar-local php-flymake--proc nil)
;;;###autoload
(defun php-flymake (report-fn &rest args)
"Flymake backend for PHP syntax check.
See `flymake-diagnostic-functions' about REPORT-FN and ARGS parameters."
(setq-local flymake-proc-allowed-file-name-masks nil)
(when (process-live-p php-flymake--proc)
(if (plist-get args :interactive)
(user-error "There's already a Flymake process running in this buffer")
(kill-process php-flymake--proc)))
(save-restriction
(widen)
(cl-multiple-value-bind (use-stdin skip) (php-flymake--buffer-status)
(unless skip
(setq php-flymake--proc (php-flymake--make-process report-fn buffer-file-name (current-buffer) use-stdin))
(when use-stdin
(process-send-region php-flymake--proc (point-min) (point-max)))
(process-send-eof php-flymake--proc)))))
(defun php-flymake--buffer-status ()
"Return buffer status about \"use STDIN\" and \"Skip diagnostic\"."
(let* ((use-stdin (or (null buffer-file-name)
(buffer-modified-p (current-buffer))
(file-remote-p buffer-file-name)))
(skip (and (not use-stdin)
(save-excursion (goto-char (point-min)) (looking-at-p "#!")))))
(cl-values use-stdin skip)))
(defun php-flymake--diagnostics (locus source)
"Parse output of `php -l' command in SOURCE buffer. LOCUS means filename."
(unless (eval-when-compile (and (fboundp 'flymake-make-diagnostic)
(fboundp 'flymake-diag-region)))
(error "`php-flymake' requires Emacs 26.1 or later"))
(cl-loop
while (search-forward-regexp php-flymake--diaggnostics-pattern nil t)
for msg = (match-string 2)
for line = (string-to-number (match-string 4))
for diag = (or (pcase-let ((`(,beg . ,end)
(flymake-diag-region source line)))
(flymake-make-diagnostic source beg end :error msg))
(flymake-make-diagnostic locus (cons line nil) nil :error msg))
return (list diag)))
(defun php-flymake--build-command-line (file)
"Return the command line for `php -l' FILE."
(let* ((command-args (or php-flymake-executable-command-args
(list (or (bound-and-true-p php-executable) "php"))))
(cmd (car-safe command-args))
(default-directory (expand-file-name "~")))
(unless (or (file-executable-p cmd)
(executable-find cmd))
(user-error "`%s' is not valid command" cmd))
(nconc command-args
(list "-d" "display_errors=0")
(when file (list "-f" file))
(list "-l"))))
(defun php-flymake--make-process (report-fn locus source use-stdin)
"Make PHP process for syntax check SOURCE buffer.
See `flymake-diagnostic-functions' about REPORT-FN parameter.
See `flymake-make-diagnostic' about LOCUS parameter."
(make-process
:name "php-flymake"
:buffer (generate-new-buffer "*flymake-php-flymake*")
:command (php-flymake--build-command-line (unless use-stdin locus))
:noquery t :connection-type 'pipe
:sentinel
(lambda (p _ev)
(unwind-protect
(when (and (eq 'exit (process-status p))
(with-current-buffer source (eq p php-flymake--proc)))
(with-current-buffer (process-buffer p)
(goto-char (point-min))
(funcall report-fn
(if (zerop (process-exit-status p))
nil
(php-flymake--diagnostics locus source)))))
(unless (process-live-p p)
;; (display-buffer (process-buffer p)) ; uncomment to debug
(kill-buffer (process-buffer p)))))))
(provide 'php-flymake)
;;; php-flymake.el ends here

View File

@@ -1,6 +1,6 @@
;;; php-local-manual.el --- Tools for local PHP manual -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Friends of Emacs-PHP development
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Author: phil-s
;; Maintainer: USAMI Kenta <tadsan@zonu.me>

View File

@@ -1,11 +1,11 @@
;;; php-mode-debug.el --- Debug functions for PHP Mode -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Friends of Emacs-PHP development
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Author: USAMI Kenta <tadsan@zonu.me>
;; URL: https://github.com/emacs-php/php-mode
;; Keywords: maint
;; Version: 1.24.0
;; Version: 1.24.2
;; License: GPL-3.0-or-later
;; This program is free software; you can redistribute it and/or modify
@@ -31,8 +31,51 @@
(require 'php-mode)
(require 'package)
(require 'pkg-info nil t)
(require 'el-get nil t)
(declare-function pkg-info-version-info "pkg-info" (library &optional package show))
(declare-function pkg-info-version-info "ext:pkg-info" (library &optional package show))
(defun php-mode-debug-reinstall (force &optional called-interactive)
"Reinstall PHP Mode to solve Cc Mode version mismatch.
When FORCE, try to reinstall without interactively asking.
When CALLED-INTERACTIVE then message the result."
(interactive (list (yes-or-no-p (if (string= php-mode-cc-version c-version)
"No need to recompile, but force PHP Mode to reinstall? "
"Force reinstall PHP Mode? "))
t))
(let* ((cc-version-mismatched (string= php-mode-cc-version c-version))
(preface (if cc-version-mismatched
""
"CC Mode has been updated. ")))
(if (catch 'success
(cond
((and (not called-interactive)
(not force)
cc-version-mismatched)
nil)
((and (package-installed-p 'php-mode)
(or force
(yes-or-no-p (format "%sReinstall `php-mode' package? " preface))))
(package-reinstall 'php-mode)
(throw 'success t))
;; This clause is not included in the byte-compiled code when compiled without El-Get
((and (eval-when-compile (and (fboundp 'el-get-package-is-installed)
(fboundp 'el-get-reinstall)))
(el-get-package-is-installed 'php-mode)
(or force
(yes-or-no-p (format "%sReinstall `php-mode' package by El-Get? " preface))))
(el-get-reinstall 'php-mode)
(throw 'success t))
((not called-interactive)
(user-error
(if cc-version-mismatched
"PHP Mode cannot be reinstalled automatically. Please try manually if necessary"
"Please reinstall or byte recompile PHP Mode files manually")))))
(user-error "PHP Mode reinstalled successfully. Please restart Emacs")
(prog1 t
(when called-interactive
(message "PHP Mode was not reinstalled"))))))
(defun php-mode-debug--buffer (&optional command &rest args)
"Return buffer for php-mode-debug, and execute `COMMAND' with `ARGS'."
@@ -62,7 +105,12 @@
(php-mode-debug--message "Pasting the following information on the issue will help us to investigate the cause.")
(php-mode-debug--message "```")
(php-mode-debug--message "--- PHP-MODE DEBUG BEGIN ---")
(php-mode-debug--message "versions: %s; %s; Cc Mode %s)" (emacs-version) (php-mode-version) c-version)
(php-mode-debug--message "versions: %s; %s; Cc Mode %s)"
(emacs-version)
(php-mode-version)
(if (string= php-mode-cc-version c-version)
c-version
(format "%s (php-mode-cc-version: %s *mismatched*)" c-version php-mode-cc-version)))
(php-mode-debug--message "package-version: %s"
(if (fboundp 'pkg-info)
(pkg-info-version-info 'php-mode)

View File

@@ -1,8 +1,6 @@
(define-package "php-mode" "20210808.1745" "Major mode for editing PHP code"
(define-package "php-mode" "20221112.1616" "Major mode for editing PHP code"
'((emacs "25.2"))
:commit "d66b4986117f621c143bc295205619e036f291d5" :authors
'(("Eric James Michael Ritz"))
:maintainer
:commit "d01cfc9cd51706e076bf7e5cbf0cfa7ee885efb4" :maintainer
'("USAMI Kenta" . "tadsan@zonu.me")
:keywords
'("languages" "php")

View File

@@ -1,6 +1,6 @@
;;; php-mode.el --- Major mode for editing PHP code -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Friends of Emacs-PHP development
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad
;; 2008 Aaron S. Hawley
;; 2011, 2012, 2013, 2014, 2015, 2016, 2017 Eric James Michael Ritz
@@ -9,12 +9,14 @@
;; Maintainer: USAMI Kenta <tadsan@zonu.me>
;; URL: https://github.com/emacs-php/php-mode
;; Keywords: languages php
;; Version: 1.24.0
;; Version: 1.24.2
;; Package-Requires: ((emacs "25.2"))
;; License: GPL-3.0-or-later
(defconst php-mode-version-number "1.24.0"
"PHP Mode version number.")
(eval-and-compile
(make-obsolete-variable
(defconst php-mode-version-number "1.24.2" "PHP Mode version number.")
"Please call (php-mode-version :as-number t) for compatibility." "1.24.2"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -79,14 +81,47 @@
(eval-when-compile
(require 'rx)
(require 'cl-lib)
(require 'flymake)
(require 'php-flymake)
(require 'regexp-opt)
(declare-function acm-backend-tabnine-candidate-expand "ext:acm-backend-tabnine"
(candidate-info bound-start))
(defvar add-log-current-defun-header-regexp)
(defvar add-log-current-defun-function)
(defvar c-syntactic-context)
(defvar c-vsemi-status-unknown-p)
(defvar syntax-propertize-via-font-lock))
(defconst php-mode-version-id
(eval-when-compile
(let ((fallback-version (format "%s-non-vcs" (with-no-warnings php-mode-version-number))))
(if (locate-dominating-file default-directory ".git")
(save-match-data
(let ((tag (replace-regexp-in-string
(rx bos "v") ""
(shell-command-to-string "git describe --tags")))
(pattern (rx (group (+ any)) eol)))
(if (string-match pattern tag)
(match-string 0 tag)
(error "Faild to obtain git tag"))))
fallback-version)))
"PHP Mode build ID.
The format is follows:
\"1.23.4\": Tagged revision, compiled under Git VCS.
\"1.23.4-56-xxxxxx\": 56 commits after the last tag release, compiled under Git.
\"1.23.4-non-vcs\": Compiled in an environment not managed by Git VCS.")
(autoload 'php-mode-debug "php-mode-debug"
"Display informations useful for debugging PHP Mode." t)
(autoload 'php-mode-debug-reinstall "php-mode-debug"
"Reinstall PHP Mode to solve Cc Mode version mismatch.
When FORCE, try to reinstall without interactively asking.
When CALLED-INTERACTIVE then message the result." t)
;; Local variables
@@ -155,6 +190,15 @@ Turning this on will open it whenever `php-mode' is loaded."
:tag "PHP Mode Page Delimiter"
:type 'regexp)
(defcustom php-mode-replace-flymake-diag-function
(eval-when-compile (when (boundp 'flymake-diagnostic-functions)
#'php-flymake))
"Flymake function to replace, if NIL do not replace."
:group 'php-mode
:tag "PHP Mode Replace Flymake Diag Function"
:type '(choice 'function
(const :tag "Disable to replace" nil)))
(define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0")
(defcustom php-mode-do-not-use-semantic-imenu t
"Customize `imenu-create-index-function' for `php-mode'.
@@ -210,7 +254,7 @@ enabled."
:type 'hook)
(defcustom php-mode-force-pear nil
"Normally PEAR coding rules are enforced only when the filename contains \"PEAR.\"
"Normally PEAR coding rules are enforced only when the filename contains \"PEAR\".
Turning this on will force PEAR rules on all PHP files."
:group 'php-mode
:tag "PHP Mode Force Pear"
@@ -226,7 +270,7 @@ have any tags inside a PHP string, it will be fooled."
:type '(choice (const :tag "Warn" t) (const "Don't warn" nil)))
(defcustom php-mode-coding-style 'pear
"Select default coding style to use with php-mode.
"Select default coding style to use with `php-mode'.
This variable can take one of the following symbol values:
`Default' - use a reasonable default style for PHP.
@@ -248,7 +292,7 @@ This variable can take one of the following symbol values:
;; Since this function has a bad influence on the environment of many users,
;; temporarily disable it
(defcustom php-mode-enable-project-coding-style nil
"When set to true override php-mode-coding-style by php-project-coding-style.
"When set to true override `php-mode-coding-style' by `php-project-coding-style'.
If you want to suppress styles from being overwritten by directory / file
local variables, set NIL."
@@ -265,18 +309,13 @@ In that case set to `NIL'."
:tag "PHP Mode Enable Backup Style Variables"
:type 'boolean)
(defcustom php-mode-disable-c-auto-align-backslashes t
"When set to non-NIL, override `c-auto-align-backslashes' to NIL."
:group 'php-mode
:tag "PHP Mode Disable c-auto-align-backslashes"
:type 'boolean)
(define-obsolete-variable-alias 'php-mode-disable-parent-mode-hooks 'php-mode-disable-c-mode-hook "1.21.0")
(defcustom php-mode-disable-c-mode-hook t
"When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')."
:group 'php-mode
:tag "PHP Mode Disable C Mode Hook"
:type 'boolean)
(make-obsolete-variable 'php-mode-disable-c-mode-hook nil "1.24.2")
(defcustom php-mode-enable-project-local-variable t
"When set to `T', apply project local variable to buffer local variable."
@@ -284,22 +323,23 @@ In that case set to `NIL'."
:tag "PHP Mode Enable Project Local Variable"
:type 'boolean)
(defconst php-mode-cc-vertion
(defconst php-mode-cc-version
(eval-when-compile c-version))
(defun php-mode-version ()
"Display string describing the version of PHP Mode."
(interactive)
(let ((fmt
(eval-when-compile
(let ((id "$Id$"))
(concat "PHP Mode %s"
(if (string= id (concat [?$ ?I ?d ?$]))
""
(concat " " id)))))))
(cl-defun php-mode-version (&key as-number)
"Display string describing the version of PHP Mode.
Although this is an interactive command, it returns a string when called
as a function. Call with AS-NUMBER keyword to compare by `version<'.
\(version<= \"1.24.1\" (php-mode-version :as-number t))"
(interactive (list :as-number nil))
(if as-number
(save-match-data (and (string-match (rx (group (+ (in ".0-9")))) php-mode-version-id)
(match-string 0 php-mode-version-id)))
(funcall
(if (called-interactively-p 'interactive) #'message #'format)
fmt php-mode-version-number)))
"PHP Mode v%s" php-mode-version-id)))
;;;###autoload
(define-obsolete-variable-alias 'php-available-project-root-files 'php-project-available-root-files "1.19.0")
@@ -412,7 +452,8 @@ In that case set to `NIL'."
(left-assoc "and")
(left-assoc "xor")
(left-assoc "or")
(left-assoc ",")))
(left-assoc ",")
(left-assoc "=>")))
;; Allow '\' when scanning from open brace back to defining
;; construct like class
@@ -574,9 +615,6 @@ might be to handle switch and goto labels differently."
php (cl-remove-if (lambda (elm) (and (listp elm) (memq 'c-annotation-face elm)))
(c-lang-const c-basic-matchers-after php)))
(c-lang-defconst c-opt-<>-sexp-key
php nil)
(defconst php-mode--re-return-typed-closure
(eval-when-compile
(rx symbol-start "function" symbol-end
@@ -591,7 +629,8 @@ might be to handle switch and goto labels differently."
(group "{"))))
(defun php-c-lineup-arglist (langelem)
"Line up the current argument line under the first argument using `c-lineup-arglist' LANGELEM."
"Line up the current argument line under the first argument using
`c-lineup-arglist' LANGELEM."
(let (in-return-typed-closure)
(when (and (consp langelem)
(eq 'arglist-cont-nonempty (car langelem)))
@@ -606,12 +645,40 @@ might be to handle switch and goto labels differently."
(defun php-lineup-cascaded-calls (langelem)
"Line up chained methods using `c-lineup-cascaded-calls',
but only if the setting is enabled"
(if php-mode-lineup-cascaded-calls
(c-lineup-cascaded-calls langelem)
but only if the setting is enabled."
(cond
(php-mode-lineup-cascaded-calls (c-lineup-cascaded-calls langelem))
((assq 'arglist-cont-nonempty c-syntactic-context) nil)
((assq 'defun-block-intro c-syntactic-context) nil)
((assq 'defun-close c-syntactic-context) nil)
((assq 'statement-cont c-syntactic-context) nil)
(t
(save-excursion
(beginning-of-line)
(if (looking-at-p "\\s-*->") '+ nil))))
(let ((beginning-of-langelem (cdr langelem))
(beginning-of-current-line (point))
start)
(skip-chars-forward " ")
(cond
((looking-at-p "->") '+)
((looking-at-p "[:?]") '+)
((looking-at-p "[,;]") nil)
;; Is the previous line terminated with `,' ?
((progn
(forward-line -1)
(end-of-line)
(skip-chars-backward " ")
(backward-char 1)
(while (and (< beginning-of-langelem (point))
(setq start (php-in-string-or-comment-p)))
(goto-char start)
(skip-chars-backward " ")
(backward-char 1))
(and (not (eq (point) beginning-of-current-line))
(not (looking-at-p ","))
(not (php-in-string-or-comment-p))))
'+)
(t nil)))))))
(defun php-c-looking-at-or-maybe-in-bracelist (&optional _containing-sexp lim)
"Replace `c-looking-at-or-maybe-in-bracelist'.
@@ -669,7 +736,7 @@ a backward search limit."
(tab-width . 4)))
(defun php-enable-pear-coding-style ()
"Set up php-mode to use the coding styles preferred for PEAR code and modules."
"Set up `php-mode' to use the coding styles preferred for PEAR code and modules."
(interactive)
(php-set-style "pear"))
@@ -684,7 +751,7 @@ a backward search limit."
(php-style-delete-trailing-whitespace . t)))
(defun php-enable-drupal-coding-style ()
"Make php-mode use coding styles that are preferable for working with Drupal."
"Make `php-mode' use coding styles that are preferable for working with Drupal."
(interactive)
(php-set-style "drupal"))
@@ -698,7 +765,8 @@ a backward search limit."
(fill-column . 78)))
(defun php-enable-wordpress-coding-style ()
"Make php-mode use coding styles that are preferable for working with Wordpress."
"Make `php-mode' use coding styles that are preferable for working with
Wordpress."
(interactive)
(php-set-style "wordpress"))
@@ -711,7 +779,7 @@ a backward search limit."
(fill-column . 78)))
(defun php-enable-symfony2-coding-style ()
"Make php-mode use coding styles that are preferable for working with Symfony2."
"Make `php-mode' use coding styles that are preferable for working with Symfony2."
(interactive)
(php-set-style "symfony2"))
@@ -726,7 +794,7 @@ a backward search limit."
(php-style-delete-trailing-whitespace . t)))
(defun php-enable-psr2-coding-style ()
"Make php-mode comply to the PSR-2 coding style."
"Make `php-mode' comply to the PSR-2 coding style."
(interactive)
(php-set-style "psr2"))
@@ -772,9 +840,8 @@ See `php-beginning-of-defun'."
(save-match-data
(not (or (re-search-forward html-tag-re (line-end-position) t)
(re-search-backward html-tag-re (line-beginning-position) t)))))
(progn
(goto-char here)
t)
(prog1 t
(goto-char here))
(goto-char here)
(setq php-warned-bad-indent t)
(let* ((known-multi-libs '(("mumamo" mumamo (lambda () (nxhtml-mumamo)))
@@ -835,9 +902,9 @@ example `html-mode'. Known such libraries are:\n\t"
nil))))
(defun php-cautious-indent-region (start end &optional quiet)
"Carefully indent region `START' `END' in contexts other than HTML templates.
"Carefully indent region START to END in contexts other than HTML templates.
If the optional argument `QUIET' is non-nil then no syntactic errors are
If the optional argument QUIET is non-nil then no syntactic errors are
reported, even if `c-report-syntactic-errors' is non-nil."
(if (or (not php-mode-warn-if-mumamo-off)
(not (php-in-poly-php-html-mode))
@@ -852,9 +919,6 @@ reported, even if `c-report-syntactic-errors' is non-nil."
php-warned-bad-indent
(php-check-html-for-indentation))
(let ((here (point))
(c-auto-align-backslashes
(unless php-mode-disable-c-auto-align-backslashes
c-auto-align-backslashes))
doit)
(move-beginning-of-line nil)
;; Don't indent heredoc end mark
@@ -899,8 +963,8 @@ This is was done due to the problem reported here:
(defun php-lineup-string-cont (langelem)
"Line up string toward equal sign or dot.
e.g.
$str = 'some'
. 'string';
$str \= \'some\'
. \'string\';
this ^ lineup"
(save-excursion
(goto-char (cdr langelem))
@@ -942,7 +1006,8 @@ this ^ lineup"
"Regular expression for the start of a PHP heredoc."))
(defun php-heredoc-end-re (heredoc-start)
"Build a regular expression for the end of a heredoc started by the string HEREDOC-START."
"Build a regular expression for the end of a heredoc started by the string
HEREDOC-START."
;; Extract just the identifier without <<< and quotes.
(string-match "\\_<.+?\\_>" heredoc-start)
(concat "^\\s-*\\(" (match-string 0 heredoc-start) "\\)\\W"))
@@ -983,7 +1048,7 @@ this ^ lineup"
(put-text-property start (1+ start) 'syntax-table (string-to-syntax "."))))
(defvar-local php-mode--propertize-extend-region-current nil
"Prevent undesirable recursion in PHP-SYNTAX-PROPERTIZE-EXTEND-REGION")
"Prevent undesirable recursion in PHP-SYNTAX-PROPERTIZE-EXTEND-REGION.")
(defun php-syntax-propertize-extend-region (start end)
"Extend the propertize region if START or END falls inside a PHP heredoc."
@@ -1013,7 +1078,7 @@ this ^ lineup"
(setq php-mode--propertize-extend-region-current
(delete pair php-mode--propertize-extend-region-current))))))
(easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands"
(easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands."
(cons "PHP" (c-lang-const c-mode-menu php)))
(defun php-mode-get-style-alist ()
@@ -1076,7 +1141,7 @@ After setting the stylevars run hooks according to STYLENAME
((equal stylename "psr2") (run-hooks 'php-mode-psr2-hook))))
(defun php-mode--disable-delay-set-style (&rest _args)
"Disable php-mode-set-style-delay on after hook. `ARGS' be ignore."
"Disable `php-mode-set-style-delay' on after hook. ARGS be ignore."
(setq php-mode--delayed-set-style nil)
(advice-remove #'php-mode--disable-delay-set-style #'c-set-style))
@@ -1094,6 +1159,14 @@ After setting the stylevars run hooks according to STYLENAME
(php-project-apply-local-variables)
(remove-hook 'hack-local-variables-hook #'php-mode-set-local-variable-delay))
(defun php-mode-neutralize-cc-mode-effect ()
"Reset PHP-irrelevant variables set by Cc Mode initialization."
(setq-local c-mode-hook nil)
(setq-local java-mode-hook nil)
(when (eval-when-compile (boundp 'flymake-diagnostic-functions))
(remove-hook 'flymake-diagnostic-functions 'flymake-cc t))
t)
(defvar php-mode-syntax-table
(let ((table (make-syntax-table)))
(c-populate-syntax-table table)
@@ -1114,18 +1187,19 @@ After setting the stylevars run hooks according to STYLENAME
;; :after-hook (c-update-modeline)
;; (setq abbrev-mode t)
(unless (string= php-mode-cc-vertion c-version)
(user-error "CC Mode has been updated. %s"
(if (package-installed-p 'php-mode)
"Please run `M-x package-reinstall php-mode' command."
"Please byte recompile PHP Mode files.")))
(unless (string= php-mode-cc-version c-version)
(php-mode-debug-reinstall))
(if php-mode-disable-c-mode-hook
(php-mode-neutralize-cc-mode-effect)
(display-warning 'php-mode
"`php-mode-disable-c-mode-hook' will be removed. Do not depends on this variable."
:warning))
(when php-mode-disable-c-mode-hook
(setq-local c-mode-hook nil)
(setq-local java-mode-hook nil))
(c-initialize-cc-mode t)
(c-init-language-vars php-mode)
(c-common-init 'php-mode)
(setq-local c-auto-align-backslashes nil)
(setq-local comment-start "// ")
(setq-local comment-start-skip
@@ -1196,11 +1270,20 @@ After setting the stylevars run hooks according to STYLENAME
(setq-local add-log-current-defun-function nil)
(setq-local add-log-current-defun-header-regexp php-beginning-of-defun-regexp)
(when (and (eval-when-compile (boundp 'flymake-diagnostic-functions))
php-mode-replace-flymake-diag-function)
(add-hook 'flymake-diagnostic-functions php-mode-replace-flymake-diag-function nil t))
(when (fboundp 'c-looking-at-or-maybe-in-bracelist)
(advice-add #'c-looking-at-or-maybe-in-bracelist
:override 'php-c-looking-at-or-maybe-in-bracelist '(local)))
(advice-add #'fixup-whitespace :after #'php-mode--fixup-whitespace-after '(local))
(when (fboundp #'acm-backend-tabnine-candidate-expand)
(advice-add #'acm-backend-tabnine-candidate-expand
:filter-args #'php-acm-backend-tabnine-candidate-expand-filter-args
'(local)))
(when (>= emacs-major-version 25)
(with-silent-modifications
(save-excursion
@@ -1248,15 +1331,30 @@ for \\[find-tag] (which see)."
(message "Unknown function: %s" tagname))))
;; Font Lock
(defconst php-phpdoc-type-keywords
(defconst php-phpdoc-type-names
(list "string" "integer" "int" "boolean" "bool" "float"
"double" "object" "mixed" "array" "resource"
"void" "null" "false" "true" "self" "static"
"callable" "iterable" "number"))
"callable" "iterable" "number"
;; PHPStan and Psalm types
"array-key" "associative-array" "callable-array" "callable-object"
"callable-string" "class-string" "empty" "enum-string" "list"
"literal-string" "negative-int" "non-positive-int" "non-negative-int"
"never" "never-return" "never-returns" "no-return" "non-empty-array"
"non-empty-list" "non-empty-string" "non-falsy-string"
"numeric" "numeric-string" "positive-int" "scalar"
"trait-string" "truthy-string" "key-of" "value-of")
"A list of type and pseudotype names that can be used in PHPDoc.")
(make-obsolete-variable 'php-phpdoc-type-keywords 'php-phpdoc-type-names "1.24.2")
(defconst php-phpdoc-type-tags
(list "package" "param" "property" "property-read" "property-write"
"return" "throws" "var"))
"return" "throws" "var" "self-out" "this-out" "param-out"
"type" "extends" "require-extends" "implemtents" "require-implements"
"template" "template-covariant" "template-extends" "template-implements"
"assert" "assert-if-true" "assert-if-false" "if-this-is")
"A list of tags specifying type names.")
(defconst php-phpdoc-font-lock-doc-comments
`(("{@[-[:alpha:]]+\\s-*\\([^}]*\\)}" ; "{@foo ...}" markup.
@@ -1266,11 +1364,11 @@ for \\[find-tag] (which see)."
(1 'php-doc-variable-sigil prepend nil)
(2 'php-variable-name prepend nil))
("\\(\\$\\)\\(this\\)\\>" (1 'php-doc-$this-sigil prepend nil) (2 'php-doc-$this prepend nil))
(,(concat "\\s-@" (regexp-opt php-phpdoc-type-tags) "\\s-+"
(,(concat "\\s-@" (rx (? (or "phan" "phpstan" "psalm") "-")) (regexp-opt php-phpdoc-type-tags) "\\s-+"
"\\(" (rx (+ (? "?") (? "\\") (+ (in "0-9A-Z_a-z")) (? "[]") (? "|"))) "\\)+")
1 'php-string prepend nil)
(,(concat "\\(?:|\\|\\?\\|\\s-\\)\\("
(regexp-opt php-phpdoc-type-keywords 'words)
(regexp-opt php-phpdoc-type-names 'words)
"\\)")
1 font-lock-type-face prepend nil)
("https?://[^\n\t ]+"
@@ -1447,12 +1545,10 @@ for \\[find-tag] (which see)."
(defvar php-font-lock-keywords php-font-lock-keywords-3
"Default expressions to highlight in PHP Mode.")
(add-to-list
(eval-when-compile
(if (boundp 'flymake-proc-allowed-file-name-masks)
'flymake-proc-allowed-file-name-masks
'flymake-allowed-file-name-masks))
'("\\.php[345s]?\\'" php-flymake-php-init))
(eval-when-compile
(unless (boundp 'flymake-proc-allowed-file-name-masks)
(add-to-list 'flymake-allowed-file-name-masks
'("\\.php[345s]?\\'" php-flymake-php-init))))
(defun php-send-region (start end)
@@ -1491,6 +1587,17 @@ The output will appear in the buffer *PHP*."
(forward-char -2)
(looking-at-p "->\\|::")))
(delete-char 1)))
;; Advice for lsp-bridge' acm-backend-tabnine
;; see https://github.com/manateelazycat/lsp-bridge/issues/402#issuecomment-1305653058
(defun php-acm-backend-tabnine-candidate-expand-filter-args (args)
"Adjust to replace bound-start ARGS for Tabnine in PHP."
(cl-multiple-value-bind (candidate-info bound-start) args
(save-excursion
(goto-char bound-start)
(when (looking-at-p (eval-when-compile (regexp-quote "$")))
(setq bound-start (1+ bound-start))))
(list candidate-info bound-start)))
;;;###autoload
(progn

View File

@@ -1,11 +1,11 @@
;;; php-project.el --- Project support for PHP application -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Friends of Emacs-PHP development
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Keywords: tools, files
;; URL: https://github.com/emacs-php/php-mode
;; Version: 1.24.0
;; Version: 1.24.2
;; License: GPL-3.0-or-later
;; This program is free software; you can redistribute it and/or modify
@@ -282,6 +282,17 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
php-project-root
(php-project--detect-root-dir)))
;;;###autoload
(defun php-project-project-find-function (dir)
"Return path to current PHP project from DIR.
This function is compatible with `project-find-functions'."
(let ((default-directory dir))
(when-let (root (php-project-get-root-dir))
(if (file-exists-p (expand-file-name ".git" root))
(cons 'vc root)
(cons 'transient root)))))
(defun php-project--detect-root-dir ()
"Return detected project root."
(if (and php-project-use-projectile-to-detect-root

View File

@@ -1,10 +1,11 @@
;;; php.el --- PHP support for friends -*- lexical-binding: t; -*-
;; Copyright (C) 2020 Friends of Emacs-PHP development
;; Copyright (C) 2022 Friends of Emacs-PHP development
;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 5 Dec 2018
;; Version: 1.24.0
;; Version: 1.24.2
;; Keywords: languages, php
;; Homepage: https://github.com/emacs-php/php-mode
;; License: GPL-3.0-or-later
@@ -26,9 +27,16 @@
;; This file provides common variable and functions for PHP packages.
;; These functions are copied function from GNU Emacs.
;;
;; - c-end-of-token (cc-engine.el)
;;
;;; Code:
(eval-when-compile
(require 'cc-mode)
(require 'cl-lib))
(require 'cc-engine)
(require 'flymake)
(require 'php-project)
(require 'rx)
@@ -60,16 +68,16 @@ The URL to use open PHP manual and search word."
You can replace \"en\" with your ISO language code."
:group 'php
:tag "PHP Manual URL"
:type '(choice (const :tag "English" 'en)
(const :tag "Brazilian Portuguese" 'pt_BR)
(const :tag "Chinese (Simplified)" 'zh)
(const :tag "French" 'fr)
(const :tag "German" 'de)
(const :tag "Japanese" 'ja)
(const :tag "Romanian" 'ro)
(const :tag "Russian" 'ru)
(const :tag "Spanish" 'es)
(const :tag "Turkish" 'tr)
:type '(choice (const :tag "English" en)
(const :tag "Brazilian Portuguese" pt_BR)
(const :tag "Chinese (Simplified)" zh)
(const :tag "French" fr)
(const :tag "German" de)
(const :tag "Japanese" ja)
(const :tag "Romanian" ro)
(const :tag "Russian" ru)
(const :tag "Spanish" es)
(const :tag "Turkish" tr)
(string :tag "PHP manual URL")))
(defcustom php-search-url nil
@@ -203,15 +211,27 @@ a completion list."
These are different from \"constants\" in strict terms.
see https://www.php.net/manual/language.constants.predefined.php")
(defconst php-re-token-symbols
(eval-when-compile
(regexp-opt (list "&" "&=" "array(" "(array)" "&&" "||" "(bool)" "(boolean)" "break;" "?>" "%>"
"??" "??=" ".=" "--" "/=" "=>" "(real)" "(double)" "(float)" "::" "..."
"__halt_compiler()" "++" "(int)" "(integer)" "==" ">=" "===" "!=" "<>" "!=="
"<=" "-=" "%=" "*=" "\\" "(object)" "->" "?->" "<?php" "<?" "<?=" "|=" "+="
"**" "**=" "<<" "<<=" "<=>" ">>" ">>=" "<<<" "(string)" "^=" "yield from"
"[" "]" "(" ")" "{" "}" ";")
t)))
;;; Utillity for locate language construction
(defsubst php-in-string-p ()
"Return non-nil if inside a string.
it is the character that will terminate the string, or t if the string should be terminated by a generic string delimiter."
It is the character that will terminate the string, or t if the string should
be terminated by a generic string delimiter."
(nth 3 (syntax-ppss)))
(defsubst php-in-comment-p ()
"Return nil if outside a comment, t if inside a non-nestable comment, else an integer (the current comment nesting)."
"Return NIL if outside a comment, T if inside a non-nestable comment, else
an integer (the current comment nesting)."
(nth 4 (syntax-ppss)))
(defsubst php-in-string-or-comment-p ()
@@ -241,12 +261,12 @@ it is the character that will terminate the string, or t if the string should be
"Make a regular expression for methods with the given VISIBILITY.
VISIBILITY must be a string that names the visibility for a PHP
method, e.g. 'public'. The parameter VISIBILITY can itself also
method, e.g. \'public\'. The parameter VISIBILITY can itself also
be a regular expression.
The regular expression this function returns will check for other
keywords that can appear in method signatures, e.g. 'final' and
'static'. The regular expression will have one capture group
keywords that can appear in method signatures, e.g. \'final\' and
\'static\'. The regular expression will have one capture group
which will be the name of the method."
(when (stringp visibility)
(setq visibility (list visibility)))
@@ -273,8 +293,8 @@ which will be the name of the method."
'((* any) line-end))))))
(defun php-create-regexp-for-classlike (type)
"Accepts a `TYPE' of a 'classlike' object as a string, such as
'class' or 'interface', and returns a regexp as a string which
"Accepts a `TYPE' of a \'classlike\' object as a string, such as
\'class\' or \'interface\', and returns a regexp as a string which
can be used to match against definitions for that classlike."
(concat
;; First see if 'abstract' or 'final' appear, although really these
@@ -409,8 +429,8 @@ can be used to match against definitions for that classlike."
(defcustom php-imenu-generic-expression 'php-imenu-generic-expression-default
"Default Imenu generic expression for PHP Mode. See `imenu-generic-expression'."
:type '(choice (alist :key-type string :value-type list)
(const 'php-imenu-generic-expression-legacy)
(const 'php-imenu-generic-expression-simple)
(const php-imenu-generic-expression-legacy)
(const php-imenu-generic-expression-simple)
variable)
:group 'php)
@@ -422,6 +442,17 @@ can be used to match against definitions for that classlike."
(eval-when-compile
(php-create-regexp-for-classlike (regexp-opt '("class" "interface" "trait")))))
(defvar php--analysis-syntax-table
(eval-when-compile
(let ((table (make-syntax-table)))
(c-populate-syntax-table table)
(modify-syntax-entry ?_ "w" table)
(modify-syntax-entry ?` "\"" table)
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?# "< b" table)
(modify-syntax-entry ?\n "> b" table)
table)))
(defun php-get-current-element (re-pattern)
"Return backward matched element by RE-PATTERN."
(save-excursion
@@ -429,27 +460,88 @@ can be used to match against definitions for that classlike."
(when (re-search-backward re-pattern nil t)
(match-string-no-properties 1)))))
(defun php-get-pattern ()
"Find the pattern we want to complete.
`find-tag-default' from GNU Emacs etags.el"
(eval-and-compile
(if (eval-when-compile (fboundp 'thing-at-point-bounds-of-string-at-point))
(defalias 'php--thing-at-point-bounds-of-string-at-point #'thing-at-point-bounds-of-string-at-point)
;; Copyright (C) 1991-1998, 2000-2022 Free Software Foundation, Inc.
;; Follows function is copied from Emacs 28's thingatpt.el.
;; https://github.com/emacs-mirror/emacs/commit/2abf143f8185fced544c4f8d144ea710142d7a59
(defun php--thing-at-point-bounds-of-string-at-point ()
"Return the bounds of the string at point.
Prefer the enclosing string with fallback on sexp at point.
\[Internal function used by `bounds-of-thing-at-point'.]"
(save-excursion
(let ((ppss (syntax-ppss)))
(if (nth 3 ppss)
;; Inside the string
(ignore-errors
(goto-char (nth 8 ppss))
(cons (point) (progn (forward-sexp) (point))))
;; At the beginning of the string
(if (eq (char-syntax (char-after)) ?\")
(let ((bound (bounds-of-thing-at-point 'sexp)))
(and bound
(<= (car bound) (point)) (< (point) (cdr bound))
bound))))))))
(if (eval-when-compile (fboundp 'c-end-of-token))
(defalias 'php--c-end-of-token #'c-end-of-token)
;; Copyright (C) 1985, 1987, 1992-2022 Free Software Foundation, Inc.
;; Follows function is copied from Emacs 27's cc-engine.el.
;; https://emba.gnu.org/emacs/emacs/-/commit/95fb826dc58965eac287c0826831352edf2e56f7
(defun php--c-end-of-token (&optional back-limit)
;; Move to the end of the token we're just before or in the middle of.
;; BACK-LIMIT may be used to bound the backward search; if given it's
;; assumed to be at the boundary between two tokens. Return non-nil if the
;; point is moved, nil otherwise.
;;
;; This function might do hidden buffer changes.
(let ((start (point)))
(cond ;; ((< (skip-syntax-backward "w_" (1- start)) 0)
;; (skip-syntax-forward "w_"))
((> (skip-syntax-forward "w_") 0))
((< (skip-syntax-backward ".()" back-limit) 0)
(while (< (point) start)
(if (looking-at c-nonsymbol-token-regexp)
(goto-char (match-end 0))
;; `c-nonsymbol-token-regexp' should always match since
;; we've skipped backward over punctuation or paren
;; syntax, but move forward in case it doesn't so that
;; we don't leave point earlier than we started with.
(forward-char))))
(t (if (looking-at c-nonsymbol-token-regexp)
(goto-char (match-end 0)))))
(> (point) start)))))
(defun php-leading-tokens (length)
"Return a list of leading LENGTH tokens from cursor point.
The token list is lined up in the opposite side of the visual arrangement.
The order is reversed by calling as follows:
\(nreverse \(php-leading-tokens 3\)\)"
(save-excursion
(save-match-data
(while (looking-at "\\sw\\|\\s_")
(forward-char 1))
(when (or (re-search-backward "\\sw\\|\\s_"
(save-excursion (beginning-of-line) (point))
t)
(re-search-forward "\\(\\sw\\|\\s_\\)+"
(save-excursion (end-of-line) (point))
t))
(goto-char (match-end 0))
(buffer-substring-no-properties
(point)
(progn
(forward-sexp -1)
(while (looking-at "\\s'")
(forward-char 1))
(point)))))))
(with-syntax-table php--analysis-syntax-table
(cl-loop
repeat length
do (progn
(forward-comment (- (point)))
(c-backward-token-2 1 nil))
collect
(cond
((when-let (bounds (php--thing-at-point-bounds-of-string-at-point))
(prog1 (buffer-substring-no-properties (car bounds) (cdr bounds))
(goto-char (car bounds)))))
((looking-at php-re-token-symbols)
(prog1 (match-string-no-properties 0)
(goto-char (match-beginning 0))))
(t
(buffer-substring-no-properties (point)
(save-excursion (php--c-end-of-token) (point))))))))))
(defun php-get-pattern ()
"Find the pattern we want to complete.
`find-tag-default' from GNU Emacs etags.el."
(car (php-leading-tokens 1)))
;;; Provide support for Flymake so that users can see warnings and
;;; errors in real-time as they write code.
@@ -458,11 +550,9 @@ can be used to match against definitions for that classlike."
This is an alternative function of `flymake-php-init'.
Look at the `php-executable' variable instead of the constant \"php\" command."
(let* ((init (funcall (eval-when-compile
(if (fboundp 'flymake-proc-php-init)
'flymake-proc-php-init
'flymake-php-init)))))
(list php-executable (cdr init))))
(let ((init (with-no-warnings (flymake-php-init))))
(setf (car init) php-executable)
init))
(defconst php-re-detect-html-tag-aggressive
(eval-when-compile
@@ -490,8 +580,8 @@ Look at the `php-executable' variable instead of the constant \"php\" command."
"Regexp pattern variable-name of HTML detection."
:group 'php
:tag "PHP Re Detect HTML Tag"
:type '(choice (const :tag "Default pattern" 'php-re-detect-html-tag-default)
(const :tag "Aggressive pattern" 'php-re-detect-html-tag-aggressive)
:type '(choice (const :tag "Default pattern" php-re-detect-html-tag-default)
(const :tag "Aggressive pattern" php-re-detect-html-tag-aggressive)
(variable :tag "Variable name of RegExp pattern")))
(defsubst php-re-detect-html-tag ()
@@ -583,7 +673,8 @@ When `DOCUMENT-ROOT' is NIL, the document root is obtained from `ROUTER-OR-DIR'.
(read-number "Port: " php-default-builtin-web-server-port)
(if (file-directory-p d-o-r)
nil
(let ((root-input (read-file-name "Document root: " (directory-file-name d-o-r))))
(let ((root-input (expand-file-name
(read-file-name "Document root: " (directory-file-name d-o-r)))))
(file-name-directory
(if (file-directory-p root-input)
root-input
@@ -600,8 +691,8 @@ When `DOCUMENT-ROOT' is NIL, the document root is obtained from `ROUTER-OR-DIR'.
port
short-dirname
(if document-root short-filename "")))
(args (cl-remove-if
#'null
(args (delq
nil
(list "-S"
(format "%s:%d" hostname port)
"-t"