mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-22 19:10:24 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
#+TITLE: :lang php
|
||||
#+TITLE: lang/php
|
||||
#+DATE: January 16, 2017
|
||||
#+SINCE: v1.3
|
||||
#+STARTUP: inlineimages nofold
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#maintainers][Maintainers]]
|
||||
- [[#module-flags][Module Flags]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#php][PHP]]
|
||||
- [[#macos][MacOS]]
|
||||
- [[#arch-linux][Arch Linux]]
|
||||
- [[#opensuse][openSUSE]]
|
||||
- [[#dependencies][Dependencies]]
|
||||
- [[#features][Features]]
|
||||
- [[#configuration][Configuration]]
|
||||
- [[#troubleshooting][Troubleshooting]]
|
||||
|
||||
* Description
|
||||
This module adds support for PHP 5.3+ (including PHP7).
|
||||
|
||||
+ ctags-based code completion (~company-php~ and ~phpctags~)
|
||||
@@ -12,17 +31,39 @@ This module adds support for PHP 5.3+ (including PHP7).
|
||||
+ [[https://github.com/hlissner/doom-snippets/tree/master/php-mode][Snippets]]
|
||||
|
||||
#+begin_quote
|
||||
PHP was the first programming language I got paid to code in, back in the Cretaceous period (2003). My sincerest apologies go out to all the programmers who inherited my earliest PHP work. I know you're out there, writhing in your straitjackets.
|
||||
PHP was the first programming language I got paid to code in, back in the
|
||||
Cretaceous period (2003). My sincerest apologies go out to all the programmers
|
||||
who inherited my earliest PHP work. I know you're out there, writhing in your
|
||||
straitjackets.
|
||||
|
||||
Save a programmer today. Stop a friend from choosing PHP as their first language.
|
||||
Save a programmer today. Stop a friend from choosing PHP as their first
|
||||
language.
|
||||
#+end_quote
|
||||
|
||||
* Table of Contents :TOC:
|
||||
- [[#install][Install]]
|
||||
- [[#php][PHP]]
|
||||
- [[#dependencies][Dependencies]]
|
||||
** Maintainers
|
||||
This module has no dedicated maintainers.
|
||||
|
||||
* Install
|
||||
** Module Flags
|
||||
+ =+hack= Add support for the [[https://hacklang.org/][Hack dialect of PHP]] by Facebook.
|
||||
+ =+lsp= Enable LSP support through phpactor. Requires the ~:tools lsp~ module
|
||||
and the phpactor server to be installed on your system.
|
||||
|
||||
** Plugins
|
||||
+ [[https://github.com/tomterl/php-boris][async]]
|
||||
+ [[https://github.com/tomterl/php-boris][php-boris]]
|
||||
+ [[https://github.com/arnested/php-extras][php-extras]]
|
||||
+ [[https://github.com/emacs-php/php-mode][php-mode]]
|
||||
+ [[https://github.com/keelerm84/php-refactor-mode.el][php-refactor-mode]]
|
||||
+ [[https://github.com/nlamirault/phpunit.el][phpunit]]
|
||||
+ =+hack=
|
||||
+ [[https://github.com/hhvm/hack-mode][hack-mode]]
|
||||
+ =+lsp=
|
||||
+ [[https://github.com/emacs-php/phpactor.el][phpactor]]
|
||||
+ [[https://github.com/emacs-php/phpactor.el][company-phpactor]]
|
||||
+ =:editor format=
|
||||
+ [[https://github.com/OVYA/php-cs-fixer][php-cs-fixer]]
|
||||
|
||||
* Prerequisites
|
||||
** PHP
|
||||
To get started with PHP, you'll need ~php~ (5.3+) and ~composer~:
|
||||
|
||||
@@ -65,3 +106,12 @@ Ensure that ~\~/.composer/vendor/bin~ is in ~PATH~:
|
||||
# place this in your profile file, like ~/.bash_profile or ~/.zshenv
|
||||
export PATH="~/.composer/vendor/bin:$PATH"
|
||||
#+END_SRC
|
||||
|
||||
* TODO Features
|
||||
# An in-depth list of features, how to use them, and their dependencies.
|
||||
|
||||
* TODO Configuration
|
||||
# How to configure this module, including common problems and how to address them.
|
||||
|
||||
* TODO Troubleshooting
|
||||
# Common issues and their solution, or places to look for help.
|
||||
|
||||
@@ -2,17 +2,6 @@
|
||||
|
||||
(defvar +php-composer-conf (make-hash-table :test 'equal))
|
||||
|
||||
;;;###autoload
|
||||
(defun +php-company-backend (command &optional arg &rest _ignored)
|
||||
"A delegating company-backend that uses `company-phpactor' if phpactor is
|
||||
available and installed, or `php-extras-company' otherwise."
|
||||
(cond ((and (require 'company-phpactor nil t)
|
||||
(ignore-errors (phpactor-find-executable)))
|
||||
(company-phpactor command arg))
|
||||
((and (require 'php-extras nil t)
|
||||
(file-exists-p (concat php-extras-eldoc-functions-file ".el")))
|
||||
(php-extras-company command arg))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +php-composer-conf (&optional project-root refresh-p)
|
||||
"Retrieve the contents of composer.json as an alist. If REFRESH-P is non-nil
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
;;; lang/php/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +php--company-backends nil
|
||||
"List of company backends to use in `php-mode'.")
|
||||
|
||||
(after! projectile
|
||||
(add-to-list 'projectile-project-root-files "composer.json"))
|
||||
|
||||
@@ -11,7 +14,7 @@
|
||||
:mode "\\.inc\\'"
|
||||
:config
|
||||
;; Disable HTML compatibility in php-mode. `web-mode' has superior support for
|
||||
;; php+html. Use the .phtml
|
||||
;; php+html. Use the .phtml extension instead.
|
||||
(setq php-template-compatibility nil)
|
||||
|
||||
(set-docsets! 'php-mode "PHP" "PHPUnit" "Laravel" "CakePHP" "CodeIgniter" "Doctrine_ORM")
|
||||
@@ -23,7 +26,10 @@
|
||||
(add-hook 'php-mode-local-vars-hook #'lsp!)
|
||||
;; `+php-company-backend' uses `company-phpactor', `php-extras-company' or
|
||||
;; `company-dabbrev-code', in that order.
|
||||
(set-company-backend! 'php-mode '+php-company-backend 'company-dabbrev-code))
|
||||
(when +php--company-backends
|
||||
(set-company-backend! 'php-mode
|
||||
(cons :separate +php--company-backends)
|
||||
'company-dabbrev-code)))
|
||||
|
||||
;; Use the smallest `sp-max-pair-length' for optimum `smartparens' performance
|
||||
(setq-hook! 'php-mode-hook sp-max-pair-length 5)
|
||||
@@ -43,10 +49,11 @@
|
||||
(use-package! phpactor
|
||||
:unless (featurep! +lsp)
|
||||
:after php-mode
|
||||
:init
|
||||
(add-to-list '+php--company-backends #'company-phpactor nil 'eq)
|
||||
:config
|
||||
(set-lookup-handlers! 'php-mode
|
||||
:definition #'phpactor-goto-definition)
|
||||
|
||||
(map! :localleader
|
||||
:map php-mode-map
|
||||
:prefix ("r" . "refactor")
|
||||
@@ -74,6 +81,8 @@
|
||||
:preface
|
||||
;; We'll set up company support ourselves
|
||||
(advice-add #'php-extras-company-setup :override #'ignore)
|
||||
:init
|
||||
(add-to-list '+php--company-backends #'php-extras-company)
|
||||
:config
|
||||
(setq php-extras-eldoc-functions-file
|
||||
(concat doom-etc-dir "php-extras-eldoc-functions"))
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; lang/php/packages.el
|
||||
|
||||
(package! php-boris)
|
||||
(package! php-extras :recipe (:host github :repo "arnested/php-extras"))
|
||||
(package! php-mode)
|
||||
(package! php-refactor-mode)
|
||||
(package! phpunit)
|
||||
(package! php-boris :pin "f2faebf610")
|
||||
(package! php-extras :recipe (:host github :repo "arnested/php-extras") :pin "d410c5af66")
|
||||
(package! php-mode :pin "b5d9988100")
|
||||
(package! php-refactor-mode :pin "7a794b0618")
|
||||
(package! phpunit :pin "fe6bc91c3b")
|
||||
|
||||
(when (featurep! +hack)
|
||||
(package! hack-mode :recipe (:host github :repo "hhvm/hack-mode")))
|
||||
(package! hack-mode :recipe (:host github :repo "hhvm/hack-mode") :pin "fd6a661b09"))
|
||||
|
||||
(unless (featurep! +lsp)
|
||||
(package! phpactor)
|
||||
(package! phpactor :pin "31fe2ea4db")
|
||||
(when (featurep! :completion company)
|
||||
(package! company-phpactor)))
|
||||
(package! company-phpactor :pin "31fe2ea4db")))
|
||||
|
||||
(when (featurep! :editor format)
|
||||
(package! php-cs-fixer))
|
||||
(package! php-cs-fixer :pin "95eace9bc0"))
|
||||
|
||||
;; For building php-extras
|
||||
(package! async :pin "86aef2c38e")
|
||||
|
||||
Reference in New Issue
Block a user