Skip to content

Commit

Permalink
Merge pull request #796 from emacs-php/fix/when-let
Browse files Browse the repository at this point in the history
Use `when-let*` instead of `when-let` to support Emacs 30
  • Loading branch information
zonuexe authored Dec 19, 2024
2 parents 31f702e + a59e92e commit 910391c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lisp/php-format.el
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
files)
return sym))
(setq-local php-format-command cmd))
(when-let (tup (plist-get (cdr-safe (assq cmd php-format-formatter-alist)) :command))
(when-let* (tup (plist-get (cdr-safe (assq cmd php-format-formatter-alist)) :command))
(setq executable (car tup))
(setq args (cdr tup))
(setq vendor (expand-file-name executable (expand-file-name php-format-command-dir default-directory)))
Expand Down
8 changes: 4 additions & 4 deletions lisp/php-ide.el
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
(cond
((stringp php-ide-eglot-executable) (list php-ide-eglot-executable))
((listp php-ide-eglot-executable) php-ide-eglot-executable)
((when-let (command (assq php-ide-eglot-executable php-ide-lsp-command-alist))
((when-let* (command (assq php-ide-eglot-executable php-ide-lsp-command-alist))
(cond
((functionp command) (funcall command))
((listp command) command))))))
Expand Down Expand Up @@ -196,9 +196,9 @@ ACTIVATE: T is given when activeting, NIL when deactivating PHP-IDE."
"Minor mode for integrate IDE-like tools."
:lighter php-ide-mode-lighter
(let ((ide-features php-ide-features))
(when-let (unavailable-features (cl-loop for feature in ide-features
unless (assq feature php-ide-feature-alist)
collect feature))
(when-let* (unavailable-features (cl-loop for feature in ide-features
unless (assq feature php-ide-feature-alist)
collect feature))
(user-error "%s includes unavailable PHP-IDE features. (available features are: %s)"
ide-features
(mapconcat (lambda (feature) (concat "'" (symbol-name feature)))
Expand Down
2 changes: 1 addition & 1 deletion lisp/php-project.el
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
This function is compatible with `project-find-functions'."
(let ((default-directory dir))
(when-let (root (php-project-get-root-dir))
(when-let* (root (php-project-get-root-dir))
(if (file-exists-p (expand-file-name ".git" root))
(cons 'vc root)
(cons 'transient root)))))
Expand Down
7 changes: 3 additions & 4 deletions lisp/php.el
Original file line number Diff line number Diff line change
Expand Up @@ -553,15 +553,14 @@ The order is reversed by calling as follows:
(c-backward-token-2 1 nil))
collect
(cond
((when-let (bounds (php--thing-at-point-bounds-of-string-at-point))
((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))))))))))
((buffer-substring-no-properties (point)
(save-excursion (php--c-end-of-token) (point))))))))))

(defun php-get-pattern ()
"Find the pattern we want to complete.
Expand Down

0 comments on commit 910391c

Please sign in to comment.