Add snippets for ‘oni-php’
This commit is contained in:
parent
5ab30e5be5
commit
e530fbfc5f
6 changed files with 95 additions and 3 deletions
|
@ -66,6 +66,16 @@ package-oni-nxml:
|
||||||
paths:
|
paths:
|
||||||
- oni-nxml/dist/
|
- oni-nxml/dist/
|
||||||
|
|
||||||
|
package-oni-php:
|
||||||
|
stage: pre-package-multifile
|
||||||
|
before_script:
|
||||||
|
- rm -rf oni-elisp/dist
|
||||||
|
script:
|
||||||
|
- cask --path oni-php package
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- oni-php/dist/
|
||||||
|
|
||||||
test-oni-alert:
|
test-oni-alert:
|
||||||
stage: test
|
stage: test
|
||||||
script: make test-oni-alert
|
script: make test-oni-alert
|
||||||
|
@ -105,6 +115,9 @@ test-oni-highlight-indent-guides:
|
||||||
|
|
||||||
test-oni-php:
|
test-oni-php:
|
||||||
stage: test
|
stage: test
|
||||||
|
dependencies:
|
||||||
|
- package-oni-php
|
||||||
|
needs: [package-oni-php]
|
||||||
script: make test-oni-php
|
script: make test-oni-php
|
||||||
|
|
||||||
package:
|
package:
|
||||||
|
@ -116,6 +129,7 @@ package:
|
||||||
- package-oni-haml
|
- package-oni-haml
|
||||||
- package-oni-html
|
- package-oni-html
|
||||||
- package-oni-nxml
|
- package-oni-nxml
|
||||||
|
- package-oni-php
|
||||||
before_script:
|
before_script:
|
||||||
- rm -rf bin/
|
- rm -rf bin/
|
||||||
- mkdir bin/
|
- mkdir bin/
|
||||||
|
|
17
GNUmakefile
17
GNUmakefile
|
@ -3,7 +3,8 @@ FILES := $(wildcard *.el)
|
||||||
PACKAGE_TARGETS := $(addprefix package-,$(FILES))
|
PACKAGE_TARGETS := $(addprefix package-,$(FILES))
|
||||||
|
|
||||||
package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css package-oni-elisp \
|
package: $(PACKAGE_TARGETS) package-oni-conf package-oni-css package-oni-elisp \
|
||||||
package-oni-haml package-oni-html package-oni-nxml package-oni-org
|
package-oni-haml package-oni-html package-oni-nxml package-oni-org \
|
||||||
|
package-oni-php
|
||||||
|
|
||||||
package-%: %
|
package-%: %
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
|
@ -53,6 +54,12 @@ package-oni-org:
|
||||||
--funcall package-initialize \
|
--funcall package-initialize \
|
||||||
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-org/dist/*.tar\") #'string>)))"
|
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-org/dist/*.tar\") #'string>)))"
|
||||||
|
|
||||||
|
package-oni-php:
|
||||||
|
emacs --batch \
|
||||||
|
--load oni-package.el \
|
||||||
|
--funcall package-initialize \
|
||||||
|
--eval "(package-upload-file (car (sort (file-expand-wildcards \"oni-php/dist/*.tar\") #'string>)))"
|
||||||
|
|
||||||
install-%:
|
install-%:
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
--load oni-package.el \
|
--load oni-package.el \
|
||||||
|
@ -117,6 +124,14 @@ install-oni-org:
|
||||||
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
|
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
|
||||||
--eval "(package-install-file (car (sort (file-expand-wildcards \"oni-org/dist/*.tar\") #'string>)))"
|
--eval "(package-install-file (car (sort (file-expand-wildcards \"oni-org/dist/*.tar\") #'string>)))"
|
||||||
|
|
||||||
|
install-oni-php:
|
||||||
|
emacs --batch \
|
||||||
|
--load oni-package.el \
|
||||||
|
--fluncall package-initialize \
|
||||||
|
--eval '(package-refresh-contents)' \
|
||||||
|
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
|
||||||
|
--eval "(package-install-file (car (sort (file-expand-wildcards \"oni-php/dist/*.tar\") #'string>)))"
|
||||||
|
|
||||||
test-%: install-%
|
test-%: install-%
|
||||||
emacs --batch \
|
emacs --batch \
|
||||||
--load oni-package.el \
|
--load oni-package.el \
|
||||||
|
|
19
oni-php/Cask
Normal file
19
oni-php/Cask
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
(source gnu)
|
||||||
|
(source melpa)
|
||||||
|
|
||||||
|
(package-file "./oni-php.el")
|
||||||
|
|
||||||
|
(depends-on "php-mode")
|
||||||
|
(depends-on "oni-yasnippet" :git "../" :files ("oni-yasnippet.el"))
|
||||||
|
(depends-on "oni-flycheck" :git "../" :files ("oni-flycheck.el"))
|
||||||
|
(depends-on "oni-company" :git "../" :files ("oni-company.el"))
|
||||||
|
(depends-on "oni-fci" :git "../" :files ("oni-fci.el"))
|
||||||
|
(depends-on "ggtags")
|
||||||
|
(depends-on "fic-mode")
|
||||||
|
(depends-on "hydra")
|
||||||
|
(depends-on "company-php")
|
||||||
|
(depends-on "phpcbf")
|
||||||
|
|
||||||
|
(files
|
||||||
|
"*.el"
|
||||||
|
("snippets" "./snippets/*"))
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 20190505200117
|
;; Version: 20190827234741
|
||||||
;; Package-Requires: (php-mode oni-flycheck oni-company oni-fci ggtags fic-mode hydra company-php phpcbf)
|
;; Package-Requires: (php-mode oni-yasnippet oni-flycheck oni-company oni-fci ggtags fic-mode hydra company-php phpcbf)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; 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
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
@ -31,6 +31,24 @@
|
||||||
(require 'company)
|
(require 'company)
|
||||||
(require 'php-mode)
|
(require 'php-mode)
|
||||||
(require 'whitespace)
|
(require 'whitespace)
|
||||||
|
(require 'yasnippet)
|
||||||
|
|
||||||
|
(defconst oni-php-root
|
||||||
|
(file-name-directory
|
||||||
|
(or load-file-name
|
||||||
|
(buffer-file-name)))
|
||||||
|
"The directory where ‘oni-php’ was loaded from.")
|
||||||
|
|
||||||
|
(defconst oni-php-snippets-dir
|
||||||
|
(expand-file-name "snippets" oni-php-root)
|
||||||
|
"The directory where ‘oni-php’ stores its snippets.")
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun oni-php-snippets-initialize ()
|
||||||
|
"Initialize the snippets for ‘oni-php’."
|
||||||
|
(when (boundp 'yas-snippet-dirs)
|
||||||
|
(add-to-list 'yas-snippet-dirs oni-php-snippets-dir))
|
||||||
|
(yas-load-directory oni-php-snippets-dir))
|
||||||
|
|
||||||
(defun oni-php--set-require-final-newline ()
|
(defun oni-php--set-require-final-newline ()
|
||||||
"Set `require-final-newline' to t.
|
"Set `require-final-newline' to t.
|
||||||
|
@ -94,6 +112,11 @@ nil for some reason."
|
||||||
(modes . '(php-mode web-mode))
|
(modes . '(php-mode web-mode))
|
||||||
(repeat . t)))
|
(repeat . t)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(with-eval-after-load 'php-mode
|
||||||
|
(with-eval-after-load 'yasnippet
|
||||||
|
(oni-php-snippets-initialize)))
|
||||||
|
|
||||||
;;;###autoload(with-eval-after-load 'php-mode (require 'oni-php))
|
;;;###autoload(with-eval-after-load 'php-mode (require 'oni-php))
|
||||||
;;;###autoload(add-to-list 'auto-mode-alist '("\\.inc\\'" . php-mode))
|
;;;###autoload(add-to-list 'auto-mode-alist '("\\.inc\\'" . php-mode))
|
||||||
;;;###autoload(add-to-list 'auto-mode-alist '("\\.module\\'" . php-mode))
|
;;;###autoload(add-to-list 'auto-mode-alist '("\\.module\\'" . php-mode))
|
8
oni-php/snippets/php-mode/function
Normal file
8
oni-php/snippets/php-mode/function
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: function
|
||||||
|
# key: function
|
||||||
|
# --
|
||||||
|
function $1($2)
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
13
oni-php/snippets/php-mode/wpheader.php
Normal file
13
oni-php/snippets/php-mode/wpheader.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# -*- mode: snippet; require-final-newline: nil -*-
|
||||||
|
# name: WP Plugin Header
|
||||||
|
# key: header
|
||||||
|
# --
|
||||||
|
/*
|
||||||
|
* Plugin Name: $1
|
||||||
|
* Plugin URI: $2
|
||||||
|
* Description: $3
|
||||||
|
* Version: ${4:1.0}
|
||||||
|
* Author: ${5:Tom Willemse}
|
||||||
|
* Author URI: ${6:https://ryuslash.org}
|
||||||
|
* License: ${7:GPLv2}
|
||||||
|
*/
|
Loading…
Reference in a new issue