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:
|
||||
- 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:
|
||||
stage: test
|
||||
script: make test-oni-alert
|
||||
|
@ -105,6 +115,9 @@ test-oni-highlight-indent-guides:
|
|||
|
||||
test-oni-php:
|
||||
stage: test
|
||||
dependencies:
|
||||
- package-oni-php
|
||||
needs: [package-oni-php]
|
||||
script: make test-oni-php
|
||||
|
||||
package:
|
||||
|
@ -116,6 +129,7 @@ package:
|
|||
- package-oni-haml
|
||||
- package-oni-html
|
||||
- package-oni-nxml
|
||||
- package-oni-php
|
||||
before_script:
|
||||
- rm -rf bin/
|
||||
- mkdir bin/
|
||||
|
|
17
GNUmakefile
17
GNUmakefile
|
@ -3,7 +3,8 @@ FILES := $(wildcard *.el)
|
|||
PACKAGE_TARGETS := $(addprefix package-,$(FILES))
|
||||
|
||||
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-%: %
|
||||
emacs --batch \
|
||||
|
@ -53,6 +54,12 @@ package-oni-org:
|
|||
--funcall package-initialize \
|
||||
--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-%:
|
||||
emacs --batch \
|
||||
--load oni-package.el \
|
||||
|
@ -117,6 +124,14 @@ install-oni-org:
|
|||
$(foreach DEP,$(DEPS),--eval "(package-install-file \"$(DEP).el\")") \
|
||||
--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-%
|
||||
emacs --batch \
|
||||
--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>
|
||||
;; Keywords: local
|
||||
;; Version: 20190505200117
|
||||
;; Package-Requires: (php-mode oni-flycheck oni-company oni-fci ggtags fic-mode hydra company-php phpcbf)
|
||||
;; Version: 20190827234741
|
||||
;; 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
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,6 +31,24 @@
|
|||
(require 'company)
|
||||
(require 'php-mode)
|
||||
(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 ()
|
||||
"Set `require-final-newline' to t.
|
||||
|
@ -94,6 +112,11 @@ nil for some reason."
|
|||
(modes . '(php-mode web-mode))
|
||||
(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(add-to-list 'auto-mode-alist '("\\.inc\\'" . 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