forked from FG42/FG42
basic doc support has been added to extensions
This commit is contained in:
parent
e8191bb238
commit
d8bcd86f5c
|
@ -17,9 +17,12 @@
|
||||||
(depends-on 'yesql-ghosts)
|
(depends-on 'yesql-ghosts)
|
||||||
(depends-on 'rainbow-delimiters)
|
(depends-on 'rainbow-delimiters)
|
||||||
|
|
||||||
|
(defun clojure-doc ()
|
||||||
|
"something fun")
|
||||||
;; Extension -------------------------------------
|
;; Extension -------------------------------------
|
||||||
(extension clojure
|
(extension clojure
|
||||||
:version "2.32"
|
:version "2.32"
|
||||||
:on-initialize extensions/clojure-initialize)
|
:on-initialize extensions/clojure-initialize
|
||||||
|
:docs "lib/extensions/clojure/readme.org")
|
||||||
|
|
||||||
(provide 'extensions/clojure)
|
(provide 'extensions/clojure)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
(require 'extensions/editor/init)
|
(require 'extensions/editor/init)
|
||||||
|
|
||||||
;; Dependencies ----------------------------------
|
;; Dependencies ----------------------------------
|
||||||
|
(depends-on 'adoc-mode)
|
||||||
(depends-on 'multiple-cursors)
|
(depends-on 'multiple-cursors)
|
||||||
(depends-on 'expand-region)
|
(depends-on 'expand-region)
|
||||||
(depends-on 'seq)
|
(depends-on 'seq)
|
||||||
|
|
13
lib/fg42.el
13
lib/fg42.el
|
@ -1,6 +1,6 @@
|
||||||
;;; FG42 --- a simple package manager for FG42 -*- lexical-binding: t; -*-
|
;;; FG42 --- a simple package manager for FG42 -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Copyright (C) 2015 lxsameer
|
;; Copyright (C) 2010-2018 lxsameer
|
||||||
|
|
||||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||||
;; Keywords: lisp fg42 IDE package manager
|
;; Keywords: lisp fg42 IDE package manager
|
||||||
|
@ -24,11 +24,6 @@
|
||||||
;; An Editor/IDE bundle base on Lovely Gnu/Emacs to make your life easier
|
;; An Editor/IDE bundle base on Lovely Gnu/Emacs to make your life easier
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'fpkg)
|
|
||||||
(require 'fg42/base)
|
|
||||||
(require 'fg42/splash)
|
|
||||||
(require 'fg42/race)
|
|
||||||
|
|
||||||
(defvar fg42-home (getenv "FG42_HOME")
|
(defvar fg42-home (getenv "FG42_HOME")
|
||||||
"The pass to fg42-home")
|
"The pass to fg42-home")
|
||||||
|
|
||||||
|
@ -38,6 +33,12 @@
|
||||||
(defvar fg42-after-initialize-hook nil
|
(defvar fg42-after-initialize-hook nil
|
||||||
"This hook will be called after FG42 initilization process.")
|
"This hook will be called after FG42 initilization process.")
|
||||||
|
|
||||||
|
|
||||||
|
(require 'fpkg)
|
||||||
|
(require 'fg42/base)
|
||||||
|
(require 'fg42/splash)
|
||||||
|
(require 'fg42/race)
|
||||||
|
|
||||||
(defun fg42-initialize ()
|
(defun fg42-initialize ()
|
||||||
"Initialize FG42 editor."
|
"Initialize FG42 editor."
|
||||||
(run-hooks 'fg42-before-initialize-hook)
|
(run-hooks 'fg42-before-initialize-hook)
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
;;; Extebtuib --- Extension library of FG42
|
||||||
|
;;; Commentary:
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
;; This library provides some basic means to create a new FG42 extensions
|
;; This library provides some basic means to create a new FG42 extensions
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
|
|
||||||
|
@ -6,32 +10,34 @@
|
||||||
"A list of all activated extensions.")
|
"A list of all activated extensions.")
|
||||||
|
|
||||||
(defvar disabled-abilities (make-hash-table)
|
(defvar disabled-abilities (make-hash-table)
|
||||||
"A hash of all the disabled abilities")
|
"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."
|
||||||
name
|
name
|
||||||
|
docs
|
||||||
(version nil)
|
(version nil)
|
||||||
;; Callbacks
|
;; Callbacks
|
||||||
(on-initialize nil)
|
(on-initialize nil)
|
||||||
(on-load))
|
(on-load))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; Functions ------------------------------
|
;; Functions ------------------------------
|
||||||
|
|
||||||
(defun active-ability? (name)
|
(defun active-ability? (name)
|
||||||
"Return t if ability was not in disabled-abilities."
|
"Return t if ability with the given NAME was not in disabled-abilities."
|
||||||
(if (gethash name disabled-abilities) nil t))
|
(if (gethash name disabled-abilities) nil t))
|
||||||
|
|
||||||
(defun disable (&rest abilities)
|
(defun disable (&rest abilities)
|
||||||
"Add the given abilities to disabled-abilities hash"
|
"Add the given ABILITIES to disabled-abilities hash."
|
||||||
(dolist (abl abilities)
|
(dolist (abl abilities)
|
||||||
(puthash abl t disabled-abilities)))
|
(puthash abl t disabled-abilities)))
|
||||||
|
|
||||||
;; Macros ---------------------------------
|
;; Macros ---------------------------------
|
||||||
(defmacro ability (name deps &rest body)
|
(defmacro ability (name deps &rest body)
|
||||||
"Define an ability with the given name.
|
"Define an ability with the given NAME, DEPS, and BODY.
|
||||||
|
|
||||||
*deps* should be a list of abilities with the defined ability dependens
|
*deps* should be a list of abilities with the defined ability dependens
|
||||||
to them.
|
to them.
|
||||||
|
@ -43,13 +49,22 @@ to them.
|
||||||
,@body)))
|
,@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 by given NAME and ARGS."
|
||||||
;(declare (doc-string 1) (indent 1))
|
;(declare (doc-string 1) (indent 1))
|
||||||
`(setq ,name (apply 'make-fg42-extension :name ,(symbol-name name) (quote ,args))))
|
`(setq ,name (apply 'make-fg42-extension :name ,(symbol-name name) (quote ,args))))
|
||||||
|
|
||||||
(defmacro with-ability (name &rest body)
|
(defmacro with-ability (name &rest body)
|
||||||
"Run the block of code if an ability with the given name was not disable."
|
"If the ability with the given NAME is not disabled, Run the BODY."
|
||||||
`(when (active-ability? (intern ,(symbol-name name)))
|
`(when (active-ability? (intern ,(symbol-name name)))
|
||||||
,@body))
|
,@body))
|
||||||
|
|
||||||
|
(defun describe-extension (extension)
|
||||||
|
"Show the doc-string of the EXTENSION."
|
||||||
|
(interactive)
|
||||||
|
(let ((doc-file (fg42-extension-docs (symbol-value extension))))
|
||||||
|
(find-file (concat fg42-home "/" doc-file))
|
||||||
|
(rename-buffer (concat "*" extension " docs*"))
|
||||||
|
(read-only-mode t)))
|
||||||
|
|
||||||
(provide 'fg42/extension)
|
(provide 'fg42/extension)
|
||||||
|
;;; extension ends here
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;;; lxdrive-mode --- A minor mode for fast cursor movement
|
;;; Race --- A utitlity to tweak shortkeys based on user preference
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(defvar user-race :god
|
(defvar user-race :god
|
||||||
|
|
Loading…
Reference in New Issue