Several docstrings have been fixed
This commit is contained in:
parent
6a8f3f2f71
commit
89e33c9797
|
@ -80,6 +80,7 @@
|
|||
|
||||
;; Fast Move in the buffer
|
||||
(global-set-key (kbd "M-1") 'avy-goto-word-or-subword-1)
|
||||
|
||||
(cheatsheet-add :group '--Navigation--
|
||||
:key "M-1"
|
||||
:description "Jump to the a word or subword in the buffer")
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
;;; Base --- Base library of FG42
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'fg42/extension)
|
||||
|
||||
|
@ -6,16 +10,17 @@
|
|||
|
||||
;; Macros ---------------------------------
|
||||
(defmacro theme (name &optional local)
|
||||
"Mark the given theme name as default them.
|
||||
local should be 't' if theme is on FG42 it self"
|
||||
"Mark the given theme NAME as default them.
|
||||
LOCAL should be 't' if theme is on FG42 it self"
|
||||
`(progn
|
||||
(setq default-theme ',(intern (symbol-name name)))
|
||||
(when (not (null ,local))
|
||||
(depends-on default-theme))))
|
||||
|
||||
|
||||
;; Functions ------------------------------
|
||||
(defun load-default-theme ()
|
||||
"Load the given theme name"
|
||||
"Load the given theme name."
|
||||
(require default-theme)
|
||||
|
||||
;; Setup the face look up function for spaceline
|
||||
|
@ -29,43 +34,35 @@ local should be 't' if theme is on FG42 it self"
|
|||
;; be responsible for loading the actual "custom-theme"
|
||||
(funcall (symbol-function default-theme)))
|
||||
|
||||
|
||||
(defun load--extension (extension)
|
||||
"Load a single extension and call its :on-initialize function"
|
||||
"Load a single EXTENSION and call its :on-initialize function."
|
||||
(let ((lib (concat "extensions/" (symbol-name extension))))
|
||||
(require (intern lib))))
|
||||
|
||||
|
||||
(defun initialize--extension (extension)
|
||||
"Initialize given extension by calling its :on-initialize function."
|
||||
"Initialize given EXTENSION by calling its :on-initialize function."
|
||||
(let ((init-func (fg42-extension-on-initialize (symbol-value extension))))
|
||||
(funcall (symbol-function init-func))))
|
||||
|
||||
|
||||
(defun initialize-extensions ()
|
||||
"Call the :on-initialize function on all extensions."
|
||||
(mapcar 'initialize--extension activated-extensions))
|
||||
|
||||
|
||||
(defun activate-extensions (&rest extensions)
|
||||
"Mark given plugins to load on FG42"
|
||||
"Mark given EXTENSIONS to load on FG42."
|
||||
(setq activated-extensions extensions)
|
||||
(mapcar 'load--extension extensions))
|
||||
|
||||
|
||||
(defun load-user-config (file)
|
||||
"Load the given path as user config file"
|
||||
"Load the given FILE as user config file."
|
||||
(if (file-exists-p file)
|
||||
(load-file file)))
|
||||
|
||||
(defun what-face (pos)
|
||||
(interactive "d")
|
||||
(let ((face (or (get-char-property (point) 'read-face-name)
|
||||
(get-char-property (point) 'face))))
|
||||
(if face (message "Face: %s" face) (message "No face at %d" pos))))
|
||||
|
||||
;;;###autoload
|
||||
(defun env (&rest args)
|
||||
"setup environment variables given as params."
|
||||
(require 'seq)
|
||||
(let ((pairs (seq-partition args 2)))
|
||||
(dolist (pair pairs)
|
||||
(progn (setenv (substring (symbol-name (car pair)) 1) (car (cdr pair)))))))
|
||||
|
||||
|
||||
(provide 'fg42/base)
|
||||
;;; base ends here
|
||||
|
|
|
@ -22,21 +22,22 @@
|
|||
(version nil)
|
||||
;; Callbacks
|
||||
(on-initialize nil)
|
||||
(on-load))
|
||||
|
||||
(on-load)
|
||||
(print-debugger nil))
|
||||
|
||||
|
||||
;; Functions ------------------------------
|
||||
|
||||
(defun active-ability? (name)
|
||||
"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."
|
||||
(dolist (abl abilities)
|
||||
(puthash abl t disabled-abilities)))
|
||||
|
||||
|
||||
;; Macros ---------------------------------
|
||||
(defmacro ability (name deps &rest body)
|
||||
"Define an ability with the given NAME, DEPS, and BODY.
|
||||
|
@ -50,16 +51,19 @@ to them.
|
|||
(when (null (delq t (mapcar 'active-ability? (quote ,deps))))
|
||||
,@body)))
|
||||
|
||||
|
||||
(defmacro extension (name &rest args)
|
||||
"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)
|
||||
"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)
|
||||
|
|
Loading…
Reference in New Issue