From d8bcd86f5c27c0ba7fd30ba8459ec5d85300f77a Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sat, 3 Mar 2018 23:46:10 +0000 Subject: [PATCH] basic doc support has been added to extensions --- lib/extensions/clojure.el | 5 ++++- lib/extensions/editor.el | 1 + lib/fg42.el | 13 +++++++------ lib/fg42/extension.el | 27 +++++++++++++++++++++------ lib/fg42/race.el | 2 +- 5 files changed, 34 insertions(+), 14 deletions(-) diff --git a/lib/extensions/clojure.el b/lib/extensions/clojure.el index 19ebddf..75b153f 100644 --- a/lib/extensions/clojure.el +++ b/lib/extensions/clojure.el @@ -17,9 +17,12 @@ (depends-on 'yesql-ghosts) (depends-on 'rainbow-delimiters) +(defun clojure-doc () + "something fun") ;; Extension ------------------------------------- (extension clojure :version "2.32" - :on-initialize extensions/clojure-initialize) + :on-initialize extensions/clojure-initialize + :docs "lib/extensions/clojure/readme.org") (provide 'extensions/clojure) diff --git a/lib/extensions/editor.el b/lib/extensions/editor.el index 743a725..827fea7 100644 --- a/lib/extensions/editor.el +++ b/lib/extensions/editor.el @@ -3,6 +3,7 @@ (require 'extensions/editor/init) ;; Dependencies ---------------------------------- +(depends-on 'adoc-mode) (depends-on 'multiple-cursors) (depends-on 'expand-region) (depends-on 'seq) diff --git a/lib/fg42.el b/lib/fg42.el index 58ddaf4..a208335 100644 --- a/lib/fg42.el +++ b/lib/fg42.el @@ -1,6 +1,6 @@ ;;; FG42 --- a simple package manager for FG42 -*- lexical-binding: t; -*- -;; Copyright (C) 2015 lxsameer +;; Copyright (C) 2010-2018 lxsameer ;; Author: Sameer Rahmani ;; Keywords: lisp fg42 IDE package manager @@ -24,11 +24,6 @@ ;; An Editor/IDE bundle base on Lovely Gnu/Emacs to make your life easier ;;; Code: -(require 'fpkg) -(require 'fg42/base) -(require 'fg42/splash) -(require 'fg42/race) - (defvar fg42-home (getenv "FG42_HOME") "The pass to fg42-home") @@ -38,6 +33,12 @@ (defvar fg42-after-initialize-hook nil "This hook will be called after FG42 initilization process.") + +(require 'fpkg) +(require 'fg42/base) +(require 'fg42/splash) +(require 'fg42/race) + (defun fg42-initialize () "Initialize FG42 editor." (run-hooks 'fg42-before-initialize-hook) diff --git a/lib/fg42/extension.el b/lib/fg42/extension.el index e9fe791..2e4aa17 100644 --- a/lib/fg42/extension.el +++ b/lib/fg42/extension.el @@ -1,3 +1,7 @@ +;;; Extebtuib --- Extension library of FG42 +;;; Commentary: +;;; Code: + ;; This library provides some basic means to create a new FG42 extensions (require 'cl-lib) @@ -6,32 +10,34 @@ "A list of all activated extensions.") (defvar disabled-abilities (make-hash-table) - "A hash of all the disabled abilities") + "A hash of all the disabled abilities.") ;; Structures ----------------------------- (cl-defstruct fg42-extension "Each FG42 extension should implement a copy of this structure." name + docs (version nil) ;; Callbacks (on-initialize nil) (on-load)) + ;; Functions ------------------------------ (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)) (defun disable (&rest abilities) - "Add the given abilities to disabled-abilities hash" + "Add the given ABILITIES to disabled-abilities hash." (dolist (abl abilities) (puthash abl t disabled-abilities))) ;; Macros --------------------------------- (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 to them. @@ -43,13 +49,22 @@ to them. ,@body))) (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)) `(setq ,name (apply 'make-fg42-extension :name ,(symbol-name name) (quote ,args)))) (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))) ,@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) +;;; extension ends here diff --git a/lib/fg42/race.el b/lib/fg42/race.el index f85b3fa..05fa940 100644 --- a/lib/fg42/race.el +++ b/lib/fg42/race.el @@ -1,4 +1,4 @@ -;;; lxdrive-mode --- A minor mode for fast cursor movement +;;; Race --- A utitlity to tweak shortkeys based on user preference ;;; Commentary: ;;; Code: (defvar user-race :god