forked from FG42/FG42
development extension added
This commit is contained in:
parent
e58d80d444
commit
95d2bdfd0d
1
TODO.org
1
TODO.org
|
@ -7,4 +7,5 @@
|
||||||
*** TODO add support to main todo repository and collect todo form projects repositories
|
*** TODO add support to main todo repository and collect todo form projects repositories
|
||||||
** TODO add startup custom buffer for kuso
|
** TODO add startup custom buffer for kuso
|
||||||
** TODO add per project configuration support
|
** TODO add per project configuration support
|
||||||
|
** TODO configure `package-archive-priorities` so package.el install all packages from elpa first
|
||||||
* Release
|
* Release
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
(toggle-debug-on-error)
|
(toggle-debug-on-error)
|
||||||
(require 'fg42)
|
(require 'fg42)
|
||||||
|
|
||||||
(activate-extensions 'editor)
|
(activate-extensions 'editor
|
||||||
|
'development)
|
||||||
|
|
||||||
(fg42-initialize)
|
(fg42-initialize)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
(require 'fpkg)
|
||||||
|
(require 'fg42/extension)
|
||||||
|
(require 'extensions/development/init)
|
||||||
|
|
||||||
|
;; Dependencies ----------------------------------
|
||||||
|
(depends-on 'flycheck)
|
||||||
|
(depends-on 'company)
|
||||||
|
(depends-on 'projectile)
|
||||||
|
(depends-on 'flyspell)
|
||||||
|
(depends-on 'diff-hl)
|
||||||
|
(depends-on 'magit)
|
||||||
|
(depends-on 'indent-guide)
|
||||||
|
(depends-on 'yasnippet)
|
||||||
|
|
||||||
|
;; Extension -------------------------------------
|
||||||
|
(extension development
|
||||||
|
:version "2.67"
|
||||||
|
:on-initialize extension/development-initialize)
|
||||||
|
|
||||||
|
(provide 'extensions/development)
|
|
@ -0,0 +1,34 @@
|
||||||
|
;; Functions -------------------------------------------------
|
||||||
|
|
||||||
|
;; Quick fix for company-mode and yasnippet clashing
|
||||||
|
(defun company-yasnippet-or-completion ()
|
||||||
|
(interactive)
|
||||||
|
(if (yas/expansion-at-point)
|
||||||
|
(progn (company-abort)
|
||||||
|
(yas/expand))
|
||||||
|
(company-complete-common)))
|
||||||
|
|
||||||
|
(defun yas/expansion-at-point ()
|
||||||
|
"Tested with v0.6.1. Extracted from `yas/expand-1'"
|
||||||
|
(first (yas/current-key)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun extension/development-initialize ()
|
||||||
|
"Development plugin initialization."
|
||||||
|
(message "Initializing 'development' extension.")
|
||||||
|
|
||||||
|
(ability code-completion ()
|
||||||
|
(global-company-mode t)
|
||||||
|
(define-key company-active-map "\t" 'company-yasnippet-or-completion))
|
||||||
|
|
||||||
|
(ability yas ()
|
||||||
|
(yas-global-mode 1))
|
||||||
|
|
||||||
|
(ability project-management ()
|
||||||
|
(projectile-global-mode)
|
||||||
|
(setq projectile-enable-caching t))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
)
|
||||||
|
(provide 'extensions/development/init)
|
|
@ -5,6 +5,9 @@
|
||||||
(defvar activated-extensions ()
|
(defvar activated-extensions ()
|
||||||
"A list of all activated extensions.")
|
"A list of all activated extensions.")
|
||||||
|
|
||||||
|
(defvar disabled-abilities (make-hash-table)
|
||||||
|
"A hash of all the disabled abilities")
|
||||||
|
|
||||||
;; Structures -----------------------------
|
;; Structures -----------------------------
|
||||||
(cl-defstruct fg42-extension
|
(cl-defstruct fg42-extension
|
||||||
"Each FG42 extension should implement a copy of this structure."
|
"Each FG42 extension should implement a copy of this structure."
|
||||||
|
@ -14,6 +17,26 @@
|
||||||
(on-initialize nil)
|
(on-initialize nil)
|
||||||
(on-load))
|
(on-load))
|
||||||
|
|
||||||
|
|
||||||
|
;; Functions ------------------------------
|
||||||
|
|
||||||
|
(defun active-ability? (name)
|
||||||
|
"Return t if ability was not in disabled-abilities."
|
||||||
|
(if (gethash name disabled-abilities) nil t))
|
||||||
|
|
||||||
|
(defmacro ability (name deps &rest body)
|
||||||
|
"Define an ability with the given name.
|
||||||
|
|
||||||
|
*deps* should be a list of abilities with the defined ability dependens
|
||||||
|
to them.
|
||||||
|
|
||||||
|
*body* is a block of code which will run as the ability initializer code."
|
||||||
|
`(progn
|
||||||
|
(message "00000 %s" (active-ability? (intern ,(symbol-name name))))
|
||||||
|
(if (active-ability? (intern ,(symbol-name name)))
|
||||||
|
(if (null (delq t (mapcar 'active-ability? ,deps)))
|
||||||
|
,@body))))
|
||||||
|
|
||||||
(defmacro extension (name &rest args)
|
(defmacro extension (name &rest args)
|
||||||
"A simple DSL to define new fg42 extension."
|
"A simple DSL to define new fg42 extension."
|
||||||
`(setq ,name (apply 'make-fg42-extension :name ,(symbol-name name) (quote ,args))))
|
`(setq ,name (apply 'make-fg42-extension :name ,(symbol-name name) (quote ,args))))
|
||||||
|
|
Loading…
Reference in New Issue